[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Extra info in modeline (tip and questions)
From: |
Decebal |
Subject: |
Re: Extra info in modeline (tip and questions) |
Date: |
Tue, 28 Apr 2009 03:27:32 -0700 (PDT) |
User-agent: |
G2/1.0 |
On 28 apr, 09:55, Decebal <CLDWester...@gmail.com> wrote:
> The only thing lacking is that when the function is called with C-u
> prepended, it should be put at point in the current buffer instead of
> in the minibuffer. How would I do that?
I solved that one also. I only found it more usefull to put it in the
kill-ring instead of the current buffer. The function buffer-count-
chars becomes:
(defun buffer-count-chars(do-yank &optional start end)
(interactive "P\nr")
(let ((ret-val (number-to-string (buffer-count nil ".\\|\n"
start end))))
(buffer-count-exit do-yank (interactive-p) ret-val nil)))
I also defined the function buffer-count-exit (I like DRY):
(defun buffer-count-exit(do-yank is-interactive ret-val is-number)
(let ((yank-val))
(if is-number
(setq yank-val (format "%d" ret-val))
(setq yank-val ret-val))
(if do-yank
(kill-new yank-val)
(if is-interactive
(message yank-val)
ret-val))))
The function get-mode-line-field should also be changed:
(defun get-mode-line-field(type)
(let ((field (format "*%s*" type))
(this-struct (get-mode-line-struct type)))
(if this-struct
(setq field
(format "%s: %s "
(mode-line-struct-display this-struct)
(funcall (mode-line-struct-function this-
struct) nil))))
field))
Re: Extra info in modeline (tip and questions), Decebal, 2009/04/15