Mercurial > emacs
comparison lisp/org/org.el @ 105865:131bccfc4f5d
* org.el (org-version, org-get-refile-targets, org-refile)
(org-store-log-note, org-diary-to-ical-string)
(org-speedbar-set-agenda-restriction):
* org-publish.el (org-publish-find-title):
* org-plot.el (org-plot/gnuplot):
* org-mouse.el (org-mouse-do-remotely):
* org-mobile.el (org-mobile-move-capture):
* org-mac-message.el (org-mac-message-insert-flagged):
* org-latex.el (org-replace-region-by-latex):
* org-docbook.el (org-replace-region-by-docbook):
* org-clock.el (org-clock-out, org-clock-cancel):
* org-bibtex.el (org-execute-file-search-in-bibtex):
Use with-current-buffer.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Thu, 05 Nov 2009 21:00:31 +0000 |
parents | cb1ae417fcc7 |
children | b7d8222914b4 |
comparison
equal
deleted
inserted
replaced
105864:c6d77597d0f2 | 105865:131bccfc4f5d |
---|---|
108 (if (and (file-exists-p (expand-file-name ".git" dir)) | 108 (if (and (file-exists-p (expand-file-name ".git" dir)) |
109 (executable-find "git")) | 109 (executable-find "git")) |
110 (let ((pwd (substring (pwd) 10))) | 110 (let ((pwd (substring (pwd) 10))) |
111 (cd dir) | 111 (cd dir) |
112 (if (eql 0 (shell-command "git describe --abbrev=4 HEAD")) | 112 (if (eql 0 (shell-command "git describe --abbrev=4 HEAD")) |
113 (save-excursion | 113 (with-current-buffer "*Shell Command Output*" |
114 (set-buffer "*Shell Command Output*") | |
115 (goto-char (point-min)) | 114 (goto-char (point-min)) |
116 (re-search-forward "[^\n]+") | 115 (re-search-forward "[^\n]+") |
117 (setq git-version (match-string 0)) | 116 (setq git-version (match-string 0)) |
118 (subst-char-in-string ?- ?. git-version t) | 117 (subst-char-in-string ?- ?. git-version t) |
119 (shell-command "git diff-index --name-only HEAD --") | 118 (shell-command "git diff-index --name-only HEAD --") |
8672 (1- (* 2 (cdr desc))) | 8671 (1- (* 2 (cdr desc))) |
8673 (cdr desc))) | 8672 (cdr desc))) |
8674 "\\}[ \t]"))) | 8673 "\\}[ \t]"))) |
8675 (t (error "Bad refiling target description %s" desc))) | 8674 (t (error "Bad refiling target description %s" desc))) |
8676 (while (setq f (pop files)) | 8675 (while (setq f (pop files)) |
8677 (save-excursion | 8676 (with-current-buffer |
8678 (set-buffer (if (bufferp f) f (org-get-agenda-file-buffer f))) | 8677 (if (bufferp f) f (org-get-agenda-file-buffer f)) |
8679 (if (bufferp f) (setq f (buffer-file-name (buffer-base-buffer f)))) | 8678 (if (bufferp f) (setq f (buffer-file-name (buffer-base-buffer f)))) |
8680 (setq f (expand-file-name f)) | 8679 (setq f (expand-file-name f)) |
8681 (if (eq org-refile-use-outline-path 'file) | 8680 (if (eq org-refile-use-outline-path 'file) |
8682 (push (list (file-name-nondirectory f) f nil nil) targets)) | 8681 (push (list (file-name-nondirectory f) f nil nil) targets)) |
8683 (save-excursion | 8682 (save-excursion |
8821 (if regionp | 8820 (if regionp |
8822 (progn | 8821 (progn |
8823 (org-kill-new (buffer-substring region-start region-end)) | 8822 (org-kill-new (buffer-substring region-start region-end)) |
8824 (org-save-markers-in-region region-start region-end)) | 8823 (org-save-markers-in-region region-start region-end)) |
8825 (org-copy-subtree 1 nil t)) | 8824 (org-copy-subtree 1 nil t)) |
8826 (save-excursion | 8825 (with-current-buffer (setq nbuf (or (find-buffer-visiting file) |
8827 (set-buffer (setq nbuf (or (find-buffer-visiting file) | 8826 (find-file-noselect file))) |
8828 (find-file-noselect file)))) | |
8829 (setq reversed (org-notes-order-reversed-p)) | 8827 (setq reversed (org-notes-order-reversed-p)) |
8830 (save-excursion | 8828 (save-excursion |
8831 (save-restriction | 8829 (save-restriction |
8832 (widen) | 8830 (widen) |
8833 (if pos | 8831 (if pos |
10429 (org-remove-empty-drawer-at | 10427 (org-remove-empty-drawer-at |
10430 (if (stringp org-log-into-drawer) org-log-into-drawer "LOGBOOK") | 10428 (if (stringp org-log-into-drawer) org-log-into-drawer "LOGBOOK") |
10431 org-log-note-marker)) | 10429 org-log-note-marker)) |
10432 (setq lines nil)) | 10430 (setq lines nil)) |
10433 (when lines | 10431 (when lines |
10434 (save-excursion | 10432 (with-current-buffer (marker-buffer org-log-note-marker) |
10435 (set-buffer (marker-buffer org-log-note-marker)) | |
10436 (save-excursion | 10433 (save-excursion |
10437 (goto-char org-log-note-marker) | 10434 (goto-char org-log-note-marker) |
10438 (move-marker org-log-note-marker nil) | 10435 (move-marker org-log-note-marker nil) |
10439 (end-of-line 1) | 10436 (end-of-line 1) |
10440 (if (not (bolp)) (let ((inhibit-read-only t)) (insert "\n"))) | 10437 (if (not (bolp)) (let ((inhibit-read-only t)) (insert "\n"))) |
13282 (temp-directory) | 13279 (temp-directory) |
13283 temporary-file-directory)) | 13280 temporary-file-directory)) |
13284 (tmpfile (make-temp-name | 13281 (tmpfile (make-temp-name |
13285 (expand-file-name "orgics" tmpdir))) | 13282 (expand-file-name "orgics" tmpdir))) |
13286 buf rtn b e) | 13283 buf rtn b e) |
13287 (save-excursion | 13284 (with-current-buffer frombuf |
13288 (set-buffer frombuf) | |
13289 (icalendar-export-region (point-min) (point-max) tmpfile) | 13285 (icalendar-export-region (point-min) (point-max) tmpfile) |
13290 (setq buf (find-buffer-visiting tmpfile)) | 13286 (setq buf (find-buffer-visiting tmpfile)) |
13291 (set-buffer buf) | 13287 (set-buffer buf) |
13292 (goto-char (point-min)) | 13288 (goto-char (point-min)) |
13293 (if (re-search-forward "^BEGIN:VEVENT" nil t) | 13289 (if (re-search-forward "^BEGIN:VEVENT" nil t) |
17191 (cond | 17187 (cond |
17192 ((setq p (text-property-any (point-at-bol) (point-at-eol) | 17188 ((setq p (text-property-any (point-at-bol) (point-at-eol) |
17193 'org-imenu t)) | 17189 'org-imenu t)) |
17194 (setq m (get-text-property p 'org-imenu-marker)) | 17190 (setq m (get-text-property p 'org-imenu-marker)) |
17195 (save-excursion | 17191 (save-excursion |
17192 ;; FIXME: Shouldn't set-buffer be done before save-restriction? --Stef | |
17196 (save-restriction | 17193 (save-restriction |
17197 (set-buffer (marker-buffer m)) | 17194 (set-buffer (marker-buffer m)) |
17198 (goto-char m) | 17195 (goto-char m) |
17199 (org-agenda-set-restriction-lock 'subtree)))) | 17196 (org-agenda-set-restriction-lock 'subtree)))) |
17200 ((setq p (text-property-any (point-at-bol) (point-at-eol) | 17197 ((setq p (text-property-any (point-at-bol) (point-at-eol) |
17205 tp 'speedbar-function) | 17202 tp 'speedbar-function) |
17206 dir (speedbar-line-directory) | 17203 dir (speedbar-line-directory) |
17207 txt (buffer-substring-no-properties (or tp (point-min)) | 17204 txt (buffer-substring-no-properties (or tp (point-min)) |
17208 (or np (point-max)))) | 17205 (or np (point-max)))) |
17209 (save-excursion | 17206 (save-excursion |
17207 ;; FIXME: Shouldn't set-buffer be done before save-restriction? --Stef | |
17210 (save-restriction | 17208 (save-restriction |
17211 (set-buffer (find-file-noselect | 17209 (set-buffer (find-file-noselect |
17212 (let ((default-directory dir)) | 17210 (let ((default-directory dir)) |
17213 (expand-file-name txt)))) | 17211 (expand-file-name txt)))) |
17214 (unless (org-mode-p) | 17212 (unless (org-mode-p) |