From e59d9e721d8ce65b685993be0b570cf128da8208 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Sat, 15 Nov 2014 10:53:53 +0000 Subject: Fix typo --- sx-question-mode.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sx-question-mode.el') diff --git a/sx-question-mode.el b/sx-question-mode.el index 5afb2e8..0ac2774 100644 --- a/sx-question-mode.el +++ b/sx-question-mode.el @@ -463,10 +463,10 @@ Prefix argument N moves N sections down or up." (while (> count 0) ;; This will either move us to the next section, or move out of ;; the current one. - (unless (sx-question-mode--goto-propety-change 'section n) + (unless (sx-question-mode--goto-property-change 'section n) ;; If all we did was move out the current one, then move again ;; and we're guaranteed to reach the next section. - (sx-question-mode--goto-propety-change 'section n)) + (sx-question-mode--goto-property-change 'section n)) (let ((ov (car-safe (sx-question-mode--section-overlays-at (point))))) (unless (and (overlayp ov) (overlay-get ov 'invisible)) @@ -483,7 +483,7 @@ Prefix argument N moves N sections up or down." (interactive "p") (sx-question-mode-next-section (- (or n 1)))) -(defun sx-question-mode--goto-propety-change (prop &optional direction) +(defun sx-question-mode--goto-property-change (prop &optional direction) "Move forward until the value of text-property sx-question-mode--PROP changes. Return the new value of PROP at point. If DIRECTION is negative, move backwards instead." -- cgit v1.2.3 From 5c4f1fe790190d7a6760213d70135d998783bae5 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Sat, 15 Nov 2014 11:13:10 +0000 Subject: Use more rx. --- sx-question-mode.el | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'sx-question-mode.el') diff --git a/sx-question-mode.el b/sx-question-mode.el index 0ac2774..39d352e 100644 --- a/sx-question-mode.el +++ b/sx-question-mode.el @@ -345,11 +345,13 @@ HEADER is given `sx-question-mode-header' face, and value is given FACE. (when sx-question-mode-bullet-appearance (font-lock-add-keywords ;; Bullet items. nil - `(("^ *\\(\\*\\|\\+\\|-\\|\\) " + `(((rx line-start (0+ blank) (group-n 1 (any "*+-")) blank) 1 '(face nil display ,sx-question-mode-bullet-appearance) prepend)))) (font-lock-add-keywords ;; Highlight usernames. nil - `(("\\(?: \\|^\\)\\(@\\(?:\\sw\\|\\s_\\)+\\)\\_>" + `(((rx (or blank line-start) + (group-n 1 (and "@" (1+ (or (syntax word) (syntax symbol))))) + symbol-end) 1 font-lock-builtin-face))) ;; Everything. (font-lock-fontify-region (point-min) (point-max)) @@ -426,10 +428,11 @@ If ID is nil, use ID2 instead." (save-match-data (goto-char (point-min)) (when (search-forward-regexp - (format "^\\s-*\\[\\(%s\\)]:\\s-+\\(?2:[^ ]+\\)" + (format (rx line-start (0+ blank) "[%s]:" (1+ blank) + (group-n 1 (1+ (not blank)))) (or id id2)) nil t) - (match-string-no-properties 2))))) + (match-string-no-properties 1))))) (defun sx-question-mode--move-over-pre () "Non-nil if paragraph at point can be filled." -- cgit v1.2.3