ソースを参照

Merge branch 'master' of git+ssh://repo.or.cz/srv/git/org-mode

Carsten Dominik 17 年 前
コミット
504bd65683
3 ファイル変更28 行追加12 行削除
  1. 13 10
      CONTRIB/lisp/org-annotate-file.el
  2. 7 0
      ChangeLog
  3. 8 2
      org.el

+ 13 - 10
CONTRIB/lisp/org-annotate-file.el

@@ -68,15 +68,18 @@ location in the file")
   "non-nil means always expand the full tree when you visit
 `org-annotate-file-storage-file'.")
 
-(defun org-annotate-file-prettyfy-desc (string)
+(defun org-annotate-file-elipsify-desc (string &optional after)
   "Strip starting and ending whitespace and replace any chars
-after the 60th with '...'"
-  (let ((replace-map '(("^[ \t]*" . "")
-                       ("[ \t]*$" . "")
-                       ("^\\(.\\{60\\}\\).*" . "\\1..."))))
-    (dolist (replace replace-map)
-      (when (string-match (car replace) string)
-        (setq string (replace-match (cdr replace) nil nil string))))
+that appear after the value in `after' with '...'"
+  (let* ((after (number-to-string (or after 30)))
+         (replace-map (list (cons "^[ \t]*" "")
+                            (cons "[ \t]*$" "")
+                            (cons (concat "^\\(.\\{" after
+                                          "\\}\\).*") "\\1..."))))
+    (mapc (lambda (x)
+            (when (string-match (car x) string)
+              (setq string (replace-match (cdr x) nil nil string))))
+          replace-map)
     string))
 
 (defun org-annotate-file ()
@@ -91,10 +94,10 @@ after the 60th with '...'"
 show the relevant section"
   (let* ((filename (abbreviate-file-name (or buffer (buffer-file-name))))
          (line (buffer-substring-no-properties (point-at-bol) (point-at-eol)))
-         (link (org-make-link-string (concat "file:" filename)))
+         (link (org-make-link-string (concat "file:" filename) filename))
          (search-link (org-make-link-string
                        (concat "file:" filename "::" line)
-                               (org-annotate-file-prettyfy-desc line))))
+                               (org-annotate-file-elipsify-desc line))))
     (with-current-buffer (find-file org-annotate-file-storage-file)
       (unless (org-mode-p)
         (org-mode))

+ 7 - 0
ChangeLog

@@ -1,3 +1,10 @@
+2008-03-05  Bastien Guerry  <bzg@altern.org>
+
+	* org.el (org-follow-link-hook): New hook.
+	(org-agenda-custom-commands): Added "Component" as a tag for each
+	item in a command serie.
+	(org-open-at-point): Run `org-follow-link-hook'.
+
 2008-03-04  Bastien Guerry  <bzg@altern.org>
 
 	* org.el (org-agenda-schedule): Bugfix: don't display marker type

+ 8 - 2
org.el

@@ -1246,6 +1246,11 @@ negates this setting for the duration of the command."
   :tag "Org Follow Link"
   :group 'org-link)
 
+(defcustom org-follow-link-hook nil
+  "Hook that is run after a link has been followed."
+  :group 'org-link-follow
+  :type 'hook)
+
 (defcustom org-tab-follows-link nil
   "Non-nil means, on links TAB will follow the link.
 Needs to be set before org.el is loaded."
@@ -2491,7 +2496,7 @@ should provide a description for the prefix, like
 	   (list :tag "Command series, all agenda files"
 		 (string :tag "Access Key(s)")
 		 (string :tag "Description  ")
-		 (repeat
+		 (repeat :tag "Component"
 		  (choice
 		   (const :tag "Agenda" (agenda))
 		   (const :tag "TODO list" (alltodo))
@@ -12935,7 +12940,8 @@ optional argument IN-EMACS is non-nil, Emacs will visit the file."
 
        (t
 	(browse-url-at-point)))))
-  (move-marker org-open-link-marker nil))
+  (move-marker org-open-link-marker nil)
+  (run-hook-with-args 'org-follow-link-hook))
 
 ;;; File search