aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorChong Yidong2012-06-03 18:23:49 +0800
committerChong Yidong2012-06-03 18:23:49 +0800
commit383f7350f34707d317e169c203d3c6efb27ee46c (patch)
treee8167e326e325b1f4451b5f0d3929dd0708ac5d2 /lisp
parent1c476a0a7ffcbad019480b9057c17501c445eefb (diff)
downloademacs-383f7350f34707d317e169c203d3c6efb27ee46c.tar.gz
emacs-383f7350f34707d317e169c203d3c6efb27ee46c.zip
Make mode line help-echo visible for unibyte buffers.
* src/xdisp.c (decode_mode_spec_coding): Display a space for a unibyte buffer. * lisp/bindings.el (mode-line-mule-info-help-echo) (mode-line-read-only-help-echo, mode-line-modified-help-echo): New functions. (mode-line-mule-info, mode-line-modified): Use them. (mode-line-eol-desc, propertized-buffer-identification): Consistency fixes for help text. Fixes: debbugs:11226
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/bindings.el70
2 files changed, 37 insertions, 38 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 5a3b1d3926d..5ecd949d4c1 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -7,6 +7,11 @@
7 (mode-line-modes, mode-line-position): Move the default value to 7 (mode-line-modes, mode-line-position): Move the default value to
8 the variable definition. 8 the variable definition.
9 (mode-line-default-help-echo): New defcustom. 9 (mode-line-default-help-echo): New defcustom.
10 (mode-line-mule-info-help-echo, mode-line-read-only-help-echo)
11 (mode-line-modified-help-echo): New functions.
12 (mode-line-mule-info, mode-line-modified): Use them.
13 (mode-line-eol-desc, propertized-buffer-identification):
14 Consistency fixes for help text.
10 15
112012-06-02 Stefan Monnier <monnier@iro.umontreal.ca> 162012-06-02 Stefan Monnier <monnier@iro.umontreal.ca>
12 17
diff --git a/lisp/bindings.el b/lisp/bindings.el
index 65dd68a4447..8e6c94466cf 100644
--- a/lisp/bindings.el
+++ b/lisp/bindings.el
@@ -111,7 +111,7 @@ corresponding to the mode line clicked."
111 (setq desc 111 (setq desc
112 (propertize 112 (propertize
113 mnemonic 113 mnemonic
114 'help-echo (format "End-of-line style: %s\nmouse-1 to cycle" 114 'help-echo (format "End-of-line style: %s\nmouse-1: Cycle"
115 (if (eq eol 0) "Unix-style LF" 115 (if (eq eol 0) "Unix-style LF"
116 (if (eq eol 1) "DOS-style CRLF" 116 (if (eq eol 1) "DOS-style CRLF"
117 (if (eq eol 2) "Mac-style CR" 117 (if (eq eol 2) "Mac-style CR"
@@ -148,6 +148,16 @@ the mode line, except that if there is a memory-full message, it
148is displayed first.") 148is displayed first.")
149(put 'mode-line-front-space 'risky-local-variable t) 149(put 'mode-line-front-space 'risky-local-variable t)
150 150
151(defun mode-line-mule-info-help-echo (window _object _point)
152 "Return help text specifying WINDOW's buffer coding system."
153 (with-current-buffer (window-buffer window)
154 (if buffer-file-coding-system
155 (format "Buffer coding system (%s): %s
156mouse-1: Describe coding system"
157 (if enable-multibyte-characters "multi-byte" "unibyte")
158 (symbol-name buffer-file-coding-system))
159 "Buffer coding system: none specified")))
160
151(defvar mode-line-mule-info 161(defvar mode-line-mule-info
152 `("" 162 `(""
153 (current-input-method 163 (current-input-method
@@ -162,31 +172,16 @@ mouse-3: Describe current input method"))
162 mouse-face mode-line-highlight)) 172 mouse-face mode-line-highlight))
163 ,(propertize 173 ,(propertize
164 "%z" 174 "%z"
165 'help-echo 175 'help-echo 'mode-line-mule-info-help-echo
166 (lambda (window _object _point)
167 (with-current-buffer (window-buffer window)
168 ;; Don't show this tip if the coding system is nil,
169 ;; it reads like a bug, and is not useful anyway.
170 (when buffer-file-coding-system
171 (format "Buffer coding system %s\nmouse-1: describe coding system"
172 (if enable-multibyte-characters
173 (concat "(multi-byte): "
174 (symbol-name buffer-file-coding-system))
175 (concat "(unibyte): "
176 (symbol-name buffer-file-coding-system)))))))
177 'mouse-face 'mode-line-highlight 176 'mouse-face 'mode-line-highlight
178 'local-map mode-line-coding-system-map) 177 'local-map mode-line-coding-system-map)
179 (:eval (mode-line-eol-desc))) 178 (:eval (mode-line-eol-desc)))
180 "Mode line construct for displaying information of multilingual environment. 179 "Mode line construct to report the multilingual environment.
181Normally it displays current input method (if any activated) and 180Normally it displays current input method (if any activated) and
182mnemonics of the following coding systems: 181mnemonics of the following coding systems:
183 coding system for saving or writing the current buffer 182 coding system for saving or writing the current buffer
184 coding system for keyboard input (if Emacs is running on terminal) 183 coding system for keyboard input (on a text terminal)
185 coding system for terminal output (if Emacs is running on terminal)" 184 coding system for terminal output (on a text terminal)")
186 ;; Currently not:
187 ;; coding system for decoding output of buffer process (if any)
188 ;; coding system for encoding text to send to buffer process (if any)."
189)
190;;;###autoload 185;;;###autoload
191(put 'mode-line-mule-info 'risky-local-variable t) 186(put 'mode-line-mule-info 'risky-local-variable t)
192(make-variable-buffer-local 'mode-line-mule-info) 187(make-variable-buffer-local 'mode-line-mule-info)
@@ -199,29 +194,29 @@ mnemonics of the following coding systems:
199;;;###autoload 194;;;###autoload
200(put 'mode-line-client 'risky-local-variable t) 195(put 'mode-line-client 'risky-local-variable t)
201 196
197(defun mode-line-read-only-help-echo (window _object _point)
198 "Return help text specifying WINDOW's buffer read-only status."
199 (format "Buffer is %s\nmouse-1: Toggle"
200 (if (buffer-local-value 'buffer-read-only (window-buffer window))
201 "read-only"
202 "writable")))
203
204(defun mode-line-modified-help-echo (window _object _point)
205 "Return help text specifying WINDOW's buffer modification status."
206 (format "Buffer is %smodified\nmouse-1: Toggle modification state"
207 (if (buffer-modified-p (window-buffer window)) "" "not ")))
208
202(defvar mode-line-modified 209(defvar mode-line-modified
203 (list (propertize 210 (list (propertize
204 "%1*" 211 "%1*"
205 'help-echo (purecopy (lambda (window _object _point) 212 'help-echo 'mode-line-read-only-help-echo
206 (format "Buffer is %s\nmouse-1 toggles"
207 (save-selected-window
208 (select-window window)
209 (if buffer-read-only
210 "read-only"
211 "writable")))))
212 'local-map (purecopy (make-mode-line-mouse-map 213 'local-map (purecopy (make-mode-line-mouse-map
213 'mouse-1 214 'mouse-1
214 #'mode-line-toggle-read-only)) 215 #'mode-line-toggle-read-only))
215 'mouse-face 'mode-line-highlight) 216 'mouse-face 'mode-line-highlight)
216 (propertize 217 (propertize
217 "%1+" 218 "%1+"
218 'help-echo (purecopy (lambda (window _object _point) 219 'help-echo 'mode-line-modified-help-echo
219 (format "Buffer is %sodified\nmouse-1 toggles modified state"
220 (save-selected-window
221 (select-window window)
222 (if (buffer-modified-p)
223 "m"
224 "not m")))))
225 'local-map (purecopy (make-mode-line-mouse-map 220 'local-map (purecopy (make-mode-line-mouse-map
226 'mouse-1 #'mode-line-toggle-modified)) 221 'mouse-1 #'mode-line-toggle-modified))
227 'mouse-face 'mode-line-highlight)) 222 'mouse-face 'mode-line-highlight))
@@ -312,7 +307,7 @@ mouse-1: Display minor mode menu\n\
312mouse-2: Show help for minor mode\n\ 307mouse-2: Show help for minor mode\n\
313mouse-3: Toggle minor modes" 308mouse-3: Toggle minor modes"
314 local-map ,mode-line-minor-mode-keymap) 309 local-map ,mode-line-minor-mode-keymap)
315 (propertize "%n" 'help-echo "mouse-2: Remove narrowing from the current buffer" 310 (propertize "%n" 'help-echo "mouse-2: Remove narrowing from buffer"
316 'mouse-face 'mode-line-highlight 311 'mouse-face 'mode-line-highlight
317 'local-map (make-mode-line-mouse-map 312 'local-map (make-mode-line-mouse-map
318 'mouse-2 #'mode-line-widen)) 313 'mouse-2 #'mode-line-widen))
@@ -401,9 +396,8 @@ text properties for face, help-echo, and local-map to it."
401 (list (propertize fmt 396 (list (propertize fmt
402 'face 'mode-line-buffer-id 397 'face 'mode-line-buffer-id
403 'help-echo 398 'help-echo
404 (purecopy "Buffer name\n\ 399 (purecopy "Buffer name
405mouse-1: previous buffer\n\ 400mouse-1: Previous buffer\nmouse-3: Next buffer")
406mouse-3: next buffer")
407 'mouse-face 'mode-line-highlight 401 'mouse-face 'mode-line-highlight
408 'local-map mode-line-buffer-identification-keymap))) 402 'local-map mode-line-buffer-identification-keymap)))
409 403