[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
planner-snap (was Re: [emacs-wiki-discuss] annotations from files: line
From: |
Berkan Eskikaya |
Subject: |
planner-snap (was Re: [emacs-wiki-discuss] annotations from files: line and column numbers) |
Date: |
Tue, 22 Feb 2005 10:29:33 +0000 |
User-agent: |
Wanderlust/2.11.30 (Wonderwall) SEMI/1.14.6 (Maruoka) FLIM/1.14.6 (Marutamachi) APEL/10.6 Emacs/21.3 (i386-pc-linux-gnu) MULE/5.0 (SAKAKI) |
>>>> In article <address@hidden>, Jesse Alama <address@hidden> writes:
Jesse> Hello,
Jesse> I appreciate being able to revisit files by following links that were
Jesse> generated from M-x remember. This function could be improved, IMHO,
Jesse> if M-x remember recorded the line number of the file I was visiting at
Jesse> the time, and perhaps the column number, too. By following a link
Jesse> generated in this way, not only would I revisit the file I was
Jesse> visiting when I hit M-x remember, but I would also be put back to the
Jesse> exact spot in the file I was looking at.
I use 'snap' from
http://howm.sourceforge.jp/a/snap.el
which does exactly what you wish for, at least for some modes. Attached are
planner-snap.el and snap.el.diff [my modifications to snap].
--
Snap produces URIs based on the major-mode of the buffer you invoke it
from, and for some [but not all] modes these URIs include the line number
and a context string following the point (which is equivalent to having the
column number). E.g.,
snap:///~/elisp/snap.el#177:(defun snap-record: ()
For each major mode you want snap to support, you write two functions,
"snap-record:MAJOR-MODE" and "snap-play:MAJOR-MODE".
Calling 'snap-play' on a 'snap-record'ed URI opens the URI with the
relevant major mode and uses occur to find and go to the point where you
invoked snap-record.
Out of the box, snap works with:
- Wanderlust (Summary buffer)
- Help
- Bookmark
- Man
- Info
- Emacs-wiki
- Navi2ch (Article buffer)
- w3m
- Dired
- text-mode
My modifications to snap include:
- for text-mode and w3m-mode, don't go to the beginning of the line after
finding the recorded point [default snap behaviour], but stay at the
point.
- an imperfect but working support for eshell mode: saves the contents of
an eshell buffer, command-history, and the pwd, allowing some rudimentary
ability to resume a shell session.
planner-snap.el includes
- planner-snap-annotation-from-buffer(): added to
planner-annotation-functions
- new planner-protocol: snap
I've also modified remember() in my remember.el so that all context data is
saved when I invoke remember [by running all annotation functions]. This
allows me have a snap URI with a line number, in addition to the usual URI
produced by planner.
(defcustom remember-run-all-annotation-functions t
"If non-nil every function in `remember-annotation-functions' is
called."
:type 'boolean
:group 'remember)
; From http://www.astrogoth.com/~reeses/software/uniq.el
(load "uniq.el")
And, in remember():
(let* ((annotation (if remember-run-all-annotation-functions
(uniq (mapconcat 'funcall
remember-annotation-functions "\n\n"))
(run-hook-with-args-until-success
'remember-annotation-functions)))
(buf (get-buffer-create remember-buffer)))
I find this very useful, your mileage may vary.
The code is by no means perfect -- please feel free to modify.
Cheers,
Berkan
PS: because snap uses the "#line-number" format, it doesn't work well with
filenames that contain the '#' character or with URLs that contain an
anchor string.
planner-snap.el
Description: Binary data
snap.el.diff
Description: Binary data
Re: [emacs-wiki-discuss] annotations from files: line and column numbers, Dryice Liu, 2005/02/20
planner-snap (was Re: [emacs-wiki-discuss] annotations from files: line and column numbers),
Berkan Eskikaya <=