* [PATCH 2/7] Fix X clipboard handling in emacs21
2008-07-24 23:46 [PATCH 1/7] Some improvements to the modeline clock display James TD Smith
@ 2008-07-24 23:46 ` James TD Smith
2008-07-24 23:46 ` [PATCH 3/7] Show durations of clocked times in timeline James TD Smith
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: James TD Smith @ 2008-07-24 23:46 UTC (permalink / raw)
To: emacs-orgmode
Add a new function to org-compat to fetch clipboard values in emacs21 and
xemacs.
Use this function to fetch the clipboard when x-selection-value is unavailable.
---
lisp/ChangeLog | 9 +++++++++
lisp/org-compat.el | 13 ++++++++++++-
lisp/org-remember.el | 12 ++++++------
lisp/org.el | 2 +-
4 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 903aa8c..c81a049 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,14 @@
2008-07-25 James TD Smith <ahktenzero@mohorovi.cc>
+ * org-compat.el (org-get-x-clipboard-compat): Add a compat
+ function for fetching the X clipboard on XEmacs and GNU Emacs 21.
+
+ * org-remember.el (org-get-x-clipboard): Use the compat
+ function to get clipboard values when x-selection-value is
+ unavailable. Use substring-no-properties instead of
+ set-text-properties to remove text properties from the clipboard
+ value.
+
* lisp/org-clock.el (org-update-mode-line): Support limiting the
modeline clock string, and display the full todo value in the
tooltip. Set a local keymap so mouse-3 on the clock string goes to
diff --git a/lisp/org-compat.el b/lisp/org-compat.el
index 0ba1dcc..3447a06 100644
--- a/lisp/org-compat.el
+++ b/lisp/org-compat.el
@@ -245,7 +245,18 @@ that can be added."
(set-extent-property (car ext-inv-spec) 'invisible
(cadr ext-inv-spec))))
(move-to-column column force)))
-
+
+(defun org-get-x-clipboard-compat (value)
+ "Get the clipboard value on XEmacs or Emacs 21"
+ (cond (org-xemacs-p (org-no-warnings (get-selection-no-error value)))
+ ((fboundp 'x-get-selection)
+ (condition-case nil
+ (or (x-get-selection value 'UTF8_STRING)
+ (x-get-selection value 'COMPOUND_TEXT)
+ (x-get-selection value 'STRING)
+ (x-get-selection value 'TEXT))
+ (error nil)))))
+
(provide 'org-compat)
;; arch-tag: a0a0579f-e68c-4bdf-9e55-93768b846bbe
diff --git a/lisp/org-remember.el b/lisp/org-remember.el
index 2bbb20e..8399f3d 100644
--- a/lisp/org-remember.el
+++ b/lisp/org-remember.el
@@ -300,13 +300,13 @@ RET at beg-of-buf -> Append to file as level 2 headline
(cddr (assoc char templates)))))
(defun org-get-x-clipboard (value)
- "Get the value of the x clibboard, in a way that also works with XEmacs."
+ "Get the value of the x clibboard, in a way that works on XEmacs, and GNU
+Emacs 21"
(if (eq window-system 'x)
- (let ((x (if org-xemacs-p
- (org-no-warnings (get-selection-no-error value))
- (and (fboundp 'x-selection-value)
- (x-selection-value value)))))
- (and (> (length x) 0) (set-text-properties 0 (length x) nil x) x))))
+ (let ((x ;;(if (fboundp 'x-selection-value)
+ ;; (x-selection-value value)
+ (org-get-x-clipboard-compat value)));)
+ (if x (substring-no-properties x)))))
;;;###autoload
(defun org-remember-apply-template (&optional use-char skip-interactive)
diff --git a/lisp/org.el b/lisp/org.el
index 7a5be1f..77a859b 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -6890,7 +6890,7 @@ If `org-make-link-description-function' is non-nil, this function will be
called with the link target, and the result will be the default
link description.
-If the LINK-LOCATION parameter is non-nil, this value will be
+If the `LINK-LOCATION' parameter is non-nil, this value will be
used as the link location instead of reading one interactively."
(interactive "P")
(let* ((wcf (current-window-configuration))
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/7] Show durations of clocked times in timeline
2008-07-24 23:46 [PATCH 1/7] Some improvements to the modeline clock display James TD Smith
2008-07-24 23:46 ` [PATCH 2/7] Fix X clipboard handling in emacs21 James TD Smith
@ 2008-07-24 23:46 ` James TD Smith
2008-07-24 23:46 ` [PATCH 4/7] Fix link display in imenus and the refile interface James TD Smith
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: James TD Smith @ 2008-07-24 23:46 UTC (permalink / raw)
To: emacs-orgmode
In the timeline display in the agenda, show the length of time clocked as well
as the start and end times.
---
lisp/ChangeLog | 3 +++
lisp/org-agenda.el | 14 ++++++++------
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c81a049..e63503a 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
2008-07-25 James TD Smith <ahktenzero@mohorovi.cc>
+ * org-agenda.el (org-agenda-get-closed): show durations of clocked
+ items as well as the start and end times.
+
* org-compat.el (org-get-x-clipboard-compat): Add a compat
function for fetching the X clipboard on XEmacs and GNU Emacs 21.
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 23cda50..2f07535 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -3325,7 +3325,7 @@ the documentation of `org-diary'."
(list 0 0 0 (nth 1 date) (car date) (nth 2 date))))
1 11))))
marker hdmarker priority category tags closedp
- ee txt timestr rest)
+ ee txt timestr rest clocked)
(goto-char (point-min))
(while (re-search-forward regexp nil t)
(catch :skip
@@ -3341,10 +3341,11 @@ the documentation of `org-diary'."
(setq rest (substring timestr (match-end 0))
timestr (substring timestr 0 (match-end 0)))
(if (and (not closedp)
- (string-match "\\([0-9]\\{1,2\\}:[0-9]\\{2\\}\\)\\]" rest))
- (setq timestr (concat (substring timestr 0 -1)
- "-" (match-string 1 rest) "]"))))
-
+ (string-match "\\([0-9]\\{1,2\\}:[0-9]\\{2\\}\\)\\].*\\([0-9]\\{1,2\\}:[0-9]\\{2\\}\\)" rest))
+ (progn (setq timestr (concat (substring timestr 0 -1)
+ "-" (match-string 1 rest) "]"))
+ (setq clocked (match-string 2 rest)))
+ (setq clocked "-")))
(save-excursion
(if (re-search-backward "^\\*+ " nil t)
(progn
@@ -3353,7 +3354,8 @@ the documentation of `org-diary'."
tags (org-get-tags-at))
(looking-at "\\*+[ \t]+\\([^\r\n]+\\)")
(setq txt (org-format-agenda-item
- (if closedp "Closed: " "Clocked: ")
+ (if closedp "Closed: "
+ (concat "Clocked: (" clocked ")"))
(match-string 1) category tags timestr)))
(setq txt org-agenda-no-heading-message))
(setq priority 100000)
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/7] Fix link display in imenus and the refile interface
2008-07-24 23:46 [PATCH 1/7] Some improvements to the modeline clock display James TD Smith
2008-07-24 23:46 ` [PATCH 2/7] Fix X clipboard handling in emacs21 James TD Smith
2008-07-24 23:46 ` [PATCH 3/7] Show durations of clocked times in timeline James TD Smith
@ 2008-07-24 23:46 ` James TD Smith
2008-07-24 23:46 ` [PATCH 5/7] Fix note insertion in entries with drawers James TD Smith
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: James TD Smith @ 2008-07-24 23:46 UTC (permalink / raw)
To: emacs-orgmode
Replace links with their descriptions in when generating the items for imenus
and the refile interface.
---
lisp/ChangeLog | 4 ++++
lisp/org.el | 8 +++++++-
2 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e63503a..ea6e60e 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,9 @@
2008-07-25 James TD Smith <ahktenzero@mohorovi.cc>
+ * org.el (org-get-refile-targets): Replace links with their
+ descriptions
+ (org-imenu-get-tree): Replace links with their descriptions
+
* org-agenda.el (org-agenda-get-closed): show durations of clocked
items as well as the start and end times.
diff --git a/lisp/org.el b/lisp/org.el
index 77a859b..cbce370 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -7740,7 +7740,10 @@ on the system \"/user@host:\"."
(while (re-search-forward descre nil t)
(goto-char (point-at-bol))
(when (looking-at org-complex-heading-regexp)
- (setq txt (match-string 4)
+ (setq txt (save-match-data
+ (replace-regexp-in-string
+ org-bracket-link-analytic-regexp "\\5"
+ (match-string 4)))
re (concat "^" (regexp-quote
(buffer-substring (match-beginning 1)
(match-end 4)))))
@@ -14470,6 +14473,9 @@ Show the heading too, if it is currently invisible."
(looking-at org-complex-heading-regexp)
(setq head (org-match-string-no-properties 4)
m (org-imenu-new-marker))
+ (setq head (replace-regexp-in-string
+ org-bracket-link-analytic-regexp
+ "\\5" head))
(org-add-props head nil 'org-imenu-marker m 'org-imenu t)
(if (>= level last-level)
(push (cons head m) (aref subs level))
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 5/7] Fix note insertion in entries with drawers.
2008-07-24 23:46 [PATCH 1/7] Some improvements to the modeline clock display James TD Smith
` (2 preceding siblings ...)
2008-07-24 23:46 ` [PATCH 4/7] Fix link display in imenus and the refile interface James TD Smith
@ 2008-07-24 23:46 ` James TD Smith
2008-07-24 23:46 ` [PATCH 6/7] Add some functions for handling checklists James TD Smith
2008-07-24 23:46 ` [PATCH 7/7] Add some new interaction between remember and clocked tasks James TD Smith
5 siblings, 0 replies; 7+ messages in thread
From: James TD Smith @ 2008-07-24 23:46 UTC (permalink / raw)
To: emacs-orgmode
The code to find the insertion point after a heading for notes was not skipping
over drawers, resulting in notes being added inbetween the scheduling keywords
and the first drawer. Notes are now inserted after any drawers in an item.
---
lisp/ChangeLog | 2 ++
lisp/org.el | 43 ++++++++++++++++++++++++-------------------
2 files changed, 26 insertions(+), 19 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ea6e60e..d072d40 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -3,6 +3,8 @@
* org.el (org-get-refile-targets): Replace links with their
descriptions
(org-imenu-get-tree): Replace links with their descriptions
+ (org-add-log-setup): Skip over drawers (properties, clocks etc)
+ when adding notes.
* org-agenda.el (org-agenda-get-closed): show durations of clocked
items as well as the start and end times.
diff --git a/lisp/org.el b/lisp/org.el
index cbce370..97e0d03 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -8444,10 +8444,10 @@ For calling through lisp, arg is also interpreted in the following way:
;; It is now done, and it was not done before
(org-add-planning-info 'closed (org-current-time))
(if (and (not dolog) (eq 'note org-log-done))
- (org-add-log-setup 'done state 'findpos 'note)))
+ (org-add-log-setup 'done state t 'note)))
(when (and state dolog)
;; This is a non-nil state, and we need to log it
- (org-add-log-setup 'state state 'findpos dolog)))
+ (org-add-log-setup 'state state t dolog)))
;; Fixup tag positioning
(and org-auto-align-tags (not org-setting-tags) (org-set-tags nil t))
(when org-provide-todo-statistics
@@ -8681,7 +8681,7 @@ This function is run automatically after each state change to a DONE state."
(setq org-log-note-how 'note))
;; Set up for taking a record
(org-add-log-setup 'state (or done-word (car org-done-keywords))
- 'findpos org-log-repeat)))
+ t org-log-repeat)))
(org-back-to-heading t)
(org-add-planning-info nil nil 'closed)
(setq re (concat "\\(" org-scheduled-time-regexp "\\)\\|\\("
@@ -8908,22 +8908,27 @@ This is done in the same way as adding a state change note."
If this is about to TODO state change, the new state is expected in STATE.
When FINDPOS is non-nil, find the correct position for the note in
the current entry. If not, assume that it can be inserted at point."
- (save-excursion
- (when findpos
- (org-back-to-heading t)
- (looking-at (concat outline-regexp "\\( *\\)[^\r\n]*"
- "\\(\n[^\r\n]*?" org-keyword-time-not-clock-regexp
- "[^\r\n]*\\)?"))
- (goto-char (match-end 0))
- (unless org-log-states-order-reversed
- (and (= (char-after) ?\n) (forward-char 1))
- (org-skip-over-state-notes)
- (skip-chars-backward " \t\n\r")))
- (move-marker org-log-note-marker (point))
- (setq org-log-note-purpose purpose
- org-log-note-state state
- org-log-note-how how)
- (add-hook 'post-command-hook 'org-add-log-note 'append)))
+ (save-restriction
+ (save-excursion
+ (when findpos
+ (org-back-to-heading t)
+ (org-narrow-to-subtree)
+ (looking-at (concat outline-regexp "\\( *\\)[^\r\n]*"
+ "\\(\n[^\r\n]*?" org-keyword-time-not-clock-regexp
+ "[^\r\n]*\\)?"))
+ (goto-char (match-end 0))
+ (while (re-search-forward
+ (concat "\\(" org-drawer-regexp "\\|" org-property-end-re "\\)")
+ (point-max) t))
+ (unless org-log-states-order-reversed
+ (and (= (char-after) ?\n) (forward-char 1))
+ (org-skip-over-state-notes)
+ (skip-chars-backward " \t\n\r")))
+ (move-marker org-log-note-marker (point))
+ (setq org-log-note-purpose purpose
+ org-log-note-state state
+ org-log-note-how how)
+ (add-hook 'post-command-hook 'org-add-log-note 'append))))
(defun org-skip-over-state-notes ()
"Skip past the list of State notes in an entry."
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 6/7] Add some functions for handling checklists.
2008-07-24 23:46 [PATCH 1/7] Some improvements to the modeline clock display James TD Smith
` (3 preceding siblings ...)
2008-07-24 23:46 ` [PATCH 5/7] Fix note insertion in entries with drawers James TD Smith
@ 2008-07-24 23:46 ` James TD Smith
2008-07-24 23:46 ` [PATCH 7/7] Add some new interaction between remember and clocked tasks James TD Smith
5 siblings, 0 replies; 7+ messages in thread
From: James TD Smith @ 2008-07-24 23:46 UTC (permalink / raw)
To: emacs-orgmode
Add a module to contrib for handling repeated tasks which require checking off a
list of items.
---
contrib/ChangeLog | 5 ++
contrib/lisp/org-checklist.el | 110 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 115 insertions(+), 0 deletions(-)
create mode 100644 contrib/lisp/org-checklist.el
diff --git a/contrib/ChangeLog b/contrib/ChangeLog
index 66d379c..1d94fa0 100644
--- a/contrib/ChangeLog
+++ b/contrib/ChangeLog
@@ -1,3 +1,7 @@
+2008-07-05 James TD Smith <ahktenzero@mohorovi.cc>
+
+ * lisp/org-checklist.el: Add various checklist handling functions
+
2008-07-04 Christian Egli <christian.egli@alumni.ethz.ch>
* scripts/org2hpda: the default location of the diary file should
@@ -8,6 +12,7 @@
* lisp/org-mtags.el (org-mtags-replace): Allow prefix and prefix1
as options in the include directive.
+
2008-06-18 Christian Egli <christian.egli@alumni.ethz.ch>
* scripts/org2hpda (DIARY): Make the location of the diary file
diff --git a/contrib/lisp/org-checklist.el b/contrib/lisp/org-checklist.el
new file mode 100644
index 0000000..09ff911
--- /dev/null
+++ b/contrib/lisp/org-checklist.el
@@ -0,0 +1,110 @@
+;;; org-checklist.el --- org functions for checklist handling
+;;
+;; ©2008 James TD Smith
+;;
+;; Author: James TD Smith (@ ahktenzero (. mohorovi cc))
+;; Version: 1.0
+;; Keywords: org, checklists
+;;
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+;;
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, write to the Free Software
+;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+;;
+;;; Commentary:
+;; This file provides some functions for handing repeated tasks which involve
+;; checking off a list of items. By setting the RESET_CHECK_BOXES property in an
+;; item, when the TODO state is set to done all checkboxes under that item are
+;; cleared. If the LIST_EXPORT_BASENAME property is set, a file will be created
+;; using the value of that property plus a timestamp, containing all the items
+;; in the list which are not checked. Additionally the user will be prompted to
+;; print the list.
+;;
+;; I use this for to keep track of stores of various things (food stores,
+;; components etc) which I check periodically and use the exported list of items
+;; which are not present as a shopping list.
+;;
+;;; Usage:
+;; (require 'org-checklist)
+;;
+;; Set the RESET_CHECK_BOXES and LIST_EXPORT_BASENAME properties in items as
+;; needed.
+;;
+;;; Code:
+(require 'org)
+
+(defvar export-time-format "%Y%m%d%H%M"
+ "format of timestamp appended to export file")
+(defvar export-function 'org-export-as-ascii
+ "function used to prepare the export file for printing")
+
+(defun org-reset-checkbox-state-maybe ()
+ "Reset all checkboxes in an entry if the `RESET_CHECK_BOXES' property is set"
+ (interactive "*")
+ (if (org-entry-get (point) "RESET_CHECK_BOXES")
+ (save-restriction
+ (save-excursion
+ (org-narrow-to-subtree)
+ (org-show-subtree)
+ (goto-char (point-min))
+ (let ((end (point-max)))
+ (while (< (point) end)
+ (when (org-at-item-checkbox-p)
+ (replace-match "[ ]" t t))
+ (beginning-of-line 2))))
+ (org-update-checkbox-count-maybe))))
+
+(defun org-make-checklist-export ()
+ "Produce a checklist containing all unchecked items from a list
+of checkbox items"
+ (interactive "*")
+ (if (org-entry-get (point) "LIST_EXPORT_BASENAME")
+ (let* ((export-file (concat (org-entry-get (point) "LIST_EXPORT_BASENAME")
+ "-" (format-time-string export-time-format)
+ ".org"))
+ exported-lines
+ title)
+ (save-restriction
+ (save-excursion
+ (org-narrow-to-subtree)
+ (org-show-subtree)
+ (goto-char (point-min))
+ (if (looking-at org-complex-heading-regexp)
+ (setq title (match-string 4)))
+ (goto-char (point-min))
+ (let ((end (point-max)))
+ (while (< (point) end)
+ (when (and (org-at-item-checkbox-p)
+ (or (string= (match-string 0) "[ ]")
+ (string= (match-string 0) "[-]")))
+ (add-to-list 'exported-lines (thing-at-point 'line) t))
+ (beginning-of-line 2)))
+ (set-buffer (get-buffer-create export-file))
+ (org-insert-heading)
+ (insert (or title export-file) "\n")
+ (dolist (entry exported-lines) (insert entry))
+ (org-update-checkbox-count-maybe)
+ (write-file export-file)
+ (if (y-or-n-p "Print list? ")
+ ((funcall export-function)
+ (a2ps-buffer))))))))
+
+(defun org-checklist ()
+ (if (member state org-done-keywords)
+ (org-make-checklist-export))
+ (org-reset-checkbox-state-maybe))
+
+(add-hook 'org-after-todo-state-change-hook 'org-checklist)
+
+(provide 'org-checklist)
+
+;;; org-elisp-symbol.el ends here
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 7/7] Add some new interaction between remember and clocked tasks
2008-07-24 23:46 [PATCH 1/7] Some improvements to the modeline clock display James TD Smith
` (4 preceding siblings ...)
2008-07-24 23:46 ` [PATCH 6/7] Add some functions for handling checklists James TD Smith
@ 2008-07-24 23:46 ` James TD Smith
5 siblings, 0 replies; 7+ messages in thread
From: James TD Smith @ 2008-07-24 23:46 UTC (permalink / raw)
To: emacs-orgmode
Add %< expansion. This tells org-remember to add the item to the currently
clocked task. Often while I'm working on something I find other related things
which need to be done and this makes it possible to use a remember template to
add a TODO item in the right place.
Add %l expansion for the current clock string.
Add %L expansion for a link to the currently clocked task.
---
lisp/ChangeLog | 7 ++++++-
lisp/org-remember.el | 38 ++++++++++++++++++++++++++++++++++----
2 files changed, 40 insertions(+), 5 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index d072d40..b591f32 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,10 @@
2008-07-25 James TD Smith <ahktenzero@mohorovi.cc>
+ * org-remember.el (org-remember-apply-template): Add new
+ expansions: %k, %K for currently clocked task and a link to the
+ currently clocked task, and %< to file notes in the currently
+ clocked task.
+
* org.el (org-get-refile-targets): Replace links with their
descriptions
(org-imenu-get-tree): Replace links with their descriptions
@@ -18,7 +23,7 @@
set-text-properties to remove text properties from the clipboard
value.
- * lisp/org-clock.el (org-update-mode-line): Support limiting the
+ * org-clock.el (org-update-mode-line): Support limiting the
modeline clock string, and display the full todo value in the
tooltip. Set a local keymap so mouse-3 on the clock string goes to
the currently clocked task.
diff --git a/lisp/org-remember.el b/lisp/org-remember.el
index 8399f3d..80b5896 100644
--- a/lisp/org-remember.el
+++ b/lisp/org-remember.el
@@ -135,11 +135,15 @@ Furthermore, the following %-escapes will be replaced with content:
%^L Like %^C, but insert as link
%^g prompt for tags, with completion on tags in target file
%^G prompt for tags, with completion all tags in all agenda files
+ %k currently clocked task
+ %K link to currently clocked task
+
%:keyword specific information for certain link types, see below
%[pathname] insert the contents of the file given by `pathname'
%(sexp) evaluate elisp `(sexp)' and replace with the result
%! Store this note immediately after filling the template
%& Visit note immediately after storing it
+ %< file note under currently clocked task
%? After completing the template, position cursor here.
@@ -346,11 +350,33 @@ to be run from that hook to function properly."
(replace-match "[\\1[%^{Link description}]]" nil nil v-a)
v-a))
(v-n user-full-name)
+ (v-k (if (marker-buffer org-clock-marker)
+ (substring-no-properties org-clock-heading)))
+ (v-K (if (marker-buffer org-clock-marker)
+ (org-make-link-string
+ (buffer-file-name (marker-buffer org-clock-marker))
+ org-clock-heading)))
+ v-I
(org-startup-folded nil)
org-time-was-given org-end-time-was-given x
prompt completions char time pos default histvar)
(when (and file (not (file-name-absolute-p file)))
(setq file (expand-file-name file org-directory)))
+
+ ;;handle the %^K file to clocked task indicator
+ (if (and v-k (string-match "%<" tpl))
+ (setq file (buffer-file-name (marker-buffer org-clock-marker))
+ headline (with-current-buffer
+ (get-buffer (marker-buffer org-clock-marker))
+ (goto-char (marker-position org-clock-marker))
+ (org-back-to-heading t)
+ (if (looking-at org-complex-heading-regexp)
+ (concat (match-string 2)
+ (if (match-string 2) " ")
+ (match-string 3)
+ (if (match-string 3) " ")
+ (match-string 4))))))
+
(setq org-store-link-plist
(append (list :annotation v-a :initial v-i)
org-store-link-plist))
@@ -369,9 +395,14 @@ to be run from that hook to function properly."
(or headline "")
(or (car org-remember-previous-location) "???")
(or (cdr org-remember-previous-location) "???"))))
- (insert tpl) (goto-char (point-min))
+ (insert tpl)
+ (goto-char (point-min))
+ ;;Get rid of %< if present
+ (while (re-search-forward "%<" nil t)
+ (replace-match ""))
+ (goto-char (point-min))
;; Simple %-escapes
- (while (re-search-forward "%\\([tTuUaiAcx]\\)" nil t)
+ (while (re-search-forward "%\\([tTuUaiAcxkKI]\\)" nil t)
(when (and initial (equal (match-string 0) "%i"))
(save-match-data
(let* ((lead (buffer-substring
@@ -380,8 +411,7 @@ to be run from that hook to function properly."
(org-split-string initial "\n")
(concat "\n" lead))))))
(replace-match
- (or (eval (intern (concat "v-" (match-string 1)))) "")
- t t))
+ (or (eval (intern (concat "v-" (match-string 1)))) "") t t))
;; %[] Insert contents of a file.
(goto-char (point-min))
^ permalink raw reply related [flat|nested] 7+ messages in thread