aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2012-06-03 18:23:49 +0800
committerChong Yidong2012-06-03 18:23:49 +0800
commit383f7350f34707d317e169c203d3c6efb27ee46c (patch)
treee8167e326e325b1f4451b5f0d3929dd0708ac5d2
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
-rw-r--r--etc/NEWS6
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/bindings.el70
-rw-r--r--src/ChangeLog5
-rw-r--r--src/xdisp.c8
5 files changed, 52 insertions, 42 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 3ffbbd24d45..c24a8fbdfc6 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -87,6 +87,12 @@ to nil. Use with caution, and only if you really need to.
87** Using "unibyte: t" in Lisp source files is obsolete. 87** Using "unibyte: t" in Lisp source files is obsolete.
88Use "coding: raw-text" instead. 88Use "coding: raw-text" instead.
89 89
90** Mode line changes
91
92*** New option `mode-line-default-help-echo' specifies the help text
93(shown in a tooltip or in the echo area) for any part of the mode line
94that does not have its own specialized help text.
95
90 96
91* Editing Changes in Emacs 24.2 97* Editing Changes in Emacs 24.2
92 98
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
diff --git a/src/ChangeLog b/src/ChangeLog
index c0098445cb8..4eaf2d49f36 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,10 @@
12012-06-03 Chong Yidong <cyd@gnu.org> 12012-06-03 Chong Yidong <cyd@gnu.org>
2 2
3 * xdisp.c (decode_mode_spec_coding): Display a space for a unibyte
4 buffer (Bug#11226).
5
62012-06-03 Chong Yidong <cyd@gnu.org>
7
3 * xdisp.c (calc_pixel_width_or_height): Use Fbuffer_local_value. 8 * xdisp.c (calc_pixel_width_or_height): Use Fbuffer_local_value.
4 (note_mode_line_or_margin_highlight): If there is no help echo, 9 (note_mode_line_or_margin_highlight): If there is no help echo,
5 use mode-line-default-help-echo. Handle the case where the mouse 10 use mode-line-default-help-echo. Handle the case where the mouse
diff --git a/src/xdisp.c b/src/xdisp.c
index 8a1d83dc8e6..f01c86b2a07 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -21012,8 +21012,7 @@ decode_mode_spec_coding (Lisp_Object coding_system, register char *buf, int eol_
21012 21012
21013 if (!VECTORP (val)) /* Not yet decided. */ 21013 if (!VECTORP (val)) /* Not yet decided. */
21014 { 21014 {
21015 if (multibyte) 21015 *buf++ = multibyte ? '-' : ' ';
21016 *buf++ = '-';
21017 if (eol_flag) 21016 if (eol_flag)
21018 eoltype = eol_mnemonic_undecided; 21017 eoltype = eol_mnemonic_undecided;
21019 /* Don't mention EOL conversion if it isn't decided. */ 21018 /* Don't mention EOL conversion if it isn't decided. */
@@ -21026,8 +21025,9 @@ decode_mode_spec_coding (Lisp_Object coding_system, register char *buf, int eol_
21026 attrs = AREF (val, 0); 21025 attrs = AREF (val, 0);
21027 eolvalue = AREF (val, 2); 21026 eolvalue = AREF (val, 2);
21028 21027
21029 if (multibyte) 21028 *buf++ = multibyte
21030 *buf++ = XFASTINT (CODING_ATTR_MNEMONIC (attrs)); 21029 ? XFASTINT (CODING_ATTR_MNEMONIC (attrs))
21030 : ' ';
21031 21031
21032 if (eol_flag) 21032 if (eol_flag)
21033 { 21033 {