From 3a62d5257076cd8eff470220917f4fcb8a88afbb Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Sun, 25 Apr 2010 23:52:51 +0200 Subject: [PATCH 01/12] Redo the agenda after refiling --- lisp/ChangeLog | 8 ++++++++ lisp/org-agenda.el | 10 +++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 01f9646c7..6e0b62426 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,13 @@ 2010-04-25 Carsten Dominik + * org-agenda.el (org-agenda-refile): New optional argument + NO-UPDATE. + (org-agenda-refile): Call `org-agenda-redo' unless NO-UPDATE + is set. + (org-agenda-bulk-action): Call the refile command with updates + suppressed - but arrange for `org-agenda-redo' to be called at + the end. + * org.el (org-mode): Make table mapping quiet. (org-table-map-tables): New optional argument QUIETLY. diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index c68038da3..d8039163f 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -6198,7 +6198,7 @@ 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)))))) -(defun org-agenda-refile (&optional goto rfloc) +(defun org-agenda-refile (&optional goto rfloc no-update) "Refile the item at point." (interactive "P") (if (equal goto '(16)) @@ -6217,7 +6217,8 @@ If this information is not given, the function uses the tree at point." (widen) (goto-char marker) (org-remove-subtree-entries-from-agenda) - (org-refile goto buffer rfloc))))))) + (org-refile goto buffer rfloc))))) + (unless no-update (org-agenda-redo)))) (defun org-agenda-open-link (&optional arg) "Follow the link in the current line, if any. @@ -7426,6 +7427,7 @@ The prefix arg is passed through to the command if possible." (let* ((action (read-char-exclusive)) (org-log-refile (if org-log-refile 'time nil)) (entries (reverse org-agenda-bulk-marked-entries)) + redo-at-end cmd rfloc state e tag pos (cnt 0) (cntskip 0)) (cond ((equal action ?$) @@ -7445,7 +7447,8 @@ The prefix arg is passed through to the command if possible." (find-buffer-visiting (nth 1 rfloc)) (error "This should not happen")))) - (setq cmd (list 'org-agenda-refile nil (list 'quote rfloc)))) + (setq cmd (list 'org-agenda-refile nil (list 'quote rfloc) t) + redo-at-end t)) ((equal action ?t) (setq state (org-icompleting-read @@ -7506,6 +7509,7 @@ The prefix arg is passed through to the command if possible." (setq cnt (1+ cnt)))) (setq org-agenda-bulk-marked-entries nil) (org-agenda-bulk-remove-all-marks) + (when redo-at-end (org-agenda-redo)) (message "Acted on %d entries%s" cnt (if (= cntskip 0) From 5fd8d0ea333a451be4e0af4667be58e849c36af1 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Sun, 25 Apr 2010 23:56:37 +0200 Subject: [PATCH 02/12] Fix docstring of `org-export-format-drawer-function' Patch by Diego F. S. Ramos. --- lisp/ChangeLog | 3 +++ lisp/org-exp.el | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6e0b62426..3d43cc17a 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2010-04-25 Carsten Dominik + * org-exp.el (org-export-format-drawer-function): Fix + docstring. + * org-agenda.el (org-agenda-refile): New optional argument NO-UPDATE. (org-agenda-refile): Call `org-agenda-redo' unless NO-UPDATE diff --git a/lisp/org-exp.el b/lisp/org-exp.el index 44bde65bd..f467d571e 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -1343,9 +1343,9 @@ the current file." (defvar org-export-format-drawer-function nil "Function to be called to format the contents of a drawer. The function must accept three parameters: - BACKEND one of the symbols html, docbook, latex, ascii, xoxo NAME the drawer name, like \"PROPERTIES\" CONTENT the content of the drawer. + BACKEND one of the symbols html, docbook, latex, ascii, xoxo The function should return the text to be inserted into the buffer. If this is nil, `org-export-format-drawer' is used as a default.") From 5faad3ce87aa43fcbbed26f33474092e792f6a5e Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Mon, 26 Apr 2010 00:02:49 +0200 Subject: [PATCH 03/12] Make sure clock mode line display is removed when there is not clock Patch by Sebastian Rose. --- lisp/ChangeLog | 3 +++ lisp/org-clock.el | 14 ++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3d43cc17a..9bcbbc67f 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2010-04-25 Carsten Dominik + * org-clock.el (org-clock-cancel, org-clock-out): Make sure + the modeline display is removed. + * org-exp.el (org-export-format-drawer-function): Fix docstring. diff --git a/lisp/org-clock.el b/lisp/org-clock.el index c8bf6cc8c..07c1083ce 100755 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -1194,8 +1194,11 @@ line and position cursor in that line." If there is no running clock, throw an error, unless FAIL-QUIETLY is set." (interactive) (catch 'exit - (if (not (org-clocking-p)) - (if fail-quietly (throw 'exit t) (error "No active clock"))) + (when (not (org-clocking-p)) + (setq global-mode-string + (delq 'org-mode-line-string global-mode-string)) + (force-mode-line-update) + (if fail-quietly (throw 'exit t) (error "No active clock"))) (let (ts te s h m remove) (save-excursion ; Do not replace this with `with-current-buffer'. (with-no-warnings (set-buffer (org-clocking-buffer))) @@ -1263,8 +1266,11 @@ If there is no running clock, throw an error, unless FAIL-QUIETLY is set." (defun org-clock-cancel () "Cancel the running clock be removing the start timestamp." (interactive) - (if (not (org-clocking-p)) - (error "No active clock")) + (when (not (org-clocking-p)) + (setq global-mode-string + (delq 'org-mode-line-string global-mode-string)) + (force-mode-line-update) + (error "No active clock")) (save-excursion ; Do not replace this with `with-current-buffer'. (with-no-warnings (set-buffer (org-clocking-buffer))) (goto-char org-clock-marker) From 4dc0e6062d4bfa9368dc8c358401aa0e55b4c869 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Mon, 26 Apr 2010 06:45:32 +0200 Subject: [PATCH 04/12] Remove .dir-locals.el --- .dir-locals.el | 1 - 1 file changed, 1 deletion(-) delete mode 120000 .dir-locals.el diff --git a/.dir-locals.el b/.dir-locals.el deleted file mode 120000 index 2c9dc3539..000000000 --- a/.dir-locals.el +++ /dev/null @@ -1 +0,0 @@ -.dir-settings.el \ No newline at end of file From de0903ba9fd5b68d5170181f913c8cc32bbce335 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Mon, 26 Apr 2010 06:46:16 +0200 Subject: [PATCH 05/12] Added a symlink .dir-locals.el --- .dir-locals.el | 1 + 1 file changed, 1 insertion(+) create mode 120000 .dir-locals.el diff --git a/.dir-locals.el b/.dir-locals.el new file mode 120000 index 000000000..2c9dc3539 --- /dev/null +++ b/.dir-locals.el @@ -0,0 +1 @@ +.dir-settings.el \ No newline at end of file From 4a03e44858d9a44dbde9e41abc4b8c23d6ff66f5 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Mon, 26 Apr 2010 06:58:21 +0200 Subject: [PATCH 06/12] Turn off indent-tabs-mode when org-indent-mode is on This makes for peter (if still imperfect) tag alignment. Patch by Jason Dunsmore --- lisp/ChangeLog | 5 +++++ lisp/org-indent.el | 1 + 2 files changed, 6 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9bcbbc67f..134739392 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2010-04-26 Carsten Dominik + + * org-indent.el (org-indent-mode): Turn off `indent-tabs-mode' + which messes up alignment of tags. + 2010-04-25 Carsten Dominik * org-clock.el (org-clock-cancel, org-clock-out): Make sure diff --git a/lisp/org-indent.el b/lisp/org-indent.el index c8754725a..1d1075431 100644 --- a/lisp/org-indent.el +++ b/lisp/org-indent.el @@ -131,6 +131,7 @@ FIXME: How to update when broken?" (setq org-indent-mode nil) (if org-indent-mode (progn + (org-set-local 'indent-tabs-mode nil) (or org-indent-strings (org-indent-initialize)) (when org-indent-mode-turns-off-org-adapt-indentation (org-set-local 'org-adapt-indentation nil)) From 13fbf75a149e67cc10404285608f815fc8ddf1a4 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Mon, 26 Apr 2010 06:59:08 +0200 Subject: [PATCH 07/12] Fix a typo --- lisp/org-list.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org-list.el b/lisp/org-list.el index 212d17211..c0b6125dd 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -224,7 +224,7 @@ of `org-plain-list-ordered-item-terminator'." (< (point) (match-end 0)))) (defun org-in-item-p () - "It the cursor inside a plain list item. + "Is the cursor inside a plain list item. Does not have to be the first line." (save-excursion (condition-case nil From 35204940d2cf7b41f27c0f0d74c0a1b1c6beee56 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Mon, 26 Apr 2010 11:06:10 +0200 Subject: [PATCH 08/12] Document windmove work-around --- doc/ChangeLog | 4 ++++ doc/org.texi | 13 ++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 41ff00b29..7c5aededa 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +2010-04-26 Carsten Dominik + + * org.texi (Conflicts): Document new work-around for windmove.el. + 2010-04-23 Carsten Dominik * org.texi (Plain lists): Document the commands to promote/demote diff --git a/doc/org.texi b/doc/org.texi index 527ce719a..2538824db 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -11371,7 +11371,18 @@ fixed this problem: @item @file{windmove.el} by Hovav Shacham @cindex @file{windmove.el} This package also uses the @kbd{S-} keys, so everything written -in the paragraph above about CUA mode also applies here. +in the paragraph above about CUA mode also applies here. If you want make +the windmove function active in locations where Org-mode does not have +special functionality on @kbd{S-@key{cursor}}, add this to your +configuration: + +@lisp +;; Make windmove work in org-mode: +(add-hook 'org-shiftup-final-hook 'windmove-up) +(add-hook 'org-shiftleft-final-hook 'windmove-left) +(add-hook 'org-shiftdown-final-hook 'windmove-down) +(add-hook 'org-shiftright-final-hook 'windmove-right) +@end lisp @item @file{viper.el} by Michael Kifer @cindex @file{viper.el} From b82652d90c08d31e9e765cd8fd5323ef665d2dc3 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Mon, 26 Apr 2010 12:25:08 +0200 Subject: [PATCH 09/12] Implement offsets for ordered lists 1. [@start:12] will star a lit a number 12 --- lisp/ChangeLog | 6 ++++++ lisp/org-html.el | 12 ++++++++++-- lisp/org-latex.el | 24 +++++++++++++++++------- 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 134739392..1535958c5 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,11 @@ 2010-04-26 Carsten Dominik + * org-latex.el (org-export-latex-lists): Accept ordered list + item offset cookie. + + * org-html.el (org-export-as-html): Accept ordered list + item offset cookie. + * org-indent.el (org-indent-mode): Turn off `indent-tabs-mode' which messes up alignment of tags. diff --git a/lisp/org-html.el b/lisp/org-html.el index 92798d211..3ac2b18d2 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -710,7 +710,7 @@ PUB-DIR is set, use this as the publishing directory." table-buffer table-orig-buffer ind item-type starter didclose rpl path attr desc descp desc1 desc2 link - snumber fnc item-tag + snumber fnc item-tag initial-number footnotes footref-seen id-file href ) @@ -1284,7 +1284,11 @@ lang=\"%s\" xml:lang=\"%s\"> starter (if (match-beginning 2) (substring (match-string 2 line) 0 -1)) line (substring line (match-beginning 5)) + initial-number nil item-tag nil) + (if (string-match "\\`\\[@start:\\([0-9]+\\)\\][ \t]?" line) + (setq initial-number (match-string 1 line) + line (replace-match "" t t line))) (if (and starter (string-match "\\(.*?\\) ::[ \t]*" line)) (setq item-type "d" item-tag (match-string 1 line) @@ -1309,11 +1313,15 @@ lang=\"%s\" xml:lang=\"%s\"> ((and starter (or (not in-local-list) (> ind (car local-list-indent)))) + ;; check for a specified start number ;; Start new (level of) list (org-close-par-maybe) (insert (cond ((equal item-type "u") "
    \n
  • \n") - ((equal item-type "o") "
      \n
    1. \n") + ((equal item-type "o") + (if initial-number + (format "
        \n
      1. \n" initial-number) + "
          \n
        1. \n")) ((equal item-type "d") (format "
          \n
          %s
          \n" item-tag)))) (push item-type local-list-type) diff --git a/lisp/org-latex.el b/lisp/org-latex.el index 773ec0f4a..9850e9bcd 100644 --- a/lisp/org-latex.el +++ b/lisp/org-latex.el @@ -2166,13 +2166,23 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." (defun org-export-latex-lists () "Convert plain text lists in current buffer into LaTeX lists." - (goto-char (point-min)) - (while (re-search-forward org-list-beginning-re nil t) - (org-if-unprotected - (beginning-of-line) - (insert (org-list-to-latex (org-list-parse-list t) - org-export-latex-list-parameters)) - "\n"))) + (let (res) + (goto-char (point-min)) + (while (re-search-forward org-list-beginning-re nil t) + (org-if-unprotected + (beginning-of-line) + (setq res (org-list-to-latex (org-list-parse-list t) + org-export-latex-list-parameters)) + (while (string-match "^\\(\\\\item[ \t]+\\)\\[@start:\\([0-9]+\\)\\]" + res) + (setq res (replace-match + (concat (format "\\setcounter{enumi}{%d}" + (1- (string-to-number + (match-string 2 res)))) + "\n" + (match-string 1 res)) + t t res))) + (insert res "\n"))))) (defconst org-latex-entities '("\\!" From 3fb4f28860f3210c8228eb320c240783fefc53fb Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Mon, 26 Apr 2010 16:35:23 +0200 Subject: [PATCH 10/12] Implement list starter cookies also in Org-mode, and for ASCII export --- lisp/ChangeLog | 6 ++++++ lisp/org-ascii.el | 7 ++++++- lisp/org-list.el | 4 ++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1535958c5..2b57e66b0 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,11 @@ 2010-04-26 Carsten Dominik + * org-ascii.el (org-export-ascii-preprocess): Remove list + startcounter cookies. + + * org-list.el (org-renumber-ordered-list): Respect counter + start values. + * org-latex.el (org-export-latex-lists): Accept ordered list item offset cookie. diff --git a/lisp/org-ascii.el b/lisp/org-ascii.el index 02578cce7..7ed1f0e76 100644 --- a/lisp/org-ascii.el +++ b/lisp/org-ascii.el @@ -565,7 +565,12 @@ publishing directory." (goto-char (point-min)) (while (re-search-forward "<<]*\\)>>>?\\([ \t]*\\)" nil t) (org-if-unprotected-at (match-beginning 1) - (replace-match "\\1\\2")))) + (replace-match "\\1\\2"))) + ;; Remove list start counters + (goto-char (point-min)) + (while (re-search-forward "\\[@start:[0-9]+\\] ?" nil t) + (org-if-unprotected + (replace-match "")))) (defun org-html-expand-for-ascii (line) "Handle quoted HTML for ASCII export." diff --git a/lisp/org-list.el b/lisp/org-list.el index c0b6125dd..34deff5ee 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -841,6 +841,10 @@ with something like \"1.\" or \"2)\"." (setq bobp (bobp)) (looking-at "[ \t]*[0-9]+\\([.)]\\)") (setq fmt (concat "%d" (or (match-string 1) "."))) + (save-excursion + (goto-char (match-end 0)) + (if (looking-at "[ \t]*\\[@start:\\([0-9]+\\)") + (setq n (1- (string-to-number (match-string 1)))))) (beginning-of-line 0) ;; walk forward and replace these numbers (catch 'exit From 489f41f366545c74c1c9af299863a6c05715ccd8 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Mon, 26 Apr 2010 16:41:33 +0200 Subject: [PATCH 11/12] Document counter start cookies for ordered lists --- doc/ChangeLog | 1 + doc/org.texi | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 7c5aededa..a1792b6cf 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,6 +1,7 @@ 2010-04-26 Carsten Dominik * org.texi (Conflicts): Document new work-around for windmove.el. + (Plain lists): Describe counter start cookies. 2010-04-23 Carsten Dominik diff --git a/doc/org.texi b/doc/org.texi index 2538824db..a9056e194 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -1222,7 +1222,9 @@ visually indistinguishable from true headlines. In short: even though as bullets. @item @emph{Ordered} list items start with a numeral followed by either a period or -a right parenthesis, such as @samp{1.} or @samp{1)}. +a right parenthesis, such as @samp{1.} or @samp{1)}. If you want a list to +start a different value (e.g. 20), start the text of the item with +@code{[@@start:20]}. @item @emph{Description} list items are unordered list items, and contain the separator @samp{ :: } to separate the description @emph{term} from the From a9539f449c824a0e52502a6590b2df322186be41 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Mon, 26 Apr 2010 17:12:45 +0200 Subject: [PATCH 12/12] Implement doi: links Patch by Lennart Borgman. --- doc/ChangeLog | 1 + doc/org.texi | 1 + lisp/ChangeLog | 2 ++ lisp/org.el | 7 ++++++- 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index a1792b6cf..67d570991 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -2,6 +2,7 @@ * org.texi (Conflicts): Document new work-around for windmove.el. (Plain lists): Describe counter start cookies. + (External links): Add example for a doi link. 2010-04-23 Carsten Dominik diff --git a/doc/org.texi b/doc/org.texi index a9056e194..d36f495e1 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -2806,6 +2806,7 @@ the colon. The following list shows examples for each link type. @example http://www.astro.uva.nl/~dominik @r{on the web} +doi:10.1000/182 @r{DOI for an electronic resource} file:/home/dominik/images/jupiter.jpg @r{file, absolute path} /home/dominik/images/jupiter.jpg @r{same as above} file:papers/last.pdf @r{file, relative path} diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2b57e66b0..3b97d17c8 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,7 @@ 2010-04-26 Carsten Dominik + * org.el (org-link-types, org-open-at-point): Add doi links. + * org-ascii.el (org-export-ascii-preprocess): Remove list startcounter cookies. diff --git a/lisp/org.el b/lisp/org.el index 9c2f848fa..992050418 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -4496,7 +4496,7 @@ The following commands are available: (defconst org-non-link-chars "]\t\n\r<>") (defvar org-link-types '("http" "https" "ftp" "mailto" "file" "news" - "shell" "elisp")) + "shell" "elisp" "doi")) (defvar org-link-types-re nil "Matches a link that has a url-like prefix like \"http:\"") (defvar org-link-re-with-space nil @@ -8680,6 +8680,11 @@ application the system uses for this file type." (browse-url (concat type ":" (org-link-escape path org-link-escape-chars-browser)))) + ((string= type "doi") + (browse-url (concat "http://dx.doi.org/" + (org-link-escape + path org-link-escape-chars-browser)))) + ((member type '("message")) (browse-url (concat type ":" path)))