Make C-c C-o open the attachment directory is there are no links

This commit is contained in:
Carsten Dominik 2009-10-30 09:08:50 +01:00
parent ca3d96d98d
commit 10249d98d1
3 changed files with 23 additions and 7 deletions

View file

@ -1,5 +1,16 @@
2009-10-30 Carsten Dominik <carsten.dominik@gmail.com> 2009-10-30 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-offer-links-in-entry): Return nil if there are no
links, t if a link has been selected.
(org-open-at-point): Open attachment directory when called in the
headline and there are no links in the entry body.
(org-speed-commands-default): Add "o" for open-at-point as a speed
command.
* org-attach.el (org-attach-reveal): Optional prefix arg
IF-EXISTS, which avoids creating the attachment directory if it
does not yet exist.
* org-agenda.el (org-agenda, org-run-agenda-series): Evaluate * org-agenda.el (org-agenda, org-run-agenda-series): Evaluate
MATCH. MATCH.

View file

@ -365,11 +365,11 @@ This ignores files starting with a \".\", and files ending in \"~\"."
(mapcar (lambda (x) (if (string-match "^\\." x) nil x)) (mapcar (lambda (x) (if (string-match "^\\." x) nil x))
(directory-files dir nil "[^~]\\'")))) (directory-files dir nil "[^~]\\'"))))
(defun org-attach-reveal () (defun org-attach-reveal (&optional if-exists)
"Show the attachment directory of the current task in dired." "Show the attachment directory of the current task in dired."
(interactive) (interactive "P")
(let ((attach-dir (org-attach-dir t))) (let ((attach-dir (org-attach-dir (not if-exists))))
(org-open-file attach-dir))) (and attach-dir (org-open-file attach-dir))))
(defun org-attach-reveal-in-emacs () (defun org-attach-reveal-in-emacs ()
"Show the attachment directory of the current task. "Show the attachment directory of the current task.

View file

@ -8040,7 +8040,8 @@ application the system uses for this file type."
org-bracket-link-regexp "\\|" org-bracket-link-regexp "\\|"
org-angle-link-re "\\|" org-angle-link-re "\\|"
"[ \t]:[^ \t\n]+:[ \t]*$")))) "[ \t]:[^ \t\n]+:[ \t]*$"))))
(org-offer-links-in-entry in-emacs)) (or (org-offer-links-in-entry in-emacs)
(org-attach-reveal 'if-exists)))
((org-at-timestamp-p t) (org-follow-timestamp-link)) ((org-at-timestamp-p t) (org-follow-timestamp-link))
((or (org-footnote-at-reference-p) (org-footnote-at-definition-p)) ((or (org-footnote-at-reference-p) (org-footnote-at-definition-p))
(org-footnote-action)) (org-footnote-action))
@ -8223,7 +8224,8 @@ there is one, offer it as link number zero."
(setq links (org-uniquify (reverse links)))) (setq links (org-uniquify (reverse links))))
(cond (cond
((null links) (error "No links")) ((null links)
(message "No links"))
((equal (length links) 1) ((equal (length links) 1)
(setq link (car links))) (setq link (car links)))
((and (integerp nth) (>= (length links) (if have-zero (1+ nth) nth))) ((and (integerp nth) (>= (length links) (if have-zero (1+ nth) nth)))
@ -8253,7 +8255,9 @@ there is one, offer it as link number zero."
(unless (and (integerp nth) (>= (length links) nth)) (unless (and (integerp nth) (>= (length links) nth))
(error "Invalid link selection")) (error "Invalid link selection"))
(setq link (nth (1- nth) links)))) (setq link (nth (1- nth) links))))
(org-open-link-from-string link in-emacs (current-buffer)))) (if link
(progn (org-open-link-from-string link in-emacs (current-buffer)) t)
nil)))
;;;; Time estimates ;;;; Time estimates
@ -14644,6 +14648,7 @@ Some of the options can be changed using the variable
("i" . (progn (forward-char 1) (call-interactively ("i" . (progn (forward-char 1) (call-interactively
'org-insert-heading-respect-content))) 'org-insert-heading-respect-content)))
("a" . org-archive-subtree-default) ("a" . org-archive-subtree-default)
("o" . org-open-at-point)
("t" . org-todo) ("t" . org-todo)
("j" . org-goto) ("j" . org-goto)
("1" . (org-priority ?A)) ("1" . (org-priority ?A))