From: Mark Lillibridge <mark.lillibridge@hp.com>
To: lekktu@gmail.com
Cc: 5042@emacsbugs.donarmstrong.com
Subject: bug#5042: 23.1; linum-mode gives incorrect line numbers with narrowed buffers
Date: Sun, 20 Dec 2009 22:59:43 -0800 [thread overview]
Message-ID: <200912210659.nBL6xhDG020940@mailhub-pa1.hpl.hp.com> (raw)
In-Reply-To: <f7ccd24b0912100341q62e2259as90a1a26bbda73739@mail.gmail.com> (message from Juanma Barranquero on Thu, 10 Dec 2009 12:41:21 +0100)
Okay, let us see where we stand:
* Juanma uses linum mode to know how many lines there are in a file (or
a region, if narrowing is in effect) at a glance; they do not use go
to line.
* Mark (aka, me) and others specify lines to act on by reading off line
numbers provided by linum and use goto-line to implement voice
commands; it is crucial for this purpose that the line numbers
provided correspond to the line numbers goto-line uses in all cases,
including for non-current buffers.
* linum mode currently does what Juanma wants.
* A somewhat non-obvious and fragile hook function can convert the
current mode into what Mark wants:
(add-hook 'linum-before-numbering-hook
(function (lambda ()
(setq line (save-restriction
(widen) (line-number-at-pos))))))
(line here is a local variable of the linum-update-window, bound
shortly before the hook is called; needless to say, this modification
is unlikely to continue working as the linum code evolves.)
* I think you can build a less fragile hook by using a custom version of
linum-format, however, this interferes with the ability to use
linum-format for any other purpose.
* Both modes produce surprises: Juanma's causes surprises when goto-line
goes to the wrong line in some buffers and Mark's causes surprises
when some buffers start with a line number greater than one. Using
Juanma's mode plus changing the behavior of goto-line would produce no
obvious surprises, but I cannot be sure that changing goto-line
does not mess something else up.
I think that given that Mark's mode is likely to be useful enough of
the time and that implementing it is nontrivial, especially for
beginners, there should be an explicit option to switch between the
modes. The default should probably depend on which surprise people
think is worse. I can live with either way. I am willing to take a
stab at trying to implement such an option if people think this is a
good idea.
- Mark
next prev parent reply other threads:[~2009-12-21 6:59 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-26 0:39 bug#5042: 23.1; linum-mode gives incorrect line numbers with narrowed buffers Mark Lillibridge
2009-12-01 0:32 ` Juanma Barranquero
2009-12-10 5:34 ` Mark Lillibridge
2009-12-10 11:41 ` Juanma Barranquero
2009-12-21 6:59 ` Mark Lillibridge [this message]
2009-12-21 10:37 ` Juanma Barranquero
2009-12-21 15:50 ` Drew Adams
2009-12-23 20:49 ` Mark Lillibridge
2009-12-23 21:01 ` Drew Adams
2009-12-23 21:44 ` Mark Lillibridge
2009-12-24 3:49 ` Stefan Monnier
2009-12-29 7:02 ` Kevin Rodgers
2010-01-07 5:38 ` Mark Lillibridge
2010-01-07 23:30 ` Markus Triska
2010-01-10 1:32 ` Mark Lillibridge
2010-01-10 1:56 ` Juanma Barranquero
2010-01-16 22:08 ` Mark Lillibridge
2010-01-16 23:03 ` Juanma Barranquero
2010-01-23 23:28 ` Mark Lillibridge
2010-01-24 0:07 ` Drew Adams
2010-02-03 5:01 ` Mark Lillibridge
2010-01-24 9:21 ` Juanma Barranquero
2010-01-10 2:05 ` Lennart Borgman
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=200912210659.nBL6xhDG020940@mailhub-pa1.hpl.hp.com \
--to=mark.lillibridge@hp.com \
--cc=5042@debbugs.gnu.org \
--cc=5042@emacsbugs.donarmstrong.com \
--cc=lekktu@gmail.com \
/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.