all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Decebal <CLDWesterhof@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Extra info in modeline (tip and questions)
Date: Tue, 28 Apr 2009 03:27:32 -0700 (PDT)	[thread overview]
Message-ID: <04d0104c-90b6-4e22-84a8-5f86b7d44388@p6g2000pre.googlegroups.com> (raw)
In-Reply-To: 95e9ef05-7da0-4900-a68a-bc539f1302be@w31g2000prd.googlegroups.com

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))


  reply	other threads:[~2009-04-28 10:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-14 14:03 Extra info in modeline (tip and questions) Decebal
2009-04-14 15:54 ` Nikolaj Schumacher
     [not found] ` <mailman.5329.1239724470.31690.help-gnu-emacs@gnu.org>
2009-04-15  5:53   ` Decebal
2009-04-15 13:14     ` Nikolaj Schumacher
     [not found]     ` <mailman.5377.1239801271.31690.help-gnu-emacs@gnu.org>
2009-04-28  7:55       ` Decebal
2009-04-28 10:27         ` Decebal [this message]
2009-04-28  8:04       ` Decebal
2009-04-28  8:23         ` Decebal
2009-04-15 11:06 ` Decebal
2009-04-15 13:23   ` Nikolaj Schumacher
     [not found]   ` <mailman.5379.1239801830.31690.help-gnu-emacs@gnu.org>
2009-04-15 16:13     ` Decebal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=04d0104c-90b6-4e22-84a8-5f86b7d44388@p6g2000pre.googlegroups.com \
    --to=cldwesterhof@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.