[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[emacs-wiki-discuss] New function: planner-annotation-from-directory
From: |
Stefan Reichör |
Subject: |
[emacs-wiki-discuss] New function: planner-annotation-from-directory |
Date: |
Tue, 15 Feb 2005 11:07:20 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux) |
Hi!
I discovered the planner-annotation-as-kill function.
I use it to put bookmarks on an easy editable wiki page.
I discovered, that there is currently no way to get a link to a
directory when I use this function.
I see two possibilities to add that functionality:
a) Create planner-annotation-from-directory:
(defun planner-annotation-from-directory ()
"Return the default-directory of the current buffer."
(when (eq major-mode 'dired-mode)
(planner-make-link default-directory)))
b) Add that functionality to planner-annotation-from-file
(defun planner-annotation-from-file ()
"Return the filename of the current buffer.
When called in a dired buffer, return the directory instead.
If `planner-annotation-use-relative-file' is t or a function that
returns non-nil, a relative link is used instead. If
`planner-annotation-strip-directory' is non-nil, the directory is
stripped from the link description."
(if (eq major-mode 'dired-mode)
(planner-make-link default-directory)
(when buffer-file-name
(planner-make-link
(if (or (and (functionp planner-annotation-use-relative-file)
(funcall planner-annotation-use-relative-file
(buffer-file-name)))
(equal planner-annotation-use-relative-file t))
(file-relative-name (buffer-file-name) planner-directory)
buffer-file-name)
(when planner-annotation-strip-directory
(file-name-nondirectory buffer-file-name))))))
Variant a) looks somewhat cleaner to me.
What do you think?
Stefan.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [emacs-wiki-discuss] New function: planner-annotation-from-directory,
Stefan Reichör <=