emacs-wiki-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[emacs-wiki-discuss] [PATCH] New `planner-annotation-from-file' option


From: Hoan Ton-That
Subject: [emacs-wiki-discuss] [PATCH] New `planner-annotation-from-file' option
Date: Thu, 24 Jun 2004 09:55:44 -0500
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Hello,

When `planner-annotation-from-file' is called it produces long
pathnames.  This patch creates the option to strip the directory name
from the link description.  If planner-annotation-strip-directory is
set to t, then links are written as:

  [[/long/path/to/directory/file][file]]

instead of:

  [[/long/path/to/directory/file]]
        
I hope this is useful.

--- planner.el~ 2004-06-24 09:50:03.000000000 -0500
+++ planner.el  2004-06-24 09:53:24.000000000 -0500
@@ -1203,10 +1203,16 @@
 If a function, it is called with the file name. Return value of t
 means use relative file links.")
 
+(defvar planner-annotation-strip-directory nil
+  "*If t, strip the directory part of the filename from the link
+description.")
+
 (defun planner-annotation-from-file ()
   "Return the filename of the current buffer.
 If `planner-annotation-use-relative-file' is t or a function that
-returns non-nil, a relative link is used instead."
+returns non-nil, a relative link is used instead.
+If `planner-annotation-strip-directory' is t, the directory is stripped 
+from the link description."
   (when buffer-file-name
     (concat "[["
             (or
@@ -1216,7 +1222,11 @@
                      (equal planner-annotation-use-relative-file t))
                (file-relative-name (buffer-file-name) planner-directory))
              buffer-file-name)
-            "]]")))
+            "]"
+           (if planner-annotation-strip-directory
+               (concat "[" (file-name-nondirectory buffer-file-name)
+                       "]]")
+             "]"))))
    
 ;;;_ + Tasks
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]