0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-08-22 15:48:31 +00:00

Merge branch 'master' of git+ssh://repo.or.cz/srv/git/org-mode

This commit is contained in:
Carsten Dominik 2010-09-03 07:06:57 +02:00
commit 8d980d219e
9 changed files with 109 additions and 20 deletions

View file

@ -57,12 +57,14 @@ This function is called by `org-babel-execute-src-block'."
(out-file (cdr (assoc :file params))) (out-file (cdr (assoc :file params)))
(cmdline (cdr (assoc :cmdline params))) (cmdline (cdr (assoc :cmdline params)))
(in-file (org-babel-temp-file "plantuml-")) (in-file (org-babel-temp-file "plantuml-"))
(cmd (concat "java -jar " (cmd (if (not org-plantuml-jar-path)
(shell-quote-argument org-plantuml-jar-path) (error "`org-plantuml-jar-path' is not set")
" -p " cmdline " < " (concat "java -jar "
(shell-quote-argument in-file) (shell-quote-argument org-plantuml-jar-path)
" > " " -p " cmdline " < "
(shell-quote-argument out-file)))) (shell-quote-argument in-file)
" > "
(shell-quote-argument out-file)))))
(unless (file-exists-p org-plantuml-jar-path) (unless (file-exists-p org-plantuml-jar-path)
(error "Could not find plantuml.jar at %s" 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"))) (with-temp-file in-file (insert (concat "@startuml\n" body "\n@enduml")))

View file

@ -54,7 +54,6 @@
(defun org-babel-expand-body:ruby (body params &optional processed-params) (defun org-babel-expand-body:ruby (body params &optional processed-params)
"Expand BODY according to PARAMS, return the expanded body." "Expand BODY according to PARAMS, return the expanded body."
(require 'inf-ruby)
(let ((vars (nth 1 (or processed-params (org-babel-process-params params))))) (let ((vars (nth 1 (or processed-params (org-babel-process-params params)))))
(concat (concat
(mapconcat ;; define any variables (mapconcat ;; define any variables

View file

@ -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. "Create agenda view for projects that are stuck.
Stuck projects are project that have no next actions. For the definitions 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 of what a project is and how to check if it stuck, customize the variable
`org-stuck-projects'. `org-stuck-projects'."
MATCH is being ignored."
(interactive) (interactive)
(let* ((org-agenda-skip-function (let* ((org-agenda-skip-function
'org-agenda-skip-entry-when-regexp-matches-in-subtree) 'org-agenda-skip-entry-when-regexp-matches-in-subtree)
@ -5118,7 +5117,7 @@ The modified list may contain inherited tags, and tags matched by
(throw 'exit list)) (throw 'exit list))
(while (setq time (pop gridtimes)) (while (setq time (pop gridtimes))
(unless (and remove (member time have)) (unless (and remove (member time have))
(setq time (format "%2d" time)) (setq time (format "%4d" time))
(push (org-format-agenda-item (push (org-format-agenda-item
nil string "" nil nil string "" nil
(concat (substring time 0 -2) ":" (substring time -2))) (concat (substring time 0 -2) ":" (substring time -2)))

View file

@ -557,6 +557,13 @@ use libnotify if available, or fall back on a message."
((stringp org-show-notification-handler) ((stringp org-show-notification-handler)
(start-process "emacs-timer-notification" nil (start-process "emacs-timer-notification" nil
org-show-notification-handler notification)) 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") ((org-program-exists "notify-send")
(start-process "emacs-timer-notification" nil (start-process "emacs-timer-notification" nil
"notify-send" notification)) "notify-send" notification))

View file

@ -720,7 +720,7 @@ MAY-INLINE-P allows inlining it as an image."
;;Substitute just if original path was absolute. ;;Substitute just if original path was absolute.
;;(Otherwise path must remain relative) ;;(Otherwise path must remain relative)
(if (file-name-absolute-p path) (if (file-name-absolute-p path)
(expand-file-name path) (concat "file://" (expand-file-name path))
path))) path)))
((string= type "") ((string= type "")
(list nil path)) (list nil path))
@ -756,8 +756,7 @@ MAY-INLINE-P allows inlining it as an image."
(setq thefile (setq thefile
(let (let
((str (org-export-html-format-href thefile))) ((str (org-export-html-format-href thefile)))
(if (and type (not (string= "file" type)) (if (and type (not (string= "file" type)))
(org-string-match-p "^//" str))
(concat type ":" str) (concat type ":" str)
str))) str)))

View file

@ -260,7 +260,7 @@ Here is an example:
:group 'org-protocol :group 'org-protocol
:type '(alist)) :type '(alist))
(defcustom org-protocol-default-template-key "w" (defcustom org-protocol-default-template-key nil
"The default org-remember-templates key to use." "The default org-remember-templates key to use."
:group 'org-protocol :group 'org-protocol
:type 'string) :type 'string)

View file

@ -715,6 +715,70 @@ Org-babel commands."
(call-interactively (call-interactively
(lookup-key org-babel-map key))))) (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
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-current-buffer
(get-buffer-create
(concat " org-src-fontification:" (symbol-name lang-mode)))
(delete-region (point-min) (point-max))
(insert string)
(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))
(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) (provide 'org-src)

View file

@ -149,8 +149,7 @@ With prefix arg STOP, stop it entirely."
"Insert a H:MM:SS string from the timer into the buffer. "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 The first time this command is used, the timer is started. When used with
a \\[universal-argument] prefix, force restarting the timer. a \\[universal-argument] prefix, force restarting the timer.
When used with a double prefix argument \ When used with a double prefix argument \\[universal-argument], change all the timer string
\\[universal-argument] \\universal-argument], change all the timer string
in the region by a fixed amount. This can be used to recalibrate a timer in the region by a fixed amount. This can be used to recalibrate a timer
that was not started at the correct moment. that was not started at the correct moment.
@ -166,9 +165,13 @@ it in the buffer."
(defun org-timer-value-string () (defun org-timer-value-string ()
(format org-timer-format (org-timer-secs-to-hms (floor (org-timer-seconds))))) (format org-timer-format (org-timer-secs-to-hms (floor (org-timer-seconds)))))
(defvar org-timer-timer-is-countdown nil)
(defun org-timer-seconds () (defun org-timer-seconds ()
(- (org-float-time (or org-timer-pause-time (current-time))) (if org-timer-timer-is-countdown
(org-float-time org-timer-start-time))) (- (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 ;;;###autoload
(defun org-timer-change-times-in-region (beg end delta) (defun org-timer-change-times-in-region (beg end delta)
@ -378,8 +381,14 @@ replace any running timer."
secs nil `(lambda () secs nil `(lambda ()
(setq org-timer-current-timer nil) (setq org-timer-current-timer nil)
(org-notify ,(format "%s: time out" hl) t) (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-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")))))) (message "No timer set"))))))
(provide 'org-timer) (provide 'org-timer)

View file

@ -5022,13 +5022,19 @@ will be prompted for."
'(display t invisible t intangible t)) '(display t invisible t intangible t))
t))) t)))
(defvar org-src-fontify-natively t
"When non-nil, fontify code in code blocks.")
(defun org-fontify-meta-lines-and-blocks (limit) (defun org-fontify-meta-lines-and-blocks (limit)
"Fontify #+ lines and blocks, in the correct ways." "Fontify #+ lines and blocks, in the correct ways."
(let ((case-fold-search t)) (let ((case-fold-search t))
(if (re-search-forward (if (re-search-forward
"^\\([ \t]*#\\+\\(\\([a-zA-Z]+:?\\| \\|$\\)\\(_\\([a-zA-Z]+\\)\\)?\\)\\(.*\\)\\)" "^\\([ \t]*#\\+\\(\\([a-zA-Z]+:?\\| \\|$\\)\\(_\\([a-zA-Z]+\\)\\)?\\)[ \t]*\\(\\([^ \t\n]*\\)[ \t]*\\(.*\\)\\)\\)"
limit t) limit t)
(let ((beg (match-beginning 0)) (let ((beg (match-beginning 0))
(block-start (match-end 0))
(block-end nil)
(lang (match-string 7))
(beg1 (line-beginning-position 2)) (beg1 (line-beginning-position 2))
(dc1 (downcase (match-string 2))) (dc1 (downcase (match-string 2)))
(dc3 (downcase (match-string 3))) (dc3 (downcase (match-string 3)))
@ -5053,6 +5059,7 @@ will be prompted for."
(concat "^[ \t]*#\\+end" (match-string 4) "\\>.*") (concat "^[ \t]*#\\+end" (match-string 4) "\\>.*")
nil t) ;; on purpose, we look further than LIMIT nil t) ;; on purpose, we look further than LIMIT
(setq end (match-end 0) end1 (1- (match-beginning 0))) (setq end (match-end 0) end1 (1- (match-beginning 0)))
(setq block-end (match-beginning 0))
(when quoting (when quoting
(remove-text-properties beg end (remove-text-properties beg end
'(display t invisible t intangible t))) '(display t invisible t intangible t)))
@ -5063,6 +5070,8 @@ will be prompted for."
(add-text-properties end1 (+ end 1) '(face org-meta-line)) (add-text-properties end1 (+ end 1) '(face org-meta-line))
; for end_src ; for end_src
(cond (cond
((and lang org-src-fontify-natively)
(org-src-font-lock-fontify-block lang block-start block-end))
(quoting (quoting
(add-text-properties beg1 (+ end1 1) '(face (add-text-properties beg1 (+ end1 1) '(face
org-block))) org-block)))
@ -9890,6 +9899,7 @@ on the system \"/user@host:\"."
(setq level (org-reduced-level (setq level (org-reduced-level
(- (match-end 1) (match-beginning 1))) (- (match-end 1) (match-beginning 1)))
txt (org-link-display-format (match-string 4)) 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 re (format org-complex-heading-regexp-format
(regexp-quote (match-string 4)))) (regexp-quote (match-string 4))))
(when org-refile-use-outline-path (when org-refile-use-outline-path