aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Zlatanov2020-06-22 16:29:25 -0400
committerTed Zlatanov2020-06-22 16:31:12 -0400
commit9c5b83811823b2440978572d95cd5e94f6a7fd7c (patch)
treec84d354d38118277f3d7e360293babbbd1f044ce
parent4a7c98d21c20d3c9740789ba53054556486d7e04 (diff)
downloademacs-scratch/tzz/auth-source-reveal-mode.tar.gz
emacs-scratch/tzz/auth-source-reveal-mode.zip
auth-source-reveal-mode: fixes from code reviewscratch/tzz/auth-source-reveal-mode
-rw-r--r--lisp/progmodes/prog-mode.el23
1 files changed, 16 insertions, 7 deletions
diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el
index 605b4444f97..ffc474b2082 100644
--- a/lisp/progmodes/prog-mode.el
+++ b/lisp/progmodes/prog-mode.el
@@ -101,15 +101,20 @@ For example: \"->\" to the Unicode RIGHT ARROW →
101 101
102Elements can also look like (IDENTIFIER REGEXP CHARACTER) which 102Elements can also look like (IDENTIFIER REGEXP CHARACTER) which
103will behave like the simpler (SYMBOL-STRING . CHARACTER) form 103will behave like the simpler (SYMBOL-STRING . CHARACTER) form
104except it will match regular expressions. The IDENTIFIER can be 104except it will match regular expressions. The REGEXP can have
105any symbol and should be unique to every package that augments 105capturing groups, in which case the first such group will be
106`prettify-symbols-alist' (in order to remove prettifications 106prettified. If there are no capturing groups, the whole REGEXP is
107easily with `prettify-symbols-remove-prettifications'). 107prettified.
108
109The IDENTIFIER can be any symbol and should be unique to every
110package that augments `prettify-symbols-alist' (in order to
111remove prettifications easily with
112`prettify-symbols-remove-prettifications').
108 113
109For example: \"abc[123]\" matching \"abc1\", \"abc2\", or 114For example: \"abc[123]\" matching \"abc1\", \"abc2\", or
110\"abc3\" could be mapped to the Unicode WORLD MAP. Note again the 115\"abc3\" could be mapped to the Unicode WORLD MAP. Note again the
111IDENTIFIER is an arbitrary Lisp symbol. 116IDENTIFIER is an arbitrary Lisp symbol.
112 (my-worldmap \"abc[123]\" 128506) 117 (my-worldmap \"abc[123]\" ?\U0001f5fa)
113 118
114CHARACTER can be a character, or it can be a list or vector, in 119CHARACTER can be a character, or it can be a list or vector, in
115which case it will be used to compose the new symbol as per the 120which case it will be used to compose the new symbol as per the
@@ -156,8 +161,12 @@ START and END are passed back and may be modified (narrowed)."
156 ;; ...We need to always do a string-match for the bounds. 161 ;; ...We need to always do a string-match for the bounds.
157 (string-match (nth 1 ps) match)) 162 (string-match (nth 1 ps) match))
158 ;; Now return the actual prettification start and end. 163 ;; Now return the actual prettification start and end.
159 return (list (+ start (match-beginning 1)) 164 return (list (+ start (or
160 (+ start(match-end 1)) 165 (match-beginning 1)
166 (match-beginning 0)))
167 (+ start (or
168 (match-end 1)
169 (match-end 0)))
161 (nth 2 ps)))))) 170 (nth 2 ps))))))
162 171
163(defvar-local prettify-symbols-compose-replacer 172(defvar-local prettify-symbols-compose-replacer