* Toggle EOL [not found] <F102hm4mRK4dGDNhxKL00000226@hotmail.com> @ 2002-06-28 17:07 ` Stefan Monnier 2002-06-28 20:01 ` Jan D. 2002-06-29 22:21 ` Richard Stallman 2002-06-29 8:41 ` Profiling font-lock in xemacs Richard Stallman 1 sibling, 2 replies; 5+ messages in thread From: Stefan Monnier @ 2002-06-28 17:07 UTC (permalink / raw) I think that the EOL information in the mode-line should be better separated from the coding-system info. The patch below gives it its own help-echo and its own keymap (mouse-3 switches between the three different possible EOL). Any comment/objection ? Stefan Index: bindings.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/bindings.el,v retrieving revision 1.100 diff -u -u -b -r1.100 bindings.el --- bindings.el 16 Apr 2002 14:55:13 -0000 1.100 +++ bindings.el 28 Jun 2002 17:01:15 -0000 @@ -135,6 +135,36 @@ "Local keymap for the coding-system part of the mode line.") +(defvar mode-line-eol-map + (let ((map (make-sparse-keymap))) + (define-key map [mode-line mouse-3] + (lambda () + (interactive) + (let ((eol (coding-system-eol-type buffer-file-coding-system))) + (set-buffer-file-coding-system + (cond ((eq eol 0) 'dos) ((eq eol 1) 'mac) (t 'unix)))))) + (purecopy map)) + "Local keymap for the `coding-system-eol-type' part of the mode line.") + +(defvar mode-line-eol-desc-cache nil) + +(defun mode-line-eol-desc () + (let* ((eol (coding-system-eol-type buffer-file-coding-system)) + (mnemonic (coding-system-eol-type-mnemonic buffer-file-coding-system)) + (desc (assq eol mode-line-eol-desc-cache))) + (if (and desc (eq (cadr desc) mnemonic)) + (cddr desc) + (setq desc + (propertize + mnemonic + 'help-echo (format "%s end-of-line; mouse-3 to change" + (if (eq eol 0) "Unix-style LF" + (if (eq eol 1) "Dos-style CRLF" + (if (eq eol 2) "Mac-style CR" "Undecided")))) + 'keymap mode-line-eol-map)) + (push (cons eol (cons mnemonic desc)) mode-line-eol-desc-cache) + desc))) + (defvar mode-line-mule-info `("" (current-input-method @@ -145,7 +175,7 @@ ". mouse-2: disable, mouse-3: describe") local-map ,mode-line-input-method-map)) ,(propertize - "%Z" + "%z" 'help-echo #'(lambda (window object point) (with-current-buffer (window-buffer window) @@ -157,16 +187,17 @@ " buffer; mouse-3: describe coding system") (concat "Unibyte " (symbol-name buffer-file-coding-system) " buffer"))))) - 'local-map mode-line-coding-system-map)) + 'local-map mode-line-coding-system-map) + (:eval (mode-line-eol-desc)))) "Mode-line control for displaying information of multilingual environment. Normally it displays current input method (if any activated) and mnemonics of the following coding systems: ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Toggle EOL 2002-06-28 17:07 ` Toggle EOL Stefan Monnier @ 2002-06-28 20:01 ` Jan D. 2002-06-28 20:42 ` Stefan Monnier 2002-06-29 22:21 ` Richard Stallman 1 sibling, 1 reply; 5+ messages in thread From: Jan D. @ 2002-06-28 20:01 UTC (permalink / raw) Cc: emacs-devel > > I think that the EOL information in the mode-line should be > better separated from the coding-system info. The patch below > gives it its own help-echo and its own keymap (mouse-3 switches > between the three different possible EOL). > > Any comment/objection ? I like it. But is the patch correct? My patch program complained that the last hunk was corrupted. And I think this line: + (:eval (mode-line-eol-desc)))) should end in 3 ), not 4. But the concept is great, I've had some problems explaining coding systems at work, this makes things easier. Jan D. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Toggle EOL 2002-06-28 20:01 ` Jan D. @ 2002-06-28 20:42 ` Stefan Monnier 0 siblings, 0 replies; 5+ messages in thread From: Stefan Monnier @ 2002-06-28 20:42 UTC (permalink / raw) Cc: Stefan Monnier, emacs-devel > > > > I think that the EOL information in the mode-line should be > > better separated from the coding-system info. The patch below > > gives it its own help-echo and its own keymap (mouse-3 switches > > between the three different possible EOL). > > > > Any comment/objection ? > > I like it. But is the patch correct? My patch program complained > that the last hunk was corrupted. And I think this line: > + (:eval (mode-line-eol-desc)))) Yes, there was a typo and I fiddle with the patch by hand :-( This one should work better, Stefan diff -u -u -b -r1.100 bindings.el --- bindings.el 16 Apr 2002 14:55:13 -0000 1.100 +++ bindings.el 28 Jun 2002 20:41:28 -0000 @@ -135,6 +135,38 @@ "Local keymap for the coding-system part of the mode line.") +(defvar mode-line-eol-map + (let ((map (make-sparse-keymap))) + (define-key map [mode-line mouse-3] + (lambda () + (interactive) + (let ((eol (coding-system-eol-type buffer-file-coding-system))) + (set-buffer-file-coding-system + (cond ((eq eol 0) 'dos) ((eq eol 1) 'mac) (t 'unix)))))) + (purecopy map)) + "Local keymap for the `coding-system-eol-type' part of the mode line.") + +(defvar mode-line-eol-desc-cache nil) + +(defun mode-line-eol-desc () + (let* ((eol (coding-system-eol-type buffer-file-coding-system)) + (mnemonic (coding-system-eol-type-mnemonic buffer-file-coding-system)) + (desc (assq eol mode-line-eol-desc-cache))) + (if (and desc (eq (cadr desc) mnemonic)) + (cddr desc) + (if desc (setq mode-line-eol-desc-cache nil)) ;Flush the cache if stale. + (setq desc + (propertize + mnemonic + 'help-echo (format "%s end-of-line; mouse-3 to cycle" + (if (eq eol 0) "Unix-style LF" + (if (eq eol 1) "Dos-style CRLF" + (if (eq eol 2) "Mac-style CR" + "Undecided")))) + 'keymap mode-line-eol-map)) + (push (cons eol (cons mnemonic desc)) mode-line-eol-desc-cache) + desc))) + (defvar mode-line-mule-info `("" (current-input-method @@ -145,7 +177,7 @@ ". mouse-2: disable, mouse-3: describe") local-map ,mode-line-input-method-map)) ,(propertize - "%Z" + "%z" 'help-echo #'(lambda (window object point) (with-current-buffer (window-buffer window) @@ -157,7 +189,8 @@ " buffer; mouse-3: describe coding system") (concat "Unibyte " (symbol-name buffer-file-coding-system) " buffer"))))) - 'local-map mode-line-coding-system-map)) + 'local-map mode-line-coding-system-map) + (:eval (mode-line-eol-desc))) "Mode-line control for displaying information of multilingual environment. Normally it displays current input method (if any activated) and mnemonics of the following coding systems: ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Toggle EOL 2002-06-28 17:07 ` Toggle EOL Stefan Monnier 2002-06-28 20:01 ` Jan D. @ 2002-06-29 22:21 ` Richard Stallman 1 sibling, 0 replies; 5+ messages in thread From: Richard Stallman @ 2002-06-29 22:21 UTC (permalink / raw) Cc: emacs-devel The general idea looks good. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Profiling font-lock in xemacs [not found] <F102hm4mRK4dGDNhxKL00000226@hotmail.com> 2002-06-28 17:07 ` Toggle EOL Stefan Monnier @ 2002-06-29 8:41 ` Richard Stallman 1 sibling, 0 replies; 5+ messages in thread From: Richard Stallman @ 2002-06-29 8:41 UTC (permalink / raw) Cc: monnier+gnu/emacs, ben, bws, xemacs-design, emacs-devel It would be better not to have a delay of even .25 second in handling C-g. It ought to respond crisply. If the delay were made smaller, eventually it would be insignificant. I don't know at what point that is reached. Currently on some systems C-g handling can involve a delay of up to 1 second, the wait for "polling for input". That's because when it was implemented there was no better facility to use than `alarm'. Nowadays I gather there is one; we should change the polling interval to something shorter than a second. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2002-06-29 22:21 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <F102hm4mRK4dGDNhxKL00000226@hotmail.com> 2002-06-28 17:07 ` Toggle EOL Stefan Monnier 2002-06-28 20:01 ` Jan D. 2002-06-28 20:42 ` Stefan Monnier 2002-06-29 22:21 ` Richard Stallman 2002-06-29 8:41 ` Profiling font-lock in xemacs Richard Stallman
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.