unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Mark Lillibridge <mark.lillibridge@hp.com>
To: <mark.lillibridge@hp.com>
Cc: lekktu@gmail.com, eliz@gnu.org, monnier@iro.umontreal.ca,
	emacs-devel@gnu.org
Subject: Re: Emacs's handling of line numbers [from bug#5042]
Date: Sun, 06 Jun 2010 11:18:22 -0700	[thread overview]
Message-ID: <qmhfx10hvo1.fsf@ts-rhel4.hpl.hp.com> (raw)
In-Reply-To: <qmhr5m8temd.fsf@ts-rhel4.hpl.hp.com> (message from Mark Lillibridge on Wed, 21 Apr 2010 19:17:30 -0700)


In an attempt to make progress on this bug, I propose the following:

* all the relevant proposals require {esc}g to move by the line number
  shown by linum mode if it were on.  (they disagree about which
  numbering scheme(s) linum should use.)

* this means we need to redefine the behavior of {esc}g

* {esc}g currently calls goto-line, but a grep through the elisp sources
  of Emacs shows a lots of calls to goto-line, any of which might be
  broken by changing the behavior of goto-line

* Accordingly, I suggest introducing a new function, goto-numbered-line,
  which will replace the binding of {esc}g and the edit menu option.

* the current documentation for goto-line is:

    (goto-line line &optional buffer)
    
    Goto line, counting from line 1 at beginning of buffer.  Normally,
    move point in the current buffer, and leave mark at the previous
    position.  With just C-u as argument, move point in the most
    recently selected other buffer, and switch to it.  When called from
    Lisp code, the optional argument buffer specifies a buffer to switch
    to.
    
    If there's a number in the buffer at point, it is the default for
    line.

* I propose documentation for goto-numbered-line as:

    (goto-numbered-line line &optional buffer)
    
    Goto line with line number line; use linum mode to see what line
    numbers each line is assigned.
    Normally, move point in the current buffer, and leave mark at the
    previous position.  With just C-u as argument,
    move point in the most recently selected other buffer, and switch
    to it.  When called from Lisp code, the optional argument buffer
    specifies a buffer to switch to.
    
    If there's a number in the buffer at point, it is the default for
    line.

* for the initial implementation, goto-numbered-line would effectively
  be a copy of goto-line without the widening function.  (This is what
  linum mode currently does.)  Later, if we change how linum assigns
  line numbers, we can change goto-number-line in parallel.

What do people think?  This resolves the bug ({esc}g and linum numbering
lines differently) without forcing us to make a hard decision on exactly
how linum should number lines first.  

- Mark




