From: "Drew Adams" <drew.adams@oracle.com>
To: "'Dan Nicolaescu'" <dann@ics.uci.edu>, "'Juri Linkov'" <juri@jurta.org>
Cc: emacs-devel@gnu.org
Subject: RE: Patch: enhanced mark navigation commands
Date: Wed, 5 Mar 2008 23:18:49 -0800 [thread overview]
Message-ID: <003b01c87f5a$53517290$0600a8c0@us.oracle.com> (raw)
In-Reply-To: <200803060147.m261ljNU022154@sallyv1.ics.uci.edu>
FWIW, in Icicles you can navigate among the markers in a buffer or among
global markers, in any order.
While doing that, you can complete against the text on each marker's line
(or "<EMPTY LINE>"): each completion candidate is an alist entry (line-text
. marker). More typically, however, you cycle among the markers or click
them in *Completions* with the mouse. You can cycle in either direction, and
you need not visit each marker in sequence (direct access or skip some).
You can sort the candidate marker list in various ways - by default, the
candidates are in marker order (i.e. buffer position). If unsorted, they are
in chronological order, i.e., mark-ring insertion order. Hit a key to change
the sort order - you can have any number of orders.
You can filter the set of candidate markers by matching (or
complement-matching) your minibuffer input against each marker's line. When
you visit a marker, its line is highlighted temporarily. It is a bit like a
dynamic `occur' command (change your input on the fly and it changes the
matching candidates), but an `occur' where the lines are only those with
markers and each marker has a line (candidate).
This all falls out for free by using the general function (command)
`icicle-map' to define the navigating commands (`icicle-goto-marker' and
`icicle-goto-global-marker'). Those definitions are trivial. `icicle-map'
applies a function to alist-entry completion candidates that are chosen
interactively, e.g. by cycling.
In the case of the marker-navigator commands, the function applied by
`icicle-map' just goes to the chosen marker candidate and highlights its
line:
(defun goto-and-highlight (cand)
(pop-to-buffer (marker-buffer (cdr cand)))
(goto-char (cdr cand))
(setq mark-active nil)
(let ((hl-line-flash-show-period 60)) (hl-line-flash)))
(point-marker))))) ; Return marker at point, for message.
The complete definition of `icicle-go-to-marker is this (plus some bindings
for sort functions and an error message if no markers):
(defun icicle-goto-marker ()
"Go to a marker in this buffer."
(interactive)
(icicle-map (mapcar #'icicle-marker+text
(icicle-markers mark-ring))
#'goto-and-highlight)))
Function `icicle-marker+text' just creates an alist entry (completion
candidate) using the text of a marker's line as car and the marker as cdr.
Function `icicle-markers' just filters the `mark-ring' for live buffers,
excluding the minibuffer.
You can use `icicle-map' to define a command to traverse any alist, doing
anything you want to the entries. The user picks the entries to act on, in
the ways mentioned above (filter, sort, cycle, complete, choose directly).
The user can act on candidates repeatedly and in any order.
`icicle-map' and commands such as `icicle-goto-marker' that you define using
it are multi-commands. It is that that lets a user choose multiple
completion candidates (e.g. cycle among them) in a single command
invocation.
next prev parent reply other threads:[~2008-03-06 7:18 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 [this message]
2008-03-06 10:09 ` Juri Linkov
2008-03-09 21:55 ` Juri Linkov
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='003b01c87f5a$53517290$0600a8c0@us.oracle.com' \
--to=drew.adams@oracle.com \
--cc=dann@ics.uci.edu \
--cc=emacs-devel@gnu.org \
--cc=juri@jurta.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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.