* Associated notes with documents
@ 2005-07-21 2:46 Chris Lott
2005-07-21 6:39 ` Pascal Bourguignon
2005-07-21 6:59 ` Joe Corneli
0 siblings, 2 replies; 5+ messages in thread
From: Chris Lott @ 2005-07-21 2:46 UTC (permalink / raw)
I'm trying to figure out an automated way to have a "notes" window
associated with documents while using emacs. Ideally, the associated
notes file for a document would open up automatically with the document
inside a split window of some kind. If there were no notes, then
entering something in that window and saving it would automatically
create the notes file, which would open with the document next time.
Is there any code out there that does this kind of thing?
c
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Associated notes with documents
2005-07-21 2:46 Associated notes with documents Chris Lott
@ 2005-07-21 6:39 ` Pascal Bourguignon
2005-07-24 16:25 ` Chris Lott
2005-07-21 6:59 ` Joe Corneli
1 sibling, 1 reply; 5+ messages in thread
From: Pascal Bourguignon @ 2005-07-21 6:39 UTC (permalink / raw)
"Chris Lott" <Chris.Lott@gmail.com> writes:
> I'm trying to figure out an automated way to have a "notes" window
> associated with documents while using emacs. Ideally, the associated
> notes file for a document would open up automatically with the document
> inside a split window of some kind. If there were no notes, then
> entering something in that window and saving it would automatically
> create the notes file, which would open with the document next time.
>
> Is there any code out there that does this kind of thing?
No, but it's so easy and so funny to do it yourself!
(defun FILE-NAMESTRING (pathname)
"Common-Lisp: returns just the name, type, and version components of pathname.
These functions convert pathname into a namestring. The name represented by pathname is
returned as a namestring in an implementation-dependent canonical form.
URL: http://www.lispworks.com/reference/HyperSpec/Body/f_namest.htm
NOTE: in current implementation pathname=namestring.
RETURN: the 'basename' of the pathname.
"
(if (string-match "\\(^.*/\\([^/][^/]*\\)/*$\\)\\|\\(^\\([^/][^/]*\\)/*$\\)"
pathname)
(let ((res (match-string 2 pathname)))
(if res res (match-string 4 pathname)))
pathname))
(defun DIRECTORY-NAMESTRING (pathname)
"Common-Lisp: returns the directory name portion.
These functions convert pathname into a namestring. The name represented by pathname is
returned as a namestring in an implementation-dependent canonical form.
URL: http://www.lispworks.com/reference/HyperSpec/Body/f_namest.htm
NOTE: in current implementation pathname=namestring.
RETURN: the 'basename' of the pathname.
"
(if (string-match "\\(^.*[^/].*\\)/[^/][^/]*/*$" pathname)
(match-string 1 pathname)
(if (= ?/ (aref pathname 0)) "/" ".")))
(defun annotation-file-path (file-path)
(format "%s/.%s"
(DIRECTORY-NAMESTRING file-path)
(FILE-NAMESTRING file-path)))
(defun find-annotated-file (filename &optional wildcards)
"<<TODO: Please Insert Documentation>>"
(interactive (find-file-read-args "Find file: " nil))
(let* ((value (find-file-noselect filename nil nil wildcards))
(files (if (listp value) value (list value)))
(notes (mapcar (lambda (file-buffer)
(let* ((file-path (buffer-file-name file-buffer))
(note-path (annotation-file-path file-path)))
(find-file-noselect note-path)))
files)))
(delete-other-windows)
(switch-to-buffer (first files))
(split-window-vertically)
(other-window 1)
(switch-to-buffer (first notes))
(other-window 1)))
(global-set-key (kbd "C-x C-f") (function find-annotated-file))
--
__Pascal Bourguignon__ http://www.informatimago.com/
Small brave carnivores
Kill pine cones and mosquitoes
Fear vacuum cleaner
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Associated notes with documents
2005-07-21 2:46 Associated notes with documents Chris Lott
2005-07-21 6:39 ` Pascal Bourguignon
@ 2005-07-21 6:59 ` Joe Corneli
1 sibling, 0 replies; 5+ messages in thread
From: Joe Corneli @ 2005-07-21 6:59 UTC (permalink / raw)
Yes, er, sort of - I'm working on this right now. My implementation
isn't quite ready to drive off the lot but you can kick the tires a
little if you like,
http://www.nongnu.org/hdm/
look in the "scholium system" subdirectory for something called
sbdm4cbpp.tex (don't worry, its literate). I can also try
to make sure that you can make the system do what you want it
to do, 'cause its supposed to be general. But that said,
you may be able to find some other more specific less generally
and already 100% functional package out there to do what you
want, and if you do I'd be interested to know about it.
Be aware that I will be releasing the code for real, RSN.
Comments hacks & suggestions welcome.
I'm trying to figure out an automated way to have a "notes" window
associated with documents while using emacs. Ideally, the associated
notes file for a document would open up automatically with the document
inside a split window of some kind. If there were no notes, then
entering something in that window and saving it would automatically
create the notes file, which would open with the document next time.
Is there any code out there that does this kind of thing?
c
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Associated notes with documents
2005-07-21 6:39 ` Pascal Bourguignon
@ 2005-07-24 16:25 ` Chris Lott
2005-07-24 16:30 ` Adrian Aichner
0 siblings, 1 reply; 5+ messages in thread
From: Chris Lott @ 2005-07-24 16:25 UTC (permalink / raw)
Thanks for the help... however when I run this code I get this error in
the minibuffer when trying to find a file:
Symbol's function definition is void: first
??
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Associated notes with documents
2005-07-24 16:25 ` Chris Lott
@ 2005-07-24 16:30 ` Adrian Aichner
0 siblings, 0 replies; 5+ messages in thread
From: Adrian Aichner @ 2005-07-24 16:30 UTC (permalink / raw)
"Chris Lott" <Chris.Lott@gmail.com> writes:
> Thanks for the help... however when I run this code I get this error in
> the minibuffer when trying to find a file:
>
> Symbol's function definition is void: first
Some module made have to
(require 'cl)
>
> ??
>
--
Adrian Aichner
mailto:adrian@xemacs.org
http://www.xemacs.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-07-24 16:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-21 2:46 Associated notes with documents Chris Lott
2005-07-21 6:39 ` Pascal Bourguignon
2005-07-24 16:25 ` Chris Lott
2005-07-24 16:30 ` Adrian Aichner
2005-07-21 6:59 ` Joe Corneli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).