From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: How to change overlay arrow position silently? Date: Mon, 03 Aug 2009 03:14:36 +0300 Organization: JURTA Message-ID: <874ospda07.fsf@mail.jurta.org> References: <87ljm2nzdj.fsf@sphinx.net.ru> <87hbwqfhd7.fsf@dd.chalmers.se> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1249261290 8487 80.91.229.12 (3 Aug 2009 01:01:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 3 Aug 2009 01:01:30 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 03 03:01:23 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MXlvW-0001hH-PB for ged-emacs-devel@m.gmane.org; Mon, 03 Aug 2009 03:01:23 +0200 Original-Received: from localhost ([127.0.0.1]:56043 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MXlvW-0007Jw-7n for ged-emacs-devel@m.gmane.org; Sun, 02 Aug 2009 21:01:22 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MXltr-0006BH-KE for emacs-devel@gnu.org; Sun, 02 Aug 2009 20:59:39 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MXltm-0006AC-4i for emacs-devel@gnu.org; Sun, 02 Aug 2009 20:59:38 -0400 Original-Received: from [199.232.76.173] (port=41146 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MXltk-0006A3-UK for emacs-devel@gnu.org; Sun, 02 Aug 2009 20:59:33 -0400 Original-Received: from smtp-out1.starman.ee ([85.253.0.3]:33226 helo=mx1.starman.ee) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MXltk-0006Lu-22 for emacs-devel@gnu.org; Sun, 02 Aug 2009 20:59:32 -0400 X-Virus-Scanned: by Amavisd-New at mx1.starman.ee Original-Received: from mail.starman.ee (82.131.68.40.cable.starman.ee [82.131.68.40]) by mx1.starman.ee (Postfix) with ESMTP id 576233F4120 for ; Mon, 3 Aug 2009 03:59:25 +0300 (EEST) In-Reply-To: <87hbwqfhd7.fsf@dd.chalmers.se> ("Johan =?utf-8?Q?Bockg=C3=A5?= =?utf-8?Q?rd=22's?= message of "Sun, 02 Aug 2009 15:57:40 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (x86_64-pc-linux-gnu) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:113583 Archived-At: >> (mapc >> (lambda (n) >> (goto-line n) >> (set-marker overlay-arrow-position >> (point-marker))) >> '(1 2 3 4 5)) >> => >> Mark set [5 times] > > It is `goto-line' that prints this. Its docstring says it can be used non-interactively: When called from Lisp code, the optional argument BUFFER ========================== specifies a buffer to switch to. This means it is not a purely interactive command unlike e.g. `query-replace' etc. Therefore we need to distinguish interactive and non-interactive calls. I remember Richard insisted on adding a new argument instead of relying on `called-interactively-p'. So perhaps the right fix is following. Another option would be using a prefix argument C-u like `M-<' (`beginning-of-buffer') and `M->' (`end-of-buffer') do to not set mark at previous position. But `goto-line' already uses the C-u argument to move point in the most recently selected other buffer. Index: lisp/simple.el =================================================================== RCS file: /sources/emacs/emacs/lisp/simple.el,v retrieving revision 1.1001 diff -u -r1.1001 simple.el --- lisp/simple.el 31 Jul 2009 02:14:46 -0000 1.1001 +++ lisp/simple.el 3 Aug 2009 00:12:29 -0000 @@ -843,7 +843,7 @@ ;; Counting lines, one way or another. -(defun goto-line (line &optional buffer) +(defun goto-line (line &optional buffer interactivep) "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 \\[universal-argument] as argument, @@ -855,7 +855,7 @@ LINE." (interactive (if (and current-prefix-arg (not (consp current-prefix-arg))) - (list (prefix-numeric-value current-prefix-arg)) + (list (prefix-numeric-value current-prefix-arg t)) ;; Look for a default, a number in the buffer at point. (let* ((default (save-excursion @@ -881,18 +881,18 @@ nil nil t 'minibuffer-history default) - buffer)))) + buffer t)))) ;; Switch to the desired buffer, one way or another. (if buffer (let ((window (get-buffer-window buffer))) (if window (select-window window) (switch-to-buffer-other-window buffer)))) ;; Leave mark at previous position - (or (region-active-p) (push-mark)) + (or (not interactivep) (region-active-p) (push-mark)) ;; Move to the specified line number in that buffer. (save-restriction (widen) - (goto-char 1) + (goto-char (point-min)) (if (eq selective-display t) (re-search-forward "[\n\C-m]" nil 'end (1- line)) (forward-line (1- line))))) -- Juri Linkov http://www.jurta.org/emacs/