emacs-devel
[Top][All Lists]
Advanced

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

Re: Patch: enhanced mark navigation commands


From: Juri Linkov
Subject: Re: Patch: enhanced mark navigation commands
Date: Sun, 09 Mar 2008 23:55:05 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-unknown-linux-gnu)

> 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/




reply via email to

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