emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: what-cursor-position - why not list the line # as well?


From: Ehud Karni
Subject: Re: what-cursor-position - why not list the line # as well?
Date: Mon, 3 Apr 2006 12:51:18 +0300

On Sun, 2 Apr 2006 11:51:05 -0700, Drew Adams wrote:
>
>   DA> I use both the column and line numbers in the mode line, but
>   DA> I would still find it handy to have both in `C-x =' also.
>
> EZ> *Shrug* If you need that information frequently, you could write a
> EZ> simple function that puts it into the kill ring, and bind it to some
> EZ> key.
>
> The only reason you gave was that that info is already (by default) in the
> mode line. That's a fair argument, but I replied: 1) That default behavior
> does not mean that it is in the mode line for everyone all of the time. 2)
> You cannot copy+paste mode-line info (AFAIK).

Here is a simple function that is used here (for years):

(defun char-position-msg (&optional FULL)
 "print position message with line number, calls `what-cursor-position'
In addition, with prefix argument, show details about that character
in *Help* buffer.  See also the command `describe-char-after'."
   (interactive "P")
       (let ((cp (what-cursor-position FULL))
             (lp (what-line)))
           (message "%s %s" cp lp)))


Now the pro and con reasons.
PRO: The line number is not displayed in some (many) occasions - if
     the file has long lines, when the buffer is narrowed.
CON: The line number function may be VERY time consuming for very
     large buffers (depends on the machine you run Emacs on).

Ehud.


--
 Ehud Karni           Tel: +972-3-7966-561  /"\
 Mivtach - Simon      Fax: +972-3-7966-667  \ /  ASCII Ribbon Campaign
 Insurance agencies   (USA) voice mail and   X   Against   HTML   Mail
 http://www.mvs.co.il  FAX:  1-815-5509341  / \
 GnuPG: 98EA398D <http://www.keyserver.net/>    Better Safe Than Sorry




reply via email to

[Prev in Thread] Current Thread [Next in Thread]