From fc49c1ec96b2c789f573ae1ba936b930a8494402 Mon Sep 17 00:00:00 2001 From: Sebastian Rose Date: Wed, 1 Sep 2010 05:15:48 +0000 Subject: [PATCH 01/14] org-protocol default template should be nil Hi Carsten, this little patch fixes an issue Richard brought up. We always used the "w" template as the default for `org-remember' and also used it for `org-capture' for historical reasons. Unfortunately, this breaks, if the user has no "w" template defined. The patch below simply set's the custom variable `org-protocol-default-template-key' to nil, so the interactive template selection is used by default. This works for both, remember an capture. I will adjust the docs, once the patch is applied. Thanks, Sebastian --- lisp/org-protocol.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org-protocol.el b/lisp/org-protocol.el index 3f240fd08..21f28e7ff 100644 --- a/lisp/org-protocol.el +++ b/lisp/org-protocol.el @@ -260,7 +260,7 @@ Here is an example: :group 'org-protocol :type '(alist)) -(defcustom org-protocol-default-template-key "w" +(defcustom org-protocol-default-template-key nil "The default org-remember-templates key to use." :group 'org-protocol :type 'string) From bd1b57f92a33485c90db1efc407c8b7c7450993a Mon Sep 17 00:00:00 2001 From: Noorul Islam Date: Thu, 2 Sep 2010 11:35:43 +0000 Subject: [PATCH 02/14] html-export mangels mailto: links Achim Gratz writes: > HTML export removes the "mailto:" from a link, which will then be > interpreted as a local link by the browser. > > For an example, see the link to this mailing list in > ORGWEBPAGE/index.org and the corresponding HTML export on orgmode-org > (or just the local file). > org-html.el : Fix exporting file, mailto, news and ftp protocols. * lisp/org-html.el (org-html-make-link): (expand-file-name ) removes one "/" from "///path-to-file", so add one. Anything other than 'file' type should be exported along with the type. TINYCHANGE Thanks and Regards Noorul --- lisp/org-html.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lisp/org-html.el b/lisp/org-html.el index df55de02f..022b87c06 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -720,7 +720,7 @@ MAY-INLINE-P allows inlining it as an image." ;;Substitute just if original path was absolute. ;;(Otherwise path must remain relative) (if (file-name-absolute-p path) - (expand-file-name path) + (concat "/" (expand-file-name path)) path))) ((string= type "") (list nil path)) @@ -756,8 +756,7 @@ MAY-INLINE-P allows inlining it as an image." (setq thefile (let ((str (org-export-html-format-href thefile))) - (if (and type (not (string= "file" type)) - (org-string-match-p "^//" str)) + (if (and type (not (string= "file" type))) (concat type ":" str) str))) From 2d6238ae551baee92fcecfb0fbfcb76c7537c93c Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Thu, 2 Sep 2010 09:03:08 -0600 Subject: [PATCH 03/14] ob-ruby: only require inf-ruby when absolutely necessary * lisp/ob-ruby.el (org-babel-expand-body:ruby): removed requirement of inf-ruby --- lisp/ob-ruby.el | 1 - 1 file changed, 1 deletion(-) diff --git a/lisp/ob-ruby.el b/lisp/ob-ruby.el index f2363df33..87df8d10a 100644 --- a/lisp/ob-ruby.el +++ b/lisp/ob-ruby.el @@ -54,7 +54,6 @@ (defun org-babel-expand-body:ruby (body params &optional processed-params) "Expand BODY according to PARAMS, return the expanded body." - (require 'inf-ruby) (let ((vars (nth 1 (or processed-params (org-babel-process-params params))))) (concat (mapconcat ;; define any variables From 73957b8fbfa8d0ed12f6548662eb46f28a88ea65 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Thu, 2 Sep 2010 08:12:58 -0700 Subject: [PATCH 04/14] Fontify code in code blocks. * org.el (org-fontify-meta-lines-and-blocks): Alter main regexp to match code blocks with switches and header args. Call `org-src-font-lock-fontify-block' for automatic fontification of code in code blocks, controlled by variable `org-src-fontify-natively'. (org-src-fontify-natively): New variable * org-src.el (org-src-font-lock-fontify-block): New function called during font-lock (org-src-fontify-block): New function for manual fontification of code block at point. (org-src-fontify-buffer): New function to manually fontify all code blocks in buffer (org-src-get-lang-mode): New utility function to map language name as a string to major mode symbol Based on an initial fontification patch by David O'Toole and suggestions from Carsten Dominik. --- lisp/org-src.el | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ lisp/org.el | 11 ++++++++++- 2 files changed, 58 insertions(+), 1 deletion(-) diff --git a/lisp/org-src.el b/lisp/org-src.el index 12d874e5a..ace2714b0 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -715,6 +715,54 @@ Org-babel commands." (call-interactively (lookup-key org-babel-map key))))) +(defun org-src-font-lock-fontify-block (lang start end) + "Fontify code block. +This function is called by emacs automatic fontification, as long +as `org-src-fontify-natively' is non-nil. For manual +fontification of code blocks see `org-src-fontify-block' and +`org-src-fontify-buffer'" + (let* ((lang-mode (org-src-get-lang-mode lang)) + (string (buffer-substring-no-properties start end)) + (modified (buffer-modified-p)) + (org-buffer (current-buffer)) pos next) + (remove-text-properties start end '(face nil)) + (with-temp-buffer + (insert string) + (funcall lang-mode) + (font-lock-fontify-buffer) + (setq pos (point-min)) + (while (setq next (next-single-property-change pos 'face)) + (put-text-property + (+ start (1- pos)) (+ start next) 'face + (get-text-property pos 'face) org-buffer) + (setq pos next))) + (add-text-properties + start end + '(font-lock-fontified t fontified t font-lock-multiline t)) + (set-buffer-modified-p modified)) + t) ;; Tell `org-fontify-meta-lines-and-blocks' that we fontified + +(defun org-src-fontify-block () + "Fontify code block at point." + (interactive) + (save-excursion + (let ((org-src-fontify-natively t) + (info (org-edit-src-find-region-and-lang))) + (font-lock-fontify-region (nth 0 info) (nth 1 info))))) + +(defun org-src-fontify-buffer () + "Fontify all code blocks in the current buffer" + (interactive) + (org-babel-map-src-blocks nil + (org-src-fontify-block))) + +(defun org-src-get-lang-mode (lang) + "Return major mode that should be used for LANG. +LANG is a string, and the returned major mode is a symbol." + (intern + (concat + ((lambda (l) (if (symbolp l) (symbol-name l) l)) + (or (cdr (assoc lang org-src-lang-modes)) lang)) "-mode"))) (provide 'org-src) diff --git a/lisp/org.el b/lisp/org.el index d0a2218a3..fc44fc767 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5022,13 +5022,19 @@ will be prompted for." '(display t invisible t intangible t)) t))) +(defvar org-src-fontify-natively t + "When non-nil, fontify code in code blocks.") + (defun org-fontify-meta-lines-and-blocks (limit) "Fontify #+ lines and blocks, in the correct ways." (let ((case-fold-search t)) (if (re-search-forward - "^\\([ \t]*#\\+\\(\\([a-zA-Z]+:?\\| \\|$\\)\\(_\\([a-zA-Z]+\\)\\)?\\)\\(.*\\)\\)" + "^\\([ \t]*#\\+\\(\\([a-zA-Z]+:?\\| \\|$\\)\\(_\\([a-zA-Z]+\\)\\)?\\)[ \t]*\\(\\([^ \t\n]*\\)[ \t]*\\(.*\\)\\)\\)" limit t) (let ((beg (match-beginning 0)) + (block-start (match-end 0)) + (block-end nil) + (lang (match-string 7)) (beg1 (line-beginning-position 2)) (dc1 (downcase (match-string 2))) (dc3 (downcase (match-string 3))) @@ -5053,6 +5059,7 @@ will be prompted for." (concat "^[ \t]*#\\+end" (match-string 4) "\\>.*") nil t) ;; on purpose, we look further than LIMIT (setq end (match-end 0) end1 (1- (match-beginning 0))) + (setq block-end (match-beginning 0)) (when quoting (remove-text-properties beg end '(display t invisible t intangible t))) @@ -5063,6 +5070,8 @@ will be prompted for." (add-text-properties end1 (+ end 1) '(face org-meta-line)) ; for end_src (cond + ((and lang org-src-fontify-natively) + (org-src-font-lock-fontify-block lang block-start block-end)) (quoting (add-text-properties beg1 (+ end1 1) '(face org-block))) From abfc2cc30ebc74a03d90437ba1bf48c297b249d4 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Wed, 1 Sep 2010 21:39:38 -0700 Subject: [PATCH 05/14] Re-use hidden language major mode buffers during code fontification * org-src.el (org-src-font-lock-fontify-block): Re-use hidden language major mode buffers during fontification --- lisp/org-src.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lisp/org-src.el b/lisp/org-src.el index ace2714b0..6c09cbd6f 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -726,9 +726,12 @@ fontification of code blocks see `org-src-fontify-block' and (modified (buffer-modified-p)) (org-buffer (current-buffer)) pos next) (remove-text-properties start end '(face nil)) - (with-temp-buffer + (with-current-buffer + (get-buffer-create + (concat " org-src-fontification:" (symbol-name lang-mode))) + (delete-region (point-min) (point-max)) (insert string) - (funcall lang-mode) + (unless (eq major-mode lang-mode) (funcall lang-mode)) (font-lock-fontify-buffer) (setq pos (point-min)) (while (setq next (next-single-property-change pos 'face)) From 330fb5409eb50a9ee8e25c7ae463a6a3574e08d2 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Thu, 2 Sep 2010 17:33:00 +0200 Subject: [PATCH 06/14] Fix handling of absolute filenames' conversion to HTML links. --- lisp/org-html.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org-html.el b/lisp/org-html.el index 022b87c06..5da2a5fd1 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -720,7 +720,7 @@ MAY-INLINE-P allows inlining it as an image." ;;Substitute just if original path was absolute. ;;(Otherwise path must remain relative) (if (file-name-absolute-p path) - (concat "/" (expand-file-name path)) + (concat "file://" (expand-file-name path)) path))) ((string= type "") (list nil path)) From 7b188f7da5797da7ae225b89239f87adf0135959 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Thu, 2 Sep 2010 17:48:24 +0200 Subject: [PATCH 07/14] Second fix for the time-grid problem. --- lisp/org-agenda.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 90c693536..e036b18a4 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -5118,7 +5118,7 @@ The modified list may contain inherited tags, and tags matched by (throw 'exit list)) (while (setq time (pop gridtimes)) (unless (and remove (member time have)) - (setq time (format "%2d" time)) + (setq time (format "%4d" time)) (push (org-format-agenda-item nil string "" nil (concat (substring time 0 -2) ":" (substring time -2))) From ebad875b122e6e39bc29967bc2ef8c9ee5d5c641 Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Thu, 2 Sep 2010 12:47:54 -0600 Subject: [PATCH 08/14] ob-plantuml: explicitly check `org-plantuml-jar-path' before use * lisp/ob-plantuml.el (org-babel-execute:plantuml): explicitly check `org-plantuml-jar-path' before use --- lisp/ob-plantuml.el | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lisp/ob-plantuml.el b/lisp/ob-plantuml.el index c5045de6d..cb5ca129b 100644 --- a/lisp/ob-plantuml.el +++ b/lisp/ob-plantuml.el @@ -57,12 +57,14 @@ This function is called by `org-babel-execute-src-block'." (out-file (cdr (assoc :file params))) (cmdline (cdr (assoc :cmdline params))) (in-file (org-babel-temp-file "plantuml-")) - (cmd (concat "java -jar " - (shell-quote-argument org-plantuml-jar-path) - " -p " cmdline " < " - (shell-quote-argument in-file) - " > " - (shell-quote-argument out-file)))) + (cmd (if (not org-plantuml-jar-path) + (error "`org-plantuml-jar-path' is not set") + (concat "java -jar " + (shell-quote-argument org-plantuml-jar-path) + " -p " cmdline " < " + (shell-quote-argument in-file) + " > " + (shell-quote-argument out-file))))) (unless (file-exists-p org-plantuml-jar-path) (error "Could not find plantuml.jar at %s" org-plantuml-jar-path)) (with-temp-file in-file (insert (concat "@startuml\n" body "\n@enduml"))) From 0d5791e7b7324bfd7b9893f3a752dbe8aedd1aeb Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Thu, 2 Sep 2010 11:57:03 -0700 Subject: [PATCH 09/14] Allow language-native TAB command in code blocks. * org-src.el (org-src-tab-indents-natively): New variable controlling whether language-native TAB action should be performed (org-src-native-tab-command-maybe): New function to perform language-native TAB action. (org-tab-first-hook): Add `org-src-native-tab-command-maybe' --- lisp/org-src.el | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lisp/org-src.el b/lisp/org-src.el index 6c09cbd6f..d1948cc54 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -715,6 +715,19 @@ Org-babel commands." (call-interactively (lookup-key org-babel-map key))))) +(defvar org-src-tab-acts-natively nil + "If non-nil, the effect of TAB in a code block is as if it were +issued in the language major mode buffer.") + +(defun org-src-native-tab-command-maybe () + "Perform language-specific TAB action. +Alter code block according to effect of TAB in the language major +mode." + (and org-src-tab-acts-natively + (org-babel-do-key-sequence-in-edit-buffer (kbd "TAB")))) + +(add-hook 'org-tab-first-hook 'org-src-native-tab-command-maybe) + (defun org-src-font-lock-fontify-block (lang start end) "Fontify code block. This function is called by emacs automatic fontification, as long From f1d19d5e75b37b7d35db63f21ddde1dc70366702 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Thu, 2 Sep 2010 22:32:32 +0200 Subject: [PATCH 10/14] org-timer: Fix the docstring. --- lisp/org-timer.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lisp/org-timer.el b/lisp/org-timer.el index 33c4c0bb0..53a2679e3 100644 --- a/lisp/org-timer.el +++ b/lisp/org-timer.el @@ -149,8 +149,7 @@ With prefix arg STOP, stop it entirely." "Insert a H:MM:SS string from the timer into the buffer. The first time this command is used, the timer is started. When used with a \\[universal-argument] prefix, force restarting the timer. -When used with a double prefix argument \ -\\[universal-argument] \\universal-argument], change all the timer string +When used with a double prefix argument \\[universal-argument], change all the timer string in the region by a fixed amount. This can be used to recalibrate a timer that was not started at the correct moment. From 58a49d173957198755939246618f08d11e37b9a1 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Thu, 2 Sep 2010 23:40:44 +0200 Subject: [PATCH 11/14] `org-timer-set-timer': display a countdown in the modeline for. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was requested long time ago by Frederic Couchet and more recently by Ɓukasz Stelmach. --- lisp/org-timer.el | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/lisp/org-timer.el b/lisp/org-timer.el index 53a2679e3..7519d8575 100644 --- a/lisp/org-timer.el +++ b/lisp/org-timer.el @@ -165,9 +165,13 @@ it in the buffer." (defun org-timer-value-string () (format org-timer-format (org-timer-secs-to-hms (floor (org-timer-seconds))))) +(defvar org-timer-timer-is-countdown nil) (defun org-timer-seconds () - (- (org-float-time (or org-timer-pause-time (current-time))) - (org-float-time org-timer-start-time))) + (if org-timer-timer-is-countdown + (- (org-float-time org-timer-start-time) + (org-float-time (current-time))) + (- (org-float-time (or org-timer-pause-time (current-time))) + (org-float-time org-timer-start-time)))) ;;;###autoload (defun org-timer-change-times-in-region (beg end delta) @@ -377,8 +381,14 @@ replace any running timer." secs nil `(lambda () (setq org-timer-current-timer nil) (org-notify ,(format "%s: time out" hl) t) + (setq org-timer-timer-is-countdown nil) + (org-timer-set-mode-line 'off) (run-hooks 'org-timer-done-hook)))) - (run-hooks 'org-timer-set-hook)) + (run-hooks 'org-timer-set-hook) + (setq org-timer-timer-is-countdown t + org-timer-start-time + (time-add (current-time) (seconds-to-time (* mins 60)))) + (org-timer-set-mode-line 'on)) (message "No timer set")))))) (provide 'org-timer) From fea907285c4f37e2ceb724616732bac7a66c1e2e Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Thu, 2 Sep 2010 23:51:22 +0200 Subject: [PATCH 12/14] org-show-notification: use notifications.el when available. notifications.el is a new package from Julien Danjou, available in Emacs 24.1. From etc/NEWS: ,---- | ** notifications.el provides an implementation of the Desktop | Notifications API. It requires D-Bus for communication. `---- --- lisp/org-clock.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lisp/org-clock.el b/lisp/org-clock.el index a0757c753..3328609fe 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -557,6 +557,13 @@ use libnotify if available, or fall back on a message." ((stringp org-show-notification-handler) (start-process "emacs-timer-notification" nil org-show-notification-handler notification)) + ((featurep 'notifications) + (notifications-notify + :title "Org-mode message" + :body notification + ;; FIXME how to link to the Org icon? + ;; :app-icon "~/.emacs.d/icons/mail.png" + :urgency 'low)) ((org-program-exists "notify-send") (start-process "emacs-timer-notification" nil "notify-send" notification)) From 0c67513e7dbc260ba24552ae71d4cac40e5cec2a Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Fri, 3 Sep 2010 01:47:28 +0200 Subject: [PATCH 13/14] `org-get-refile-targets': don't include [/] cookies in targets. This was requested by Marcel van der Boom . --- lisp/org.el | 1 + 1 file changed, 1 insertion(+) diff --git a/lisp/org.el b/lisp/org.el index fc44fc767..d07c41dcf 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -9899,6 +9899,7 @@ on the system \"/user@host:\"." (setq level (org-reduced-level (- (match-end 1) (match-beginning 1))) txt (org-link-display-format (match-string 4)) + txt (replace-regexp-in-string " *\[[0-9]+/[0-9]+\]$" "" txt) re (format org-complex-heading-regexp-format (regexp-quote (match-string 4)))) (when org-refile-use-outline-path From 538cf4e07c189b89a57db0e7ccdb63428ba2181e Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Fri, 3 Sep 2010 02:43:22 +0200 Subject: [PATCH 14/14] Fix docstring. --- lisp/org-agenda.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index e036b18a4..3a6434475 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -4002,8 +4002,7 @@ The remainder is either a list of TODO keywords, or a state symbol "Create agenda view for projects that are stuck. Stuck projects are project that have no next actions. For the definitions of what a project is and how to check if it stuck, customize the variable -`org-stuck-projects'. -MATCH is being ignored." +`org-stuck-projects'." (interactive) (let* ((org-agenda-skip-function 'org-agenda-skip-entry-when-regexp-matches-in-subtree)