unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: emacs-devel@gnu.org
Subject: Re: Patch: enhanced mark navigation commands
Date: Sun, 09 Mar 2008 23:55:05 +0200	[thread overview]
Message-ID: <8763vv7lju.fsf@jurta.org> (raw)
In-Reply-To: <87y78woewc.fsf@jurta.org> (Juri Linkov's message of "Thu, 06 Mar 2008 02:57:23 +0200")

> BTW, in Emacs `goto-line' doesn't push the mark to the mark ring.
> I think it should since often it is used to for long distance
> navigation.

The following patch fixes this:

Index: lisp/simple.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/simple.el,v
retrieving revision 1.904
diff -c -r1.904 simple.el
*** lisp/simple.el	3 Mar 2008 02:16:00 -0000	1.904
--- lisp/simple.el	9 Mar 2008 21:54:38 -0000
***************
*** 820,829 ****
  
  (defun goto-line (arg &optional buffer)
    "Goto line ARG, counting from line 1 at beginning of buffer.
! Normally, move point in the current buffer.
! With just \\[universal-argument] as argument, move point in the most recently
! displayed 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 ARG."
    (interactive
--- 820,830 ----
  
  (defun goto-line (arg &optional buffer)
    "Goto line ARG, counting from line 1 at beginning of buffer.
! Normally, move point in the current buffer and leave mark at previous
! position.  With just \\[universal-argument] as argument, move point
! in the most recently displayed 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 ARG."
    (interactive
***************
*** 860,865 ****
--- 861,869 ----
        (let ((window (get-buffer-window buffer)))
  	(if window (select-window window)
  	  (switch-to-buffer-other-window buffer))))
+   ;; Leave mark at previous position
+   (or (and transient-mark-mode mark-active)
+       (push-mark))
    ;; Move to the specified line number in that buffer.
    (save-restriction
      (widen)

-- 
Juri Linkov
http://www.jurta.org/emacs/




  parent reply	other threads:[~2008-03-09 21:55 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-05  5:12 Patch: enhanced mark navigation commands Adrian Robert
2008-03-05  6:19 ` Miles Bader
2008-03-05 12:23   ` paul r
2008-03-05  6:41 ` Dan Nicolaescu
2008-03-06  0:57   ` Juri Linkov
2008-03-06  1:47     ` Dan Nicolaescu
2008-03-06  7:18       ` Drew Adams
2008-03-06 10:09       ` Juri Linkov
2008-03-09 21:55     ` Juri Linkov [this message]
2008-03-05 16:11 ` Ted Zlatanov
2008-03-05 19:20   ` Stefan Monnier
2008-03-05 19:48     ` Ted Zlatanov
2008-03-05 22:10       ` Miles Bader
2008-03-10 13:09         ` Ted Zlatanov
2008-03-10 22:34           ` Juri Linkov
2008-03-11 15:08             ` Ted Zlatanov
2008-03-06  0:54 ` Juri Linkov

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=8763vv7lju.fsf@jurta.org \
    --to=juri@jurta.org \
    --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).