aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Heuer1995-05-30 18:31:00 +0000
committerKarl Heuer1995-05-30 18:31:00 +0000
commitf34eaa2c2fe5b35014705484e26fe43beaaecead (patch)
treee4877112e262a728ee8344a45df2389c751d780c
parentc0eb044d0a8d997bcefa70a54ec6d7e30c1af6b2 (diff)
downloademacs-f34eaa2c2fe5b35014705484e26fe43beaaecead.tar.gz
emacs-f34eaa2c2fe5b35014705484e26fe43beaaecead.zip
(facemenu-special-menu): Use characters, not symbols.
Add Remove Special menu item. (facemenu-remove-special): New function. (facemenu-set-face-from-menu): If prefix arg, treat region as inactive. (facemenu-set-face): Likewise. (facemenu-keymap, facemenu-foreground-menu, facemenu-background-menu): Add ... after Other. (facemenu-menu): Change name to Text Properties. (facemenu-remove-really-all): New function. (facemenu-special-menu): Add Remove All menu item. (facemenu-indentation-menu): Make item names clearer. Pick new key names too. (facemenu-menu): Split up definition. Move `Remove All' item here. (facemenu-special-menu): Delete `Remove All' item. (facemenu-remove-all): Renamed from facemenu-remove-really-all. (facemenu-remove-props): Renamed from facemenu-remove-all.
-rw-r--r--lisp/facemenu.el123
1 files changed, 76 insertions, 47 deletions
diff --git a/lisp/facemenu.el b/lisp/facemenu.el
index 1c9c5de811f..5bf9e24c30c 100644
--- a/lisp/facemenu.el
+++ b/lisp/facemenu.el
@@ -148,7 +148,7 @@ when they are created.")
148;;;###autoload 148;;;###autoload
149(defvar facemenu-foreground-menu 149(defvar facemenu-foreground-menu
150 (let ((map (make-sparse-keymap "Foreground Color"))) 150 (let ((map (make-sparse-keymap "Foreground Color")))
151 (define-key map "o" (cons "Other" 'facemenu-set-foreground)) 151 (define-key map "o" (cons "Other..." 'facemenu-set-foreground))
152 map) 152 map)
153 "Menu keymap for foreground colors.") 153 "Menu keymap for foreground colors.")
154;;;###autoload 154;;;###autoload
@@ -157,7 +157,7 @@ when they are created.")
157;;;###autoload 157;;;###autoload
158(defvar facemenu-background-menu 158(defvar facemenu-background-menu
159 (let ((map (make-sparse-keymap "Background Color"))) 159 (let ((map (make-sparse-keymap "Background Color")))
160 (define-key map "o" (cons "Other" 'facemenu-set-background)) 160 (define-key map "o" (cons "Other..." 'facemenu-set-background))
161 map) 161 map)
162 "Menu keymap for background colors") 162 "Menu keymap for background colors")
163;;;###autoload 163;;;###autoload
@@ -166,9 +166,10 @@ when they are created.")
166;;;###autoload 166;;;###autoload
167(defvar facemenu-special-menu 167(defvar facemenu-special-menu
168 (let ((map (make-sparse-keymap "Special"))) 168 (let ((map (make-sparse-keymap "Special")))
169 (define-key map [read-only] (cons "Read-Only" 'facemenu-set-read-only)) 169 (define-key map [?s] (cons "Remove Special" 'facemenu-remove-special))
170 (define-key map [invisible] (cons "Invisible" 'facemenu-set-invisible)) 170 (define-key map [?t] (cons "Intangible" 'facemenu-set-intangible))
171 (define-key map [intangible] (cons "Intangible" 'facemenu-set-intangible)) 171 (define-key map [?v] (cons "Invisible" 'facemenu-set-invisible))
172 (define-key map [?r] (cons "Read-Only" 'facemenu-set-read-only))
172 map) 173 map)
173 "Menu keymap for non-face text-properties.") 174 "Menu keymap for non-face text-properties.")
174;;;###autoload 175;;;###autoload
@@ -190,42 +191,48 @@ when they are created.")
190;;;###autoload 191;;;###autoload
191(defvar facemenu-indentation-menu 192(defvar facemenu-indentation-menu
192 (let ((map (make-sparse-keymap "Indentation"))) 193 (let ((map (make-sparse-keymap "Indentation")))
193 (define-key map [UnIndentRight] 194 (define-key map [decrease-right-margin]
194 (cons "UnIndentRight" 'decrease-right-margin)) 195 (cons "Indent Right Less" 'decrease-right-margin))
195 (define-key map [IndentRight] 196 (define-key map [increase-right-margin]
196 (cons "IndentRight" 'increase-right-margin)) 197 (cons "Indent Right More" 'increase-right-margin))
197 (define-key map [Unindent] 198 (define-key map [decrease-left-margin]
198 (cons "UnIndent" 'decrease-left-margin)) 199 (cons "Indent Less" 'decrease-left-margin))
199 (define-key map [Indent] 200 (define-key map [increase-left-margin]
200 (cons "Indent" 'increase-left-margin)) 201 (cons "Indent More" 'increase-left-margin))
201 map) 202 map)
202 "Submenu for indentation commands.") 203 "Submenu for indentation commands.")
203;;;###autoload 204;;;###autoload
204(defalias 'facemenu-indentation-menu facemenu-indentation-menu) 205(defalias 'facemenu-indentation-menu facemenu-indentation-menu)
205 206
207;; This is split up to avoid an overlong line in loaddefs.el.
206;;;###autoload 208;;;###autoload
207(defvar facemenu-menu 209(defvar facemenu-menu nil
208 (let ((map (make-sparse-keymap "Face")))
209 (define-key map [dc] (cons "Display Colors" 'list-colors-display))
210 (define-key map [df] (cons "Display Faces" 'list-faces-display))
211 (define-key map [dp] (cons "List Properties" 'list-text-properties-at))
212 (define-key map [rm] (cons "Remove Properties" 'facemenu-remove-all))
213 (define-key map [s1] (list "-----------------"))
214 (define-key map [in] (cons "Indentation" 'facemenu-indentation-menu))
215 (define-key map [ju] (cons "Justification" 'facemenu-justification-menu))
216 (define-key map [s2] (list "-----------------"))
217 (define-key map [sp] (cons "Special Props" 'facemenu-special-menu))
218 (define-key map [bg] (cons "Background Color" 'facemenu-background-menu))
219 (define-key map [fg] (cons "Foreground Color" 'facemenu-foreground-menu))
220 (define-key map [fc] (cons "Face" 'facemenu-face-menu))
221 map)
222 "Facemenu top-level menu keymap.") 210 "Facemenu top-level menu keymap.")
223;;;###autoload 211;;;###autoload
212(setq facemenu-menu (make-sparse-keymap "Text Properties"))
213;;;###autoload
214(let ((map facemenu-menu))
215 (define-key map [dc] (cons "Display Colors" 'list-colors-display))
216 (define-key map [df] (cons "Display Faces" 'list-faces-display))
217 (define-key map [dp] (cons "List Properties" 'list-text-properties-at))
218 (define-key map [ra] (cons "Remove All" 'facemenu-remove-all))
219 (define-key map [rm] (cons "Remove Properties" 'facemenu-remove-props))
220 (define-key map [s1] (list "-----------------")))
221;;;###autoload
222(let ((map facemenu-menu))
223 (define-key map [in] (cons "Indentation" 'facemenu-indentation-menu))
224 (define-key map [ju] (cons "Justification" 'facemenu-justification-menu))
225 (define-key map [s2] (list "-----------------"))
226 (define-key map [sp] (cons "Special Props" 'facemenu-special-menu))
227 (define-key map [bg] (cons "Background Color" 'facemenu-background-menu))
228 (define-key map [fg] (cons "Foreground Color" 'facemenu-foreground-menu))
229 (define-key map [fc] (cons "Face" 'facemenu-face-menu)))
230;;;###autoload
224(defalias 'facemenu-menu facemenu-menu) 231(defalias 'facemenu-menu facemenu-menu)
225 232
226(defvar facemenu-keymap 233(defvar facemenu-keymap
227 (let ((map (make-sparse-keymap "Set face"))) 234 (let ((map (make-sparse-keymap "Set face")))
228 (define-key map "o" (cons "Other" 'facemenu-set-face)) 235 (define-key map "o" (cons "Other..." 'facemenu-set-face))
229 map) 236 map)
230 "Keymap for face-changing commands. 237 "Keymap for face-changing commands.
231`Facemenu-update' fills in the keymap according to the bindings 238`Facemenu-update' fills in the keymap according to the bindings
@@ -259,16 +266,18 @@ variables."
259It will be added to the top of the face list; any faces lower on the list that 266It will be added to the top of the face list; any faces lower on the list that
260will not show through at all will be removed. 267will not show through at all will be removed.
261 268
262Interactively, the face to be used is prompted for. 269Interactively, the face to be used is read with the minibuffer.
263If the region is active, it will be set to the requested face. If 270
264it is inactive \(even if mark-even-if-inactive is set) the next 271If the region is active and there is no prefix argument,
265character that is typed \(or otherwise inserted) will be set to 272this command sets the region to the requested face.
266the selected face. Moving point or switching buffers before 273
267typing a character cancels the request." 274Otherwise, this command specifies the face for the next character
275inserted. Moving point or switching buffers before
276typing a character to insert cancels the specification."
268 (interactive (list (read-face-name "Use face: "))) 277 (interactive (list (read-face-name "Use face: ")))
269 (barf-if-buffer-read-only) 278 (barf-if-buffer-read-only)
270 (facemenu-add-new-face face) 279 (facemenu-add-new-face face)
271 (if mark-active 280 (if (and mark-active (not current-prefix-arg))
272 (let ((start (or start (region-beginning))) 281 (let ((start (or start (region-beginning)))
273 (end (or end (region-end)))) 282 (end (or end (region-end))))
274 (facemenu-add-face face start end)) 283 (facemenu-add-face face start end))
@@ -309,14 +318,18 @@ typing a character cancels the request."
309 "Set the face of the region or next character typed. 318 "Set the face of the region or next character typed.
310This function is designed to be called from a menu; the face to use 319This function is designed to be called from a menu; the face to use
311is the menu item's name. 320is the menu item's name.
312If the region is active, it will be set to the requested face. If 321
313it is inactive \(even if mark-even-if-inactive is set) the next 322If the region is active and there is no prefix argument,
314character that is typed \(or otherwise inserted) will be set to 323this command sets the region to the requested face.
315the selected face. Moving point or switching buffers before 324
316typing a character cancels the request." 325Otherwise, this command specifies the face for the next character
326inserted. Moving point or switching buffers before
327typing a character to insert cancels the specification."
317 (interactive (list last-command-event 328 (interactive (list last-command-event
318 (if mark-active (region-beginning)) 329 (if (and mark-active (not current-prefix-arg))
319 (if mark-active (region-end)))) 330 (region-beginning))
331 (if (and mark-active (not current-prefix-arg))
332 (region-end))))
320 (barf-if-buffer-read-only) 333 (barf-if-buffer-read-only)
321 (facemenu-get-face face) 334 (facemenu-get-face face)
322 (if start 335 (if start
@@ -335,7 +348,7 @@ typing a character cancels the request."
335(defun facemenu-set-invisible (start end) 348(defun facemenu-set-invisible (start end)
336 "Make the region invisible. 349 "Make the region invisible.
337This sets the `invisible' text property; it can be undone with 350This sets the `invisible' text property; it can be undone with
338`facemenu-remove-all'." 351`facemenu-remove-special'."
339 (interactive "r") 352 (interactive "r")
340 (put-text-property start end 'invisible t)) 353 (put-text-property start end 'invisible t))
341 354
@@ -343,7 +356,7 @@ This sets the `invisible' text property; it can be undone with
343(defun facemenu-set-intangible (start end) 356(defun facemenu-set-intangible (start end)
344 "Make the region intangible: disallow moving into it. 357 "Make the region intangible: disallow moving into it.
345This sets the `intangible' text property; it can be undone with 358This sets the `intangible' text property; it can be undone with
346`facemenu-remove-all'." 359`facemenu-remove-special'."
347 (interactive "r") 360 (interactive "r")
348 (put-text-property start end 'intangible t)) 361 (put-text-property start end 'intangible t))
349 362
@@ -351,12 +364,12 @@ This sets the `intangible' text property; it can be undone with
351(defun facemenu-set-read-only (start end) 364(defun facemenu-set-read-only (start end)
352 "Make the region unmodifiable. 365 "Make the region unmodifiable.
353This sets the `read-only' text property; it can be undone with 366This sets the `read-only' text property; it can be undone with
354`facemenu-remove-all'." 367`facemenu-remove-special'."
355 (interactive "r") 368 (interactive "r")
356 (put-text-property start end 'read-only t)) 369 (put-text-property start end 'read-only t))
357 370
358;;;###autoload 371;;;###autoload
359(defun facemenu-remove-all (start end) 372(defun facemenu-remove-props (start end)
360 "Remove all text properties that facemenu added to region." 373 "Remove all text properties that facemenu added to region."
361 (interactive "*r") ; error if buffer is read-only despite the next line. 374 (interactive "*r") ; error if buffer is read-only despite the next line.
362 (let ((inhibit-read-only t)) 375 (let ((inhibit-read-only t))
@@ -365,6 +378,22 @@ This sets the `read-only' text property; it can be undone with
365 read-only nil category nil)))) 378 read-only nil category nil))))
366 379
367;;;###autoload 380;;;###autoload
381(defun facemenu-remove-all (start end)
382 "Remove all text properties from the region."
383 (interactive "*r") ; error if buffer is read-only despite the next line.
384 (let ((inhibit-read-only t))
385 (set-text-properties start end nil)))
386
387;;;###autoload
388(defun facemenu-remove-special (start end)
389 "Remove all the \"special\" text properties from the region.
390These special properties include `invisible', `intangible' and `read-only'."
391 (interactive "*r") ; error if buffer is read-only despite the next line.
392 (let ((inhibit-read-only t))
393 (remove-text-properties
394 start end '(invisible nil intangible nil read-only nil))))
395
396;;;###autoload
368(defun list-text-properties-at (p) 397(defun list-text-properties-at (p)
369 "Pop up a buffer listing text-properties at LOCATION." 398 "Pop up a buffer listing text-properties at LOCATION."
370 (interactive "d") 399 (interactive "d")