I (Mark Lillibridge) wrote:  
>  Eli Zaretskii <eliz@gnu.org> wrote:
>  >  Mark Lillibridge <mark.lillibridge@hp.com> wrote:
>  >  >     The issue is that font-lock mode, goto-line, linum mode, and perhaps
>  >  > other features need to treat them differently.  These features want to
>  >  > widen to the "application" restriction when processing the current
>  >  > buffer, ignoring any temporary restriction.
>  >  
>  >  But if this is the problem you want to solve, you cannot solve it by
>  >  introducing yet another kind of restriction: there's always a chance
>  >  that a command will want to use the "application" restriction, when
>  >  one is already in place, because, e.g., you have font-lock or whatever
>  >  active.  And then you are back at the same problem.
>  >  
>  >  IOW, by introducing 2 kinds of restriction, you don't solve the
>  >  problem, you just push it a bit farther.
>  >  
>  >  Moreover, I'm not sure I see the problem that is grave enough to
>  >  justify this.  The 3 examples you mentioned can be solved by
>  >  programming the features to do what you want (I believe font-lock
>  >  already solved it, albeit not too elegantly).  I understand now the
>  >  difference between two classes of use of restriction (thanks to all
>  >  who labored to explain that to this old fart), but are there
>  >  _practical_ use-cases where the current situation gets in our way so
>  >  badly that such a new feature would be justified?  I wonder.
>  
>      Personally, the problem I need fixed is that goto-line and linum
>  mode number lines inconsistently.  Given that linum mode already numbers
>  the first line of a restriction starting with one and Info mode looks weird
>  if we start numbering at the beginning of the physical buffer, I think
>  the minimal change would be to change goto-line to number lines so that
>  the first line of the current restriction is 1.  
>  
>      Some wanted an option to control whether line numbers were numbered
>  from the beginning of the restriction or the beginning of the physical
>  buffer and some (others?) to solve this problem (which characters really
>  belong to the (logical) buffer) once and for all.



  parent reply	other threads:[~2010-06-06 18:18 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-15 18:47 Emacs's handling of line numbers [from bug#5042] Mark Lillibridge
     [not found] ` <jwvd4068dsr.fsf-monnier+emacs@gnu.org>
2010-04-11 22:22   ` Mark Lillibridge
2010-04-12  2:27     ` Stefan Monnier
2010-04-17  1:57       ` Mark Lillibridge
2010-04-17  7:29         ` Eli Zaretskii
2010-04-17 14:45           ` Stefan Monnier
2010-04-17 15:57             ` Eli Zaretskii
2010-04-17 19:51               ` Mark Lillibridge
2010-04-17 21:04                 ` Eli Zaretskii
2010-04-17 21:17                   ` Juanma Barranquero
2010-04-17 21:31                     ` Drew Adams
2010-04-18 18:15                       ` widen-one-level [was: Emacs's handling of line numbers] Drew Adams
2010-04-18 21:31                         ` Juri Linkov
2010-04-19  0:25                           ` Drew Adams
2010-04-18 23:30                         ` Davis Herring
2010-04-19 19:57                           ` Richard Stallman
2010-04-19 20:22                             ` Drew Adams
2010-04-19 22:52                             ` Juri Linkov
2010-04-19  1:56                         ` Leo
2010-04-19  2:04                           ` Drew Adams
2010-04-19 11:34                             ` Leo
2010-04-19 16:31                             ` Drew Adams
2010-04-19 17:57                               ` Leo
2010-04-19 22:56                                 ` Drew Adams
2010-04-22  9:59                                   ` Leo
2010-04-18  3:12                     ` Emacs's handling of line numbers [from bug#5042] Eli Zaretskii
2010-04-18  3:49                       ` Juanma Barranquero
2010-04-18  8:05                         ` Juri Linkov
2010-04-18 13:44                           ` Drew Adams
2010-04-18 13:50                             ` Lennart Borgman
2010-04-18 16:40                               ` Drew Adams
2010-04-18 14:03                             ` Juanma Barranquero
2010-04-18 14:14                               ` David Kastrup
2010-04-18 16:41                               ` Drew Adams
2010-04-18 17:03                                 ` Juanma Barranquero
2010-04-18 21:29                                   ` Juri Linkov
2010-04-18 13:45                           ` Drew Adams
2010-04-18 17:29                         ` Eli Zaretskii
2010-04-18 17:52                           ` Juanma Barranquero
2010-04-18 17:56                             ` Eli Zaretskii
2010-04-18 17:00                       ` Mark Lillibridge
2010-04-18 17:38                         ` Eli Zaretskii
2010-04-18 18:11                           ` Lennart Borgman
2010-04-22  2:17                           ` Mark Lillibridge
2010-04-22  8:06                             ` David Kastrup
2010-04-22  8:38                               ` Juri Linkov
2010-04-22  8:45                               ` Juanma Barranquero
2010-06-06 18:18                             ` Mark Lillibridge [this message]
2010-06-07  1:30                               ` Stefan Monnier
2010-06-07  1:41                                 ` Lennart Borgman
2010-06-07 13:45                                   ` Stefan Monnier
2010-06-09  2:20                                     ` Mark Lillibridge
2010-06-09  3:44                                       ` Miles Bader
2010-06-09  2:19                                 ` Mark Lillibridge
2010-06-09  6:37                                   ` Glenn Morris
2010-06-24  2:24                                     ` Mark Lillibridge

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=qmhfx10hvo1.fsf@ts-rhel4.hpl.hp.com \
    --to=mark.lillibridge@hp.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=lekktu@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    /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).