unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ehud Karni" <ehud@unix.mvs.co.il>
Cc: emacs-devel@gnu.org
Subject: Re: what-cursor-position - why not list the line # as well?
Date: Mon, 3 Apr 2006 12:51:18 +0300	[thread overview]
Message-ID: <200604030951.k339pIk4008123@beta.mvs.co.il> (raw)
In-Reply-To: <DNEMKBNJBGPAOPIJOOICOEFODEAA.drew.adams@oracle.com> (message from Drew Adams on Sun, 2 Apr 2006 11:51:05 -0700)

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

      parent reply	other threads:[~2006-04-03  9:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-02  1:02 what-cursor-position - why not list the line # as well? Drew Adams
2006-04-02  3:27 ` Eli Zaretskii
2006-04-02 15:05   ` Drew Adams
2006-04-02 17:36     ` Eli Zaretskii
2006-04-02 18:51       ` Drew Adams
2006-04-02 23:17         ` Stephen Berman
2006-04-03  3:39         ` Eli Zaretskii
2006-04-03  9:51         ` Ehud Karni [this message]

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=200604030951.k339pIk4008123@beta.mvs.co.il \
    --to=ehud@unix.mvs.co.il \
    --cc=emacs-devel@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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).