]> code.delx.au - gnu-emacs/blobdiff - lisp/org/org-capture.el
Merge from origin/emacs-25
[gnu-emacs] / lisp / org / org-capture.el
index 39804ac3c0161bbba6bfad6681d6bde8888ce83b..6b5e857a04133652bfd202f1322fe5a43235d37b 100644 (file)
@@ -1,6 +1,6 @@
 ;;; org-capture.el --- Fast note taking in Org-mode
 
-;; Copyright (C) 2010-2013 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2016 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
@@ -201,7 +201,7 @@ properties are:
 
  :clock-resume       Start the interrupted clock when finishing the capture.
                      Note that :clock-keep has precedence over :clock-resume.
-                     When setting both to `t', the current clock will run and
+                     When setting both to t, the current clock will run and
                      the previous one will not be resumed.
 
  :unnarrowed         Do not narrow the target buffer, simply show the
@@ -434,7 +434,8 @@ Turning on this mode runs the normal hook `org-capture-mode-hook'."
   nil " Rem" org-capture-mode-map
   (org-set-local
    'header-line-format
-   "Capture buffer.  Finish `C-c C-c', refile `C-c C-w', abort `C-c C-k'."))
+   (substitute-command-keys
+    "Capture buffer.  Finish `C-c C-c', refile `C-c C-w', abort `C-c C-k'.")))
 (define-key org-capture-mode-map "\C-c\C-c" 'org-capture-finalize)
 (define-key org-capture-mode-map "\C-c\C-k" 'org-capture-kill)
 (define-key org-capture-mode-map "\C-c\C-w" 'org-capture-refile)
@@ -459,7 +460,7 @@ For example, if you have a capture template \"c\" and you want
 this template to be accessible only from `message-mode' buffers,
 use this:
 
-   '((\"c\" ((in-mode . \"message-mode\"))))
+   ((\"c\" ((in-mode . \"message-mode\"))))
 
 Here are the available contexts definitions:
 
@@ -477,7 +478,7 @@ accessible if there is at least one valid check.
 You can also bind a key to another agenda custom command
 depending on contextual rules.
 
-    '((\"c\" \"d\" ((in-mode . \"message-mode\"))))
+   ((\"c\" \"d\" ((in-mode . \"message-mode\"))))
 
 Here it means: in `message-mode buffers', use \"c\" as the
 key for the capture template otherwise associated with \"d\".
@@ -741,7 +742,8 @@ captured item after finalizing."
              (pos (org-capture-get :initial-target-position))
              (ipt (org-capture-get :insertion-point))
              (size (org-capture-get :captured-entry-size)))
-         (when reg
+         (if (not reg)
+             (widen)
            (cond ((< ipt (car reg))
                   ;; insertion point is before the narrowed region
                   (narrow-to-region (+ size (car reg)) (+ size (cdr reg))))
@@ -1528,8 +1530,8 @@ The template may still contain \"%?\" for cursor positioning."
         (v-x (or (org-get-x-clipboard 'PRIMARY)
                  (org-get-x-clipboard 'CLIPBOARD)
                  (org-get-x-clipboard 'SECONDARY)))
-        (v-t (format-time-string (car org-time-stamp-formats) ct))
-        (v-T (format-time-string (cdr org-time-stamp-formats) ct))
+        (v-t (format-time-string (car org-time-stamp-formats) ct1))
+        (v-T (format-time-string (cdr org-time-stamp-formats) ct1))
         (v-u (concat "[" (substring v-t 1 -1) "]"))
         (v-U (concat "[" (substring v-T 1 -1) "]"))
         ;; `initial' and `annotation' might habe been passed.
@@ -1586,7 +1588,7 @@ The template may still contain \"%?\" for cursor positioning."
       (insert template)
       (goto-char (point-min))
       (org-capture-steal-local-variables buffer)
-      (setq buffer-file-name nil)
+      (setq buffer-file-name nil mark-active nil)
 
       ;; %[] Insert contents of a file.
       (goto-char (point-min))
@@ -1599,7 +1601,7 @@ The template may still contain \"%?\" for cursor positioning."
            (delete-region start end)
            (condition-case error
                (insert-file-contents filename)
-             (error (insert (format "%%![Couldn't insert %s: %s]"
+             (error (insert (format "%%![Could not insert %s: %s]"
                                     filename error)))))))
       ;; %() embedded elisp
       (org-capture-expand-embedded-elisp)
@@ -1673,7 +1675,9 @@ The template may still contain \"%?\" for cursor positioning."
                (or (equal (char-before) ?:) (insert ":"))
                (insert ins)
                (or (equal (char-after) ?:) (insert ":"))
-               (and (org-at-heading-p) (org-set-tags nil 'align)))))
+               (and (org-at-heading-p)
+                    (let ((org-ignore-region t))
+                      (org-set-tags nil 'align))))))
           ((equal char "C")
            (cond ((= (length clipboards) 1) (insert (car clipboards)))
                  ((> (length clipboards) 1)