* [PATCH 0/9] Update my last patchset
@ 2008-09-20 21:08 James TD Smith
2008-09-20 21:08 ` [PATCH 1/9] Some improvements to the modeline clock display James TD Smith
` (9 more replies)
0 siblings, 10 replies; 17+ messages in thread
From: James TD Smith @ 2008-09-20 21:08 UTC (permalink / raw
To: emacs-orgmode
I've updated my last patchset so it applies to the current version, and added a
few more patches I have written since then.
The following series implements...
---
James TD Smith (9):
Some bugfixes for org-plot.
Add a % expansion for inserting properties in remember buffers.
Add some new interaction between remember and clocked tasks
Add some functions for handling checklists.
Fix note insertion in entries with drawers.
Fix link display in imenus and the refile interface
Show durations of clocked times in timeline
Fix X clipboard handling in emacs21
Some improvements to the modeline clock display
contrib/ChangeLog | 5 ++
contrib/lisp/org-checklist.el | 110 +++++++++++++++++++++++++++++++++++++++++
lisp/ChangeLog | 55 ++++++++++++++-------
lisp/org-agenda.el | 14 +++--
lisp/org-clock.el | 36 ++++++++++---
lisp/org-compat.el | 13 ++++-
lisp/org-plot.el | 13 +++--
lisp/org-remember.el | 67 +++++++++++++++++++++----
lisp/org.el | 51 ++++++++++++-------
9 files changed, 292 insertions(+), 72 deletions(-)
create mode 100644 contrib/lisp/org-checklist.el
--
|-<James TD Smith>-<email/ahktenzero@mohorovi.cc>-|
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 1/9] Some improvements to the modeline clock display
2008-09-20 21:08 [PATCH 0/9] Update my last patchset James TD Smith
@ 2008-09-20 21:08 ` James TD Smith
2008-09-20 21:08 ` [PATCH 2/9] Fix X clipboard handling in emacs21 James TD Smith
` (8 subsequent siblings)
9 siblings, 0 replies; 17+ messages in thread
From: James TD Smith @ 2008-09-20 21:08 UTC (permalink / raw
To: emacs-orgmode
Allow users to specify a maximum length for the modeline clock. Add an option to
limit the length of the clock string in the modeline. When the limit is in
effect, the full item text is included in the tooltip on the clock string.
Make clicking on the clock string now goes to the currently clocked item.
---
lisp/ChangeLog | 29 +++++++++++------------------
lisp/org-clock.el | 36 ++++++++++++++++++++++++++----------
2 files changed, 37 insertions(+), 28 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 3a57ca8..5eb535f 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
+2008-09-20 James TD Smith <ahktenzero@mohorovi.cc>
+
+ * 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
+ the currently clocked task.
+ (org-clock-string-limit): Add a custom value for the maximum
+ length of the clock string in the modeline.
+ (org-clock-mode-map): Add a keymap for the modeline string
+
2008-09-20 Bastien Guerry <bzg@altern.org>
* org-export-latex.el (org-export-latex-tables): protect exported
@@ -215,16 +225,6 @@
* org.el (org-columns-modify-value-for-display-function): New option.
-
-
-
-
-
-
-
-
-
-
* org-publish.el (org-publish-file): Make sure the directory match
for the publishing directory works correctly.
@@ -238,13 +238,6 @@
* org.el (org-autoload): Add `org-dblock-write:columnview'.
-
-
-
-
-
-
-
2008-07-23 Carsten Dominik <dominik@science.uva.nl>
* org-exp.el (org-export-region-as-html, org-export-as-html): Make
@@ -255,7 +248,7 @@
* org-agenda.el (org-batch-store-agenda-views): Fix parsing bug.
-2008-07-20 Juri Linkov <juri@jurta.org>
+2008-07-20 Juri Linkov <juri@jurta.org>
* org.el (narrow-map): Bind `org-narrow-to-subtree' to "s" on the
new keymap `narrow-map' instead of binding "\C-xns".
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index f2f49a8..4d2069c 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -86,6 +86,10 @@ The function is called with point at the beginning of the headline."
:group 'org-clock
:type 'function)
+(defcustom org-clock-string-limit 0
+ "Maximum length of clock strings in the modeline. 0 means no limit"
+ :group 'org-clock
+ :type 'integer)
;;; The clock for measuring work time.
@@ -107,6 +111,9 @@ of a different task.")
(defvar org-clock-interrupted-task (make-marker)
"Marker pointing to the task that has been interrupted by the current clock.")
+(defvar org-clock-mode-map (make-sparse-keymap))
+(define-key org-clock-mode-map [mode-line mouse-2] 'org-clock-goto)
+
(defun org-clock-history-push (&optional pos buffer)
"Push a marker to the clock history."
(setq org-clock-history-length (max 1 (min 35 org-clock-history-length)))
@@ -190,15 +197,23 @@ of a different task.")
(when (and cat task)
(insert (format "[%c] %-15s %s\n" i cat task))
(cons i marker)))))
-
+
(defun org-update-mode-line ()
(let* ((delta (- (time-to-seconds (current-time))
- (time-to-seconds org-clock-start-time)))
+ (time-to-seconds org-clock-start-time)))
(h (floor delta 3600))
(m (floor (- delta (* 3600 h)) 60)))
(setq org-mode-line-string
- (propertize (format (concat "-[" org-time-clocksum-format " (%s)]") h m org-clock-heading)
- 'help-echo "Org-mode clock is running"))
+ (propertize (let ((clock-string (format (concat "-[" org-time-clocksum-format " (%s)]")
+ h m org-clock-heading))
+ (help-text "Org-mode clock is running"))
+ (if (and (> org-clock-string-limit 0)
+ (> (length clock-string) org-clock-string-limit))
+ (propertize (substring clock-string 0 org-clock-string-limit)
+ 'help-echo (concat help-text ": " org-clock-heading))
+ (propertize clock-string 'help-echo help-text)))
+ 'local-map org-clock-mode-map
+ 'mouse-face '(face mode-line-highlight)))
(force-mode-line-update)))
(defvar org-clock-mode-line-entry nil
@@ -253,12 +268,13 @@ the clocking selection, associated with the letter `d'."
org-clock-in-switch-to-state
"\\>"))))
(org-todo org-clock-in-switch-to-state))
- (if (and org-clock-heading-function
- (functionp org-clock-heading-function))
- (setq org-clock-heading (funcall org-clock-heading-function))
- (if (looking-at org-complex-heading-regexp)
- (setq org-clock-heading (match-string 4))
- (setq org-clock-heading "???")))
+ (setq org-clock-heading
+ (cond ((and org-clock-heading-function
+ (functionp org-clock-heading-function))
+ (funcall org-clock-heading-function))
+ ((looking-at org-complex-heading-regexp)
+ (match-string 4))
+ (t "???")))
(setq org-clock-heading (propertize org-clock-heading 'face nil))
(org-clock-find-position)
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 2/9] Fix X clipboard handling in emacs21
2008-09-20 21:08 [PATCH 0/9] Update my last patchset James TD Smith
2008-09-20 21:08 ` [PATCH 1/9] Some improvements to the modeline clock display James TD Smith
@ 2008-09-20 21:08 ` James TD Smith
2008-09-20 21:08 ` [PATCH 3/9] Show durations of clocked times in timeline James TD Smith
` (7 subsequent siblings)
9 siblings, 0 replies; 17+ messages in thread
From: James TD Smith @ 2008-09-20 21:08 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 5eb535f..bcefdab 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,14 @@
2008-09-20 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 1f38b52..24693c8 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 e056123..c1828e6 100644
--- a/lisp/org-remember.el
+++ b/lisp/org-remember.el
@@ -301,13 +301,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 297a410..cdbe7bb 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -7016,7 +7016,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] 17+ messages in thread
* [PATCH 3/9] Show durations of clocked times in timeline
2008-09-20 21:08 [PATCH 0/9] Update my last patchset James TD Smith
2008-09-20 21:08 ` [PATCH 1/9] Some improvements to the modeline clock display James TD Smith
2008-09-20 21:08 ` [PATCH 2/9] Fix X clipboard handling in emacs21 James TD Smith
@ 2008-09-20 21:08 ` James TD Smith
2008-09-20 21:09 ` [PATCH 4/9] Fix link display in imenus and the refile interface James TD Smith
` (6 subsequent siblings)
9 siblings, 0 replies; 17+ messages in thread
From: James TD Smith @ 2008-09-20 21:08 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 bcefdab..3896ddf 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
2008-09-20 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 d1abcce..f13002e 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -3337,7 +3337,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
@@ -3353,10 +3353,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
@@ -3365,7 +3366,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] 17+ messages in thread
* [PATCH 4/9] Fix link display in imenus and the refile interface
2008-09-20 21:08 [PATCH 0/9] Update my last patchset James TD Smith
` (2 preceding siblings ...)
2008-09-20 21:08 ` [PATCH 3/9] Show durations of clocked times in timeline James TD Smith
@ 2008-09-20 21:09 ` James TD Smith
2008-09-21 6:25 ` Carsten Dominik
2008-09-20 21:09 ` [PATCH 5/9] Fix note insertion in entries with drawers James TD Smith
` (5 subsequent siblings)
9 siblings, 1 reply; 17+ messages in thread
From: James TD Smith @ 2008-09-20 21:09 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 3896ddf..b52700d 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,9 @@
2008-09-20 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 cdbe7bb..99b62d0 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -7866,7 +7866,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)))))
@@ -14673,6 +14676,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] 17+ messages in thread
* [PATCH 5/9] Fix note insertion in entries with drawers.
2008-09-20 21:08 [PATCH 0/9] Update my last patchset James TD Smith
` (3 preceding siblings ...)
2008-09-20 21:09 ` [PATCH 4/9] Fix link display in imenus and the refile interface James TD Smith
@ 2008-09-20 21:09 ` James TD Smith
2008-10-16 4:50 ` Carsten Dominik
2008-09-20 21:09 ` [PATCH 6/9] Add some functions for handling checklists James TD Smith
` (4 subsequent siblings)
9 siblings, 1 reply; 17+ messages in thread
From: James TD Smith @ 2008-09-20 21:09 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 | 41 +++++++++++++++++++++++------------------
2 files changed, 25 insertions(+), 18 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b52700d..1753881 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 99b62d0..10c2cdc 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -9038,7 +9038,7 @@ The auto-repeater uses this.")
"Add a note to the current entry.
This is done in the same way as adding a state change note."
(interactive)
- (org-add-log-setup 'note nil t nil))
+ (org-add-log-setup 'note nil 'findpos nil))
(defun org-add-log-setup (&optional purpose state findpos how &optional extra)
"Set up the post command hook to take a note.
@@ -9047,23 +9047,28 @@ 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.
HOW is an indicator what kind of note should be created.
EXTRA is additional text that will be inserted into the notes buffer."
- (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
- org-log-note-extra extra)
- (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)
+ (while (re-search-forward
+ (concat "\\(" org-drawer-regexp "\\|" org-property-end-re "\\)")
+ (point-max) t) (forward-line))
+ (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
+ org-log-note-extra extra)
+ (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] 17+ messages in thread
* [PATCH 6/9] Add some functions for handling checklists.
2008-09-20 21:08 [PATCH 0/9] Update my last patchset James TD Smith
` (4 preceding siblings ...)
2008-09-20 21:09 ` [PATCH 5/9] Fix note insertion in entries with drawers James TD Smith
@ 2008-09-20 21:09 ` James TD Smith
2008-09-20 21:09 ` [PATCH 7/9] Add some new interaction between remember and clocked tasks James TD Smith
` (3 subsequent siblings)
9 siblings, 0 replies; 17+ messages in thread
From: James TD Smith @ 2008-09-20 21:09 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 c49e4b4..195f2b3 100644
--- a/contrib/ChangeLog
+++ b/contrib/ChangeLog
@@ -1,3 +1,7 @@
+2008-09-20 James TD Smith <ahktenzero@mohorovi.cc>
+
+ * lisp/org-checklist.el: Add various checklist handling functions
+
2008-09-02 Carsten Dominik <dominik@science.uva.nl>
* lisp/org-mairix.el: Update to version 0.5.
@@ -12,6 +16,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] 17+ messages in thread
* [PATCH 7/9] Add some new interaction between remember and clocked tasks
2008-09-20 21:08 [PATCH 0/9] Update my last patchset James TD Smith
` (5 preceding siblings ...)
2008-09-20 21:09 ` [PATCH 6/9] Add some functions for handling checklists James TD Smith
@ 2008-09-20 21:09 ` James TD Smith
2008-09-20 21:09 ` [PATCH 8/9] Add a % expansion for inserting properties in remember buffers James TD Smith
` (2 subsequent siblings)
9 siblings, 0 replies; 17+ messages in thread
From: James TD Smith @ 2008-09-20 21:09 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 | 5 +++++
lisp/org-remember.el | 38 ++++++++++++++++++++++++++++++++++----
2 files changed, 39 insertions(+), 4 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 1753881..0b40a6e 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,10 @@
2008-09-20 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
diff --git a/lisp/org-remember.el b/lisp/org-remember.el
index c1828e6..5a2c69b 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.
@@ -354,6 +358,13 @@ 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-inhibit-startup t)
org-time-was-given org-end-time-was-given x
@@ -363,6 +374,21 @@ to be run from that hook to function properly."
(setq file (funcall file)))
(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))
@@ -382,9 +408,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
@@ -393,8 +424,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] 17+ messages in thread
* [PATCH 8/9] Add a % expansion for inserting properties in remember buffers.
2008-09-20 21:08 [PATCH 0/9] Update my last patchset James TD Smith
` (6 preceding siblings ...)
2008-09-20 21:09 ` [PATCH 7/9] Add some new interaction between remember and clocked tasks James TD Smith
@ 2008-09-20 21:09 ` James TD Smith
2008-09-20 21:09 ` [PATCH 9/9] Some bugfixes for org-plot James TD Smith
2008-09-21 4:48 ` [PATCH 0/9] Update my last patchset Carsten Dominik
9 siblings, 0 replies; 17+ messages in thread
From: James TD Smith @ 2008-09-20 21:09 UTC (permalink / raw
To: emacs-orgmode
---
lisp/ChangeLog | 3 +++
lisp/org-remember.el | 19 +++++++++++++++++--
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0b40a6e..07872eb 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
2008-09-20 James TD Smith <ahktenzero@mohorovi.cc>
+ * org-remember.el (org-remember-apply-template): Add a new
+ expansion for adding properties to remember items.
+
* 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
diff --git a/lisp/org-remember.el b/lisp/org-remember.el
index 5a2c69b..0b435e0 100644
--- a/lisp/org-remember.el
+++ b/lisp/org-remember.el
@@ -137,7 +137,7 @@ Furthermore, the following %-escapes will be replaced with content:
%^G prompt for tags, with completion all tags in all agenda files
%k currently clocked task
%K link to currently clocked task
-
+ %^{prop}p Prompt the user for a value for property `prop'
%: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
@@ -468,7 +468,7 @@ to be run from that hook to function properly."
(org-set-local 'org-remember-default-headline headline))
;; Interactive template entries
(goto-char (point-min))
- (while (re-search-forward "%^\\({\\([^}]*\\)}\\)?\\([gGtTuUCL]\\)?" nil t)
+ (while (re-search-forward "%^\\({\\([^}]*\\)}\\)?\\([gGtTuUCLp]\\)?" nil t)
(setq char (if (match-end 3) (match-string 3))
prompt (if (match-end 2) (match-string 2)))
(goto-char (match-beginning 0))
@@ -513,6 +513,21 @@ to be run from that hook to function properly."
(car clipboards)
'(clipboards . 1)
(car clipboards))))))
+ ((equal char "p")
+ (let* ((prop (substring-no-properties prompt))
+ (allowed (with-current-buffer
+ (get-buffer (file-name-nondirectory file))
+ (org-property-get-allowed-values nil prop 'table)))
+ (existing (with-current-buffer
+ (get-buffer (file-name-nondirectory file))
+ (mapcar 'list (org-property-values prop))))
+ (propprompt (concat "Value for " prop ": "))
+ (val (if allowed
+ (org-completing-read propprompt allowed nil
+ 'req-match)
+ (org-completing-read propprompt existing nil nil
+ "" nil ""))))
+ (org-set-property prop val)))
(char
;; These are the date/time related ones
(setq org-time-was-given (equal (upcase char) char))
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 9/9] Some bugfixes for org-plot.
2008-09-20 21:08 [PATCH 0/9] Update my last patchset James TD Smith
` (7 preceding siblings ...)
2008-09-20 21:09 ` [PATCH 8/9] Add a % expansion for inserting properties in remember buffers James TD Smith
@ 2008-09-20 21:09 ` James TD Smith
2008-09-21 4:48 ` [PATCH 0/9] Update my last patchset Carsten Dominik
9 siblings, 0 replies; 17+ messages in thread
From: James TD Smith @ 2008-09-20 21:09 UTC (permalink / raw
To: emacs-orgmode
* Handle tables where the first line is an hline.
* Put commas at the end of the line in generated scripts
---
lisp/org-plot.el | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index 874790c..f8e268d 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -218,7 +218,7 @@ NUM-COLS controls the number of columns plotted in a 2-d plot."
(format "\"%s\" %d" (cdr pair) (car pair)))
y-labels ", "))))
(case type ;; plot command
- ('2d (dotimes (col num-cols)
+ ('2d (dotimes (col num-cols)
(unless (and (equal type '2d)
(or (and ind (equal (+ 1 col) ind))
(and deps (not (member (+ 1 col) deps)))))
@@ -239,11 +239,11 @@ NUM-COLS controls the number of columns plotted in a 2-d plot."
(setq plot-lines (list (format "'%s' with %s title ''"
data-file with)))))
(add-to-script
- (concat plot-cmd " " (mapconcat 'identity (reverse plot-lines) "\\\n ,")))
+ (concat plot-cmd " " (mapconcat 'identity (reverse plot-lines) ",\\\n ")))
script)))
;;-----------------------------------------------------------------------------
-;; facad functions
+;; facade functions
;;;###autoload
(defun org-plot/gnuplot (&optional params)
"Plot table using gnuplot. Gnuplot options can be specified with PARAMS.
@@ -255,11 +255,11 @@ line directly before or after the table."
(delete-other-windows)
(when (get-buffer "*gnuplot*") ;; reset *gnuplot* if it already running
(save-excursion
- (set-buffer "*gnuplot*") (goto-char (point-max))
+ (set-buffer "*gnuplot*") (goto-char (point-max))
(gnuplot-delchar-or-maybe-eof nil)))
(org-plot/goto-nearest-table)
;; set default options
- (mapc
+ (mapc
(lambda (pair)
(unless (plist-member params (car pair))
(setf params (plist-put params (car pair) (cdr pair)))))
@@ -267,7 +267,8 @@ line directly before or after the table."
;; collect table and table information
(let* ((data-file (make-temp-file "org-plot"))
(table (org-table-to-lisp))
- (num-cols (length (first table))))
+ (num-cols (length (if (eq (first table) 'hline) (second table)
+ (first table)))))
(while (equal 'hline (first table)) (setf table (cdr table)))
(when (equal (second table) 'hline)
(setf params (plist-put params :labels (first table))) ;; headers to labels
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 0/9] Update my last patchset
2008-09-20 21:08 [PATCH 0/9] Update my last patchset James TD Smith
` (8 preceding siblings ...)
2008-09-20 21:09 ` [PATCH 9/9] Some bugfixes for org-plot James TD Smith
@ 2008-09-21 4:48 ` Carsten Dominik
2008-09-21 12:21 ` James TD Smith
9 siblings, 1 reply; 17+ messages in thread
From: Carsten Dominik @ 2008-09-21 4:48 UTC (permalink / raw
To: James TD Smith; +Cc: emacs-orgmode
Hi James,
bummer, I *did* forget about the previous patch series, thanks so much
for bringing it up again.
I am frusrated with my git skills. I did put all your patches into a
separate mailbox and then did git-am, which failed miserably. Any
idea what I might be doing wrong?
I can apply the patches all one by one, sort-off by hand, but I don't
like it.
- Carsten
On Sep 20, 2008, at 11:08 PM, James TD Smith wrote:
> I've updated my last patchset so it applies to the current version,
> and added a
> few more patches I have written since then.
>
> The following series implements...
>
> ---
>
> James TD Smith (9):
> Some bugfixes for org-plot.
> Add a % expansion for inserting properties in remember buffers.
> Add some new interaction between remember and clocked tasks
> Add some functions for handling checklists.
> Fix note insertion in entries with drawers.
> Fix link display in imenus and the refile interface
> Show durations of clocked times in timeline
> Fix X clipboard handling in emacs21
> Some improvements to the modeline clock display
>
>
> contrib/ChangeLog | 5 ++
> contrib/lisp/org-checklist.el | 110 ++++++++++++++++++++++++++++++++
> +++++++++
> lisp/ChangeLog | 55 ++++++++++++++-------
> lisp/org-agenda.el | 14 +++--
> lisp/org-clock.el | 36 ++++++++++---
> lisp/org-compat.el | 13 ++++-
> lisp/org-plot.el | 13 +++--
> lisp/org-remember.el | 67 +++++++++++++++++++++----
> lisp/org.el | 51 ++++++++++++-------
> 9 files changed, 292 insertions(+), 72 deletions(-)
> create mode 100644 contrib/lisp/org-checklist.el
>
> --
> |-<James TD Smith>-<email/ahktenzero@mohorovi.cc>-|
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 4/9] Fix link display in imenus and the refile interface
2008-09-20 21:09 ` [PATCH 4/9] Fix link display in imenus and the refile interface James TD Smith
@ 2008-09-21 6:25 ` Carsten Dominik
2008-09-21 14:31 ` [PATCH] " James TD Smith
0 siblings, 1 reply; 17+ messages in thread
From: Carsten Dominik @ 2008-09-21 6:25 UTC (permalink / raw
To: James TD Smith; +Cc: org-mode list
Hi James,
I am not accepting this particular patch in its current form. It does
not work for links to do not have a description part. Also, it relies
on replace-regexp-in-string, which does not exist in XEmacs I believe.
I am still thinking about %< patch (patch 7/9), need to test is a bit.
All the rest goes in for 6.08, thank you very much.
- Carsten
On Sep 20, 2008, at 11:09 PM, James TD Smith wrote:
> 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 3896ddf..b52700d 100755
> --- a/lisp/ChangeLog
> +++ b/lisp/ChangeLog
> @@ -1,5 +1,9 @@
> 2008-09-20 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 cdbe7bb..99b62d0 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -7866,7 +7866,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)))))
> @@ -14673,6 +14676,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))
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 0/9] Update my last patchset
2008-09-21 4:48 ` [PATCH 0/9] Update my last patchset Carsten Dominik
@ 2008-09-21 12:21 ` James TD Smith
2008-09-21 12:43 ` Carsten Dominik
0 siblings, 1 reply; 17+ messages in thread
From: James TD Smith @ 2008-09-21 12:21 UTC (permalink / raw
To: Carsten Dominik; +Cc: emacs-orgmode
On 2008-09-21 06:48:58(+0200), Carsten Dominik wrote:
> Hi James,
>
> bummer, I *did* forget about the previous patch series, thanks so much
> for bringing it up again.
I had intended to remind you when you got back, but forgot about it.
> I am frusrated with my git skills. I did put all your patches into a
> separate mailbox and then did git-am, which failed miserably. Any
> idea what I might be doing wrong?
>
> I can apply the patches all one by one, sort-off by hand, but I don't
> like it.
I just tried applying the mailed patches to a fresh clone of the org repo, and
git-am worked fine, so the patches are OK.
After some googling, it appears Apple Mail has used a proprietary format for
storing mail since version 2, which git-am cannot read.
There are instructions to get it to export messages to an mbox file, which git
am will read, here:
http://www.macosxhints.com/article.php?story=20060706201156481
Hope this helps
James
--
|-<James TD Smith>-<email/ahktenzero@mohorovi.cc>-|
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 0/9] Update my last patchset
2008-09-21 12:21 ` James TD Smith
@ 2008-09-21 12:43 ` Carsten Dominik
0 siblings, 0 replies; 17+ messages in thread
From: Carsten Dominik @ 2008-09-21 12:43 UTC (permalink / raw
To: James TD Smith; +Cc: emacs-orgmode
Awesome, thanks, this should do the trick. Next time.
Thanks.
- Carsten
On Sep 21, 2008, at 2:21 PM, James TD Smith wrote:
> On 2008-09-21 06:48:58(+0200), Carsten Dominik wrote:
>> Hi James,
>>
>> bummer, I *did* forget about the previous patch series, thanks so
>> much
>> for bringing it up again.
>
> I had intended to remind you when you got back, but forgot about it.
>
>> I am frusrated with my git skills. I did put all your patches into a
>> separate mailbox and then did git-am, which failed miserably. Any
>> idea what I might be doing wrong?
>>
>> I can apply the patches all one by one, sort-off by hand, but I don't
>> like it.
>
> I just tried applying the mailed patches to a fresh clone of the org
> repo, and
> git-am worked fine, so the patches are OK.
>
> After some googling, it appears Apple Mail has used a proprietary
> format for
> storing mail since version 2, which git-am cannot read.
>
> There are instructions to get it to export messages to an mbox file,
> which git
> am will read, here:
> http://www.macosxhints.com/article.php?story=20060706201156481
>
> Hope this helps
>
> James
>
> --
> |-<James TD Smith>-<email/ahktenzero@mohorovi.cc>-|
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH] Fix link display in imenus and the refile interface
2008-09-21 6:25 ` Carsten Dominik
@ 2008-09-21 14:31 ` James TD Smith
2008-09-21 19:40 ` Carsten Dominik
0 siblings, 1 reply; 17+ messages in thread
From: James TD Smith @ 2008-09-21 14:31 UTC (permalink / raw
To: emacs-orgmode
I've fixed both problems.
Replace links with their descriptions in when generating the items for imenus
and the refile interface. For links with no description the link target is used
instead.
---
lisp/ChangeLog | 6 ++++++
lisp/org-compat.el | 2 +-
lisp/org.el | 16 ++++++++++++++--
3 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 56e290e..9fe09d1 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2008-09-21 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
+
2008-09-20 James TD Smith <ahktenzero@mohorovi.cc>
* org-remember.el (org-remember-apply-template): Add a new
diff --git a/lisp/org-compat.el b/lisp/org-compat.el
index b4d2660..dc8d9cb 100644
--- a/lisp/org-compat.el
+++ b/lisp/org-compat.el
@@ -261,7 +261,7 @@ that can be added."
(if (featurep 'xemacs)
(add-text-properties 0 (length string) properties string)
(apply 'propertize string properties)))
-
+
(provide 'org-compat)
;; arch-tag: a0a0579f-e68c-4bdf-9e55-93768b846bbe
diff --git a/lisp/org.el b/lisp/org.el
index b1f6829..74a2a11 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -7866,7 +7866,7 @@ 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 (org-link-display-format (match-string 4))
re (concat "^" (regexp-quote
(buffer-substring (match-beginning 1)
(match-end 4)))))
@@ -14676,7 +14676,8 @@ Show the heading too, if it is currently invisible."
(setq level (org-reduced-level (funcall outline-level)))
(when (<= level n)
(looking-at org-complex-heading-regexp)
- (setq head (org-match-string-no-properties 4)
+ (setq head (org-link-display-format
+ (org-match-string-no-properties 4))
m (org-imenu-new-marker))
(org-add-props head nil 'org-imenu-marker m 'org-imenu t)
(if (>= level last-level)
@@ -14693,6 +14694,17 @@ Show the heading too, if it is currently invisible."
(if (eq major-mode 'org-mode)
(org-show-context 'org-goto))))))
+(defun org-link-display-format (link)
+ "Replace a link with either the description, or the link target
+if no description is present"
+ (save-match-data
+ (if (string-match org-bracket-link-analytic-regexp link)
+ (replace-match (or (match-string 5 link)
+ (concat (match-string 1 link)
+ (match-string 3 link)))
+ nil nil link)
+ link)))
+
;; Speedbar support
(defvar org-speedbar-restriction-lock-overlay (org-make-overlay 1 1)
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH] Fix link display in imenus and the refile interface
2008-09-21 14:31 ` [PATCH] " James TD Smith
@ 2008-09-21 19:40 ` Carsten Dominik
0 siblings, 0 replies; 17+ messages in thread
From: Carsten Dominik @ 2008-09-21 19:40 UTC (permalink / raw
To: James TD Smith; +Cc: emacs-orgmode
Hi James,
I am accepting this new version, thanks.
- Carsten
On Sep 21, 2008, at 4:31 PM, James TD Smith wrote:
> I've fixed both problems.
>
> Replace links with their descriptions in when generating the items
> for imenus
> and the refile interface. For links with no description the link
> target is used
> instead.
> ---
>
> lisp/ChangeLog | 6 ++++++
> lisp/org-compat.el | 2 +-
> lisp/org.el | 16 ++++++++++++++--
> 3 files changed, 21 insertions(+), 3 deletions(-)
>
> diff --git a/lisp/ChangeLog b/lisp/ChangeLog
> index 56e290e..9fe09d1 100755
> --- a/lisp/ChangeLog
> +++ b/lisp/ChangeLog
> @@ -1,3 +1,9 @@
> +2008-09-21 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
> +
> 2008-09-20 James TD Smith <ahktenzero@mohorovi.cc>
>
> * org-remember.el (org-remember-apply-template): Add a new
> diff --git a/lisp/org-compat.el b/lisp/org-compat.el
> index b4d2660..dc8d9cb 100644
> --- a/lisp/org-compat.el
> +++ b/lisp/org-compat.el
> @@ -261,7 +261,7 @@ that can be added."
> (if (featurep 'xemacs)
> (add-text-properties 0 (length string) properties string)
> (apply 'propertize string properties)))
> -
> +
> (provide 'org-compat)
>
> ;; arch-tag: a0a0579f-e68c-4bdf-9e55-93768b846bbe
> diff --git a/lisp/org.el b/lisp/org.el
> index b1f6829..74a2a11 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -7866,7 +7866,7 @@ 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 (org-link-display-format (match-string 4))
> re (concat "^" (regexp-quote
> (buffer-substring (match-beginning 1)
> (match-end 4)))))
> @@ -14676,7 +14676,8 @@ Show the heading too, if it is currently
> invisible."
> (setq level (org-reduced-level (funcall outline-level)))
> (when (<= level n)
> (looking-at org-complex-heading-regexp)
> - (setq head (org-match-string-no-properties 4)
> + (setq head (org-link-display-format
> + (org-match-string-no-properties 4))
> m (org-imenu-new-marker))
> (org-add-props head nil 'org-imenu-marker m 'org-imenu t)
> (if (>= level last-level)
> @@ -14693,6 +14694,17 @@ Show the heading too, if it is currently
> invisible."
> (if (eq major-mode 'org-mode)
> (org-show-context 'org-goto))))))
>
> +(defun org-link-display-format (link)
> + "Replace a link with either the description, or the link target
> +if no description is present"
> + (save-match-data
> + (if (string-match org-bracket-link-analytic-regexp link)
> + (replace-match (or (match-string 5 link)
> + (concat (match-string 1 link)
> + (match-string 3 link)))
> + nil nil link)
> + link)))
> +
> ;; Speedbar support
>
> (defvar org-speedbar-restriction-lock-overlay (org-make-overlay 1 1)
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 5/9] Fix note insertion in entries with drawers.
2008-09-20 21:09 ` [PATCH 5/9] Fix note insertion in entries with drawers James TD Smith
@ 2008-10-16 4:50 ` Carsten Dominik
0 siblings, 0 replies; 17+ messages in thread
From: Carsten Dominik @ 2008-10-16 4:50 UTC (permalink / raw
To: James TD Smith; +Cc: emacs-orgmode
Hi JD,
I have now made this change configurable, please configure
the new option `org-log-state-notes-insert-after-drawers'
if you want your notes after the drawers. Default is the old
behavior to insert before the drawers (I got some requests for this).
- Carsten
On Sep 20, 2008, at 11:09 PM, James TD Smith wrote:
> 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 | 41 +++++++++++++++++++++++------------------
> 2 files changed, 25 insertions(+), 18 deletions(-)
>
> diff --git a/lisp/ChangeLog b/lisp/ChangeLog
> index b52700d..1753881 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 99b62d0..10c2cdc 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -9038,7 +9038,7 @@ The auto-repeater uses this.")
> "Add a note to the current entry.
> This is done in the same way as adding a state change note."
> (interactive)
> - (org-add-log-setup 'note nil t nil))
> + (org-add-log-setup 'note nil 'findpos nil))
>
> (defun org-add-log-setup (&optional purpose state findpos how
> &optional extra)
> "Set up the post command hook to take a note.
> @@ -9047,23 +9047,28 @@ 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.
> HOW is an indicator what kind of note should be created.
> EXTRA is additional text that will be inserted into the notes buffer."
> - (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
> - org-log-note-extra extra)
> - (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)
> + (while (re-search-forward
> + (concat "\\(" org-drawer-regexp "\\|" org-property-end-re "\\)")
> + (point-max) t) (forward-line))
> + (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
> + org-log-note-extra extra)
> + (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."
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2008-10-16 4:50 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-20 21:08 [PATCH 0/9] Update my last patchset James TD Smith
2008-09-20 21:08 ` [PATCH 1/9] Some improvements to the modeline clock display James TD Smith
2008-09-20 21:08 ` [PATCH 2/9] Fix X clipboard handling in emacs21 James TD Smith
2008-09-20 21:08 ` [PATCH 3/9] Show durations of clocked times in timeline James TD Smith
2008-09-20 21:09 ` [PATCH 4/9] Fix link display in imenus and the refile interface James TD Smith
2008-09-21 6:25 ` Carsten Dominik
2008-09-21 14:31 ` [PATCH] " James TD Smith
2008-09-21 19:40 ` Carsten Dominik
2008-09-20 21:09 ` [PATCH 5/9] Fix note insertion in entries with drawers James TD Smith
2008-10-16 4:50 ` Carsten Dominik
2008-09-20 21:09 ` [PATCH 6/9] Add some functions for handling checklists James TD Smith
2008-09-20 21:09 ` [PATCH 7/9] Add some new interaction between remember and clocked tasks James TD Smith
2008-09-20 21:09 ` [PATCH 8/9] Add a % expansion for inserting properties in remember buffers James TD Smith
2008-09-20 21:09 ` [PATCH 9/9] Some bugfixes for org-plot James TD Smith
2008-09-21 4:48 ` [PATCH 0/9] Update my last patchset Carsten Dominik
2008-09-21 12:21 ` James TD Smith
2008-09-21 12:43 ` Carsten Dominik
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.