BBDB anniversaries are now links.
Feature request from Rares Vernica, implementation by Thomas Baumann.
This commit is contained in:
parent
7942476b1d
commit
f7f1a7f085
|
@ -4502,20 +4502,14 @@ If this information is not given, the function uses the tree at point."
|
|||
(delete-region (point-at-bol) (1+ (point-at-eol)))))
|
||||
(beginning-of-line 0))))))
|
||||
|
||||
(declare-function org-bbdb-follow-anniversary-link "org-bbdb" (&optional arg))
|
||||
|
||||
(defun org-agenda-open-link (&optional arg)
|
||||
(defun org-agenda-open-link ()
|
||||
"Follow the link in the current line, if any."
|
||||
(interactive "P")
|
||||
(if (and (fboundp 'org-bbdb-follow-anniversary-link)
|
||||
(org-bbdb-follow-anniversary-link arg))
|
||||
nil ; ok, there was a link, we followed it
|
||||
;; There was no link
|
||||
(org-agenda-copy-local-variable 'org-link-abbrev-alist-local)
|
||||
(save-excursion
|
||||
(save-restriction
|
||||
(narrow-to-region (point-at-bol) (point-at-eol))
|
||||
(org-open-at-point)))))
|
||||
(interactive)
|
||||
(org-agenda-copy-local-variable 'org-link-abbrev-alist-local)
|
||||
(save-excursion
|
||||
(save-restriction
|
||||
(narrow-to-region (point-at-bol) (point-at-eol))
|
||||
(org-open-at-point))))
|
||||
|
||||
(defun org-agenda-copy-local-variable (var)
|
||||
"Get a variable from a referenced buffer and install it here."
|
||||
|
|
|
@ -117,8 +117,16 @@
|
|||
:require 'bbdb)
|
||||
|
||||
(defcustom org-bbdb-anniversary-format-alist
|
||||
'( ("birthday" . "Birthday: %s (%d%s)")
|
||||
("wedding" . "%s's %d%s wedding anniversary") )
|
||||
'(("birthday" lambda
|
||||
(name years suffix)
|
||||
(concat "Birthday: [[bbdb:" name "][" name " ("
|
||||
(number-to-string years)
|
||||
suffix ")]]"))
|
||||
("wedding" lambda
|
||||
(name years suffix)
|
||||
(concat "[[bbdb:" name "][" name "'s "
|
||||
(number-to-string years)
|
||||
suffix " wedding anniversary]]")))
|
||||
"How different types of anniversaries should be formatted.
|
||||
An alist of elements (STRING . FORMAT) where STRING is the name of an
|
||||
anniversary class and format is either:
|
||||
|
@ -312,28 +320,6 @@ This is used by Org to re-create the anniversary hash table."
|
|||
(when text
|
||||
(mapconcat 'identity text "; "))))
|
||||
|
||||
(defun org-bbdb-follow-anniversary-link (arg)
|
||||
"Check if there is a BBDB anniversary link in current line and follow it."
|
||||
(let ((n (prefix-numeric-value arg))
|
||||
end name names last)
|
||||
(setq name (get-text-property (point) 'org-bbdb-name))
|
||||
(save-excursion
|
||||
(beginning-of-line 1)
|
||||
(setq end (1- (point-at-eol)))
|
||||
(setq last (1- (point)))
|
||||
(while (and (setq next (next-single-property-change
|
||||
(point) 'org-bbdb-name nil end))
|
||||
(> next last))
|
||||
(goto-char next)
|
||||
(setq last next)
|
||||
(setq names (cons (get-text-property (point) 'org-bbdb-name) names))))
|
||||
(setq names (nreverse (delq nil names)))
|
||||
(if (setq name (or (and arg (nth (1- n) names))
|
||||
name
|
||||
(car names)))
|
||||
(progn (bbdb-name name nil) t)
|
||||
nil)))
|
||||
|
||||
(provide 'org-bbdb)
|
||||
|
||||
;; arch-tag: 9e4f275d-d080-48c1-b040-62247f66b5c2
|
||||
|
|
Loading…
Reference in New Issue