[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Emacs navigation mode
RE: Emacs navigation mode
Mon, 2 Apr 2012 16:59:18 -0700
> automatically remembers positions in buffers you were
> watching long enough and lets you easily jump between them
> (in linear style, not Emacs-undo-style).
I guess you mean that if Emacs is idle for a given amount of time then the
position of the cursor (or perhaps its current line) is automatically remembered
on a list, and you can navigate to positions on the list.
1. Without the automatic remembering part there are a number of possibilities,
including bookmarking and setting markers. IOW, some explicit user action sets
a bookmark or sets a marker.
See the Emacs Wiki for different possibilities:
2. For the automatic-remembering part, you can put the bookmark-setting action
on an idle timer. IOW, have Emacs automatically set a bookmark or a marker
whenever Emacs is idle for a given delay.
For bookmarks, if you use Bookmark+ then you can use persistent or temporary
bookmarks, including with automatic naming if you like (with the position in the
name). You can have them show up visually (be highlighted) or not. You can
cycle among any set of bookmarks. See below for an example.
With Bookmark+ you can easily navigate among bookmarks: cycling, direct access,
access using completion. With Icicles you can do the same with Emacs markers
(local or global). With both libraries, navigating among bookmarks is even
http://emacswiki.org/emacs/MarkCommands#IciclesGoToMarker (navigate/cycle among
http://www.emacswiki.org/cgi-bin/wiki/BookmarkPlus#toc47 (bookmark navigation
lists & cycling)
A quick example thrown together to show one way of doing automatic idle
bookmarking with Bookmark+ (http://emacswiki.org/emacs/BookmarkPlus):
1. (Optional) To make autonamed bookmarks always be temporary (not saved),
customize option `bmkp-autotemp-bookmark-predicates' to include
`bmkp-autonamed-bookmark-p'. To test, you can just do this:
(setq bmkp-autotemp-bookmark-predicates '(bmkp-autonamed-bookmark-p))
2. (Optional) To highlight autonamed bookmarks when they are set, customize
option `bmkp-auto-light-when-set' to `autonamed-bookmark'. To test, you can
just do this:
(setq bmkp-auto-light-when-set 'autonamed-bookmark)
3. Define the number of idle seconds before setting a bookmark:
(defcustom auto-idle-bookmark-mode-delay 30
"Secs before automatically setting a bookmark."
:type 'integer :group 'bookmark-plus)
4. Define an idle timer:
(progn (when (timerp 'auto-idle-bookmark-mode-timer)
(when (timerp 'auto-idle-bookmark-mode-timer)
"Timer for `auto-idle-bookmark-mode'.")
5. Define a command to turn automatic bookmarking on/off:
"Toggle automatic setting of a bookmark when Emacs is idle"
:init-value nil :global t :lighter " BMK"
6. Turn it on: `M-x auto-idle-bookmark-mode'.
7. To cycle among the bookmarks in the current buffer, use `C-x p down' (`down'
`down'...), or `up'. If you have Icicles, you can navigate more flexibly,
combining direct access with cycling and completion.
8. The function used in #5 to set a bookmark is
`bmkp-set-autonamed-bookmark-at-line'. It sets it at the beginning of the
current line. If you instead want to bookmark at point, so you can have more
than one such bookmark on the same line, then use `bmkp-set-autonamed-bookmark'
9. Because of #1, all of the bookmarks created this way are temporary: not saved
to your bookmarks file. You can also delete them all at anytime using `M-x
bmkp-delete-all-temporary-bookmarks'. You can also delete any of them
individually by putting the cursor on its line (or its position, if you don't
use (`-at-line') and hitting `C-x p RET' - this key creates/deletes an autonamed
bookmark at point.
10. If you do not want to highlight the bookmarks, don't do #2. If you want to
unhighlight them at any time, use `C-x p u' (all in the buffer) or `C-x p C-u'
(the bookmark on the same line as cursor). See also `C-x p U'.
RE: Emacs navigation mode,
Drew Adams <=