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: Patch: enhanced mark navigation commands Date: Thu, 06 Mar 2008 02:54:54 +0200 Organization: JURTA Message-ID: <874pbkmzbx.fsf@jurta.org> References: <55f7df060803042112w380b5170qe964002c6c06ab01@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1204766302 13410 80.91.229.12 (6 Mar 2008 01:18:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 6 Mar 2008 01:18:22 +0000 (UTC) Cc: emacs-devel@gnu.org To: "Adrian Robert" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Mar 06 02:18:49 2008 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 1JX4kw-0002Eh-Ai for ged-emacs-devel@m.gmane.org; Thu, 06 Mar 2008 02:18:46 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JX4kO-000793-QZ for ged-emacs-devel@m.gmane.org; Wed, 05 Mar 2008 20:18:12 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JX4jh-0006og-FQ for emacs-devel@gnu.org; Wed, 05 Mar 2008 20:17:29 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JX4jg-0006nG-EJ for emacs-devel@gnu.org; Wed, 05 Mar 2008 20:17:28 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JX4jg-0006n3-7u for emacs-devel@gnu.org; Wed, 05 Mar 2008 20:17:28 -0500 Original-Received: from relay02.kiev.sovam.com ([62.64.120.197]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JX4jf-0001QJ-PP for emacs-devel@gnu.org; Wed, 05 Mar 2008 20:17:28 -0500 Original-Received: from [83.170.232.243] (helo=smtp.svitonline.com) by relay02.kiev.sovam.com with esmtp (Exim 4.67) (envelope-from ) id 1JX4je-000Eh0-6M; Thu, 06 Mar 2008 03:17:26 +0200 In-Reply-To: <55f7df060803042112w380b5170qe964002c6c06ab01@mail.gmail.com> (Adrian Robert's message of "Wed, 5 Mar 2008 08:12:35 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-unknown-linux-gnu) X-Scanner-Signature: 8d26fb09d298f8c1cb325fc86345eca8 X-DrWeb-checked: yes X-SpamTest-Envelope-From: juri@jurta.org X-SpamTest-Group-ID: 00000000 X-SpamTest-Header: Not Detected X-SpamTest-Info: Profiles 2362 [Mar 5 2008] X-SpamTest-Info: helo_type=3 X-SpamTest-Info: {HEADERS: header Content-Type found without required header Content-Transfer-Encoding} X-SpamTest-Method: none X-SpamTest-Rate: 11 X-SpamTest-Status: Not detected X-SpamTest-Status-Extended: not_detected X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0278], KAS30/Release X-detected-kernel: by monty-python.gnu.org: FreeBSD 6.x (1) 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:91458 Archived-At: > The attached lisp allows moving around within a buffer or buffers to > places where recent edits or other events took place. It has been > part of Emacs.app for a while and users have found it useful; I'd like > to propose it being added to the emacs distribution itself, probably > as part of simple.el. > > Specifically, the keys M-p and M-n are bound to move forwards and > backwards through the mark history. Also, immediately after popping a > global mark, e.g., with C-x C-SPC, then the global mark ring is used. I used to have a similar feature in .emacs which I'd like to demonstrate here just for reference: (defun my-sorted-marks () "Returns marks of the current buffer sorted by position." (sort (copy-list mark-ring) (lambda (m1 m2) (< (marker-position m1) (marker-position m2))))) (defun my-mark-prev () "Jump to the previous mark." (interactive) (let ((marks (reverse (my-sorted-marks))) m) (while (car marks) (if (< (marker-position (car marks)) (point)) (setq m (car marks) marks nil) (setq marks (cdr marks)))) (if m (goto-char m)))) (define-key global-map [(meta up)] 'my-mark-prev) (defun my-mark-next () "Jump to the next mark." (interactive) (let ((marks (my-sorted-marks)) m) (while (car marks) (if (> (marker-position (car marks)) (point)) (setq m (car marks) marks nil) (setq marks (cdr marks)))) (if m (goto-char m)))) (define-key global-map [(meta down)] 'my-mark-next) It navigated marks spatially (by the order of buffer positions), not temporally (by the order of adding marks to the mark ring). But it turned out to be quite useless. OTOH commands like you proposed would be more useful. But they are too intrusive. I think it would be better to have two commands `goto-prev-mark' and `goto-next-mark' that just move point to the positions of marks in the mark ring without modifying it (by using some global pointer for the current position in it). -- Juri Linkov http://www.jurta.org/emacs/