Many small code improvements

* lisp/org-capture.el (org-capture-member): Make obsolete; the old
definition was identical to ‘org-capture-get’ anyway.
(org-capture-mode-map): Move the calls to ‘define-key’ up to where the
variable is defined.
(org-capture-mode-hook): Small docstring tweak.
(org-capture-mode): Fix typo in mode lighter.
(org-capture-set-target-location, org-capture-place-item):
(org-capture-place-plain-text, org-capture-narrow):
(org-capture-empty-lines-after):
(org-capture-import-remember-templates): ‘if’ without else -> ‘when’
* lisp/org-colview.el (org-columns-edit-value): Change an error to a
user-error.
(org-columns-uncompile-format): Improve docstring.
* lisp/org-compat.el (org-remove-from-invisibility-spec): Make
obsolete, the underlying emacs function exists since 1997, commit 31aa282e.
(org-in-invisibility-spec-p, org-count-lines): ‘if’ without else -> ‘when’.
* lisp/org-element.el (org-element-swap-A-B):
* lisp/org-entities.el (org-entities-create-table):
* lisp/org-list.el (org-insert-item):
* lisp/org-macs.el (org-with-point-at, org-base-buffer):
(org-preserve-local-variables, org-overlay-display):
(org-overlay-before-string): ‘if’ without else -> ‘when’.
* lisp/org-eshell.el (org-eshell-open): Fix docstring typo.
* lisp/org-pcomplete.el (pcomplete/org-mode/file-option/language):
(pcomplete/org-mode/file-option/startup):
(pcomplete/org-mode/file-option/options):
(pcomplete/org-mode/file-option/infojs_opt):
(pcomplete/org-mode/link, pcomplete/org-mode/tex):
(pcomplete/org-mode/todo, pcomplete/org-mode/searchhead):
(pcomplete/org-mode/tag, pcomplete/org-mode/prop): Avoid the formerly
misspelled ‘pcomplete-uniqify-list’ function.  It has a defalias in
emacs >= 27; we add our own for older emacsen.
(pcomplete/org-mode/file-option/bind): ‘if’ without else -> ‘when’.
* lisp/org-protocol.el (org-protocol-capture):
(org-protocol-convert-query-to-plist): ‘if’ without else -> ‘when’.
(org-protocol-do-capture): Pacify byte compiler, simplify conditional
logic.
* lisp/org-table.el (org-table-create-with-table.el): Simplify conditional
logic.
(org-table-create, org-table-convert-region, org-table-next-field):
(org-table-beginning-of-field, org-table-end-of-field):
* lisp/org-w3m.el (org-w3m-copy-for-org-mode): ‘if’ without else ->
‘when’.
* lisp/org.el (org-babel-do-load-languages, org-previous-link):
(org-refile): Use ‘(foo ...)’ instead of ‘(funcall 'foo ...)’.
(org-add-log-note): Convert a long cond into a cl-case.
(org-priority): Improve docstring, show a deprecation warning if the
‘show’ argument is passed (which was previously silently ignored).
Also, use ?\s instead of ?\ as a character literal for space.
(org-fast-tag-insert): Fix docstring typo.
(org-fill-element): ‘if’ without else -> ‘when’.
(org-on-target-p): Remove ancient compatibility alias.
This commit is contained in:
Aaron Ecay 2018-05-10 02:02:35 +01:00
parent 9d5852e3b8
commit 7106eab974
13 changed files with 138 additions and 148 deletions

View File

@ -474,38 +474,34 @@ When LOCAL is set, use the local variable `org-capture-current-plist',
this is necessary after initialization of the capture process,
to avoid conflicts with other active capture processes."
(plist-get (if local org-capture-current-plist org-capture-plist) prop))
(defun org-capture-member (prop &optional local)
"Is PROP a property in `org-capture-plist'.
When LOCAL is set, use the local variable `org-capture-current-plist',
this is necessary after initialization of the capture process,
to avoid conflicts with other active capture processes."
(plist-get (if local org-capture-current-plist org-capture-plist) prop))
(define-obsolete-function-alias 'org-capture-member 'org-capture-get "Org 9.2")
;;; The minor mode
(defvar org-capture-mode-map (make-sparse-keymap)
(defvar org-capture-mode-map
(let ((map (make-sparse-keymap)))
(define-key map "\C-c\C-c" #'org-capture-finalize)
(define-key map "\C-c\C-k" #'org-capture-kill)
(define-key map "\C-c\C-w" #'org-capture-refile)
map)
"Keymap for `org-capture-mode', a minor mode.
Use this map to set additional keybindings for when Org mode is used
for a capture buffer.")
(defvar org-capture-mode-hook nil
"Hook for the minor `org-capture-mode'.")
"Hook for the `org-capture-mode' minor mode.")
(define-minor-mode org-capture-mode
"Minor mode for special key bindings in a capture buffer.
Turning on this mode runs the normal hook `org-capture-mode-hook'."
nil " Rem" org-capture-mode-map
nil " Cap" org-capture-mode-map
(setq-local
header-line-format
(substitute-command-keys
"\\<org-capture-mode-map>Capture buffer. Finish \
`\\[org-capture-finalize]', refile `\\[org-capture-refile]', \
abort `\\[org-capture-kill]'.")))
(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)
;;; The main commands
@ -1021,7 +1017,7 @@ Store them in the capture property list."
(org-today))))
;; the following is the keep-restriction argument for
;; org-datetree-find-date-create
(if outline-path 'subtree-at-point))))
(when outline-path 'subtree-at-point))))
(`(file+function ,path ,function)
(set-buffer (org-capture-target-buffer path))
(org-capture-put-target-region-and-position)
@ -1193,9 +1189,9 @@ may have been stored before."
(setq end (point))
(org-capture-mark-kill-region beg end)
(org-capture-narrow beg end)
(if (or (re-search-backward "%\\?" beg t)
(re-search-forward "%\\?" end t))
(replace-match ""))))
(when (or (re-search-backward "%\\?" beg t)
(re-search-forward "%\\?" end t))
(replace-match ""))))
(defun org-capture-place-table-line ()
"Place the template as a table line."
@ -1307,9 +1303,9 @@ Of course, if exact position has been required, just put it there."
(setq end (point))
(org-capture-mark-kill-region beg (1- end))
(org-capture-narrow beg (1- end))
(if (or (re-search-backward "%\\?" beg t)
(re-search-forward "%\\?" end t))
(replace-match ""))))
(when (or (re-search-backward "%\\?" beg t)
(re-search-forward "%\\?" end t))
(replace-match ""))))
(defun org-capture-mark-kill-region (beg end)
"Mark the region that will have to be killed when aborting capture."
@ -1366,7 +1362,7 @@ Point will be after the empty lines, so insertion can directly be done."
(let ((pos (point)))
(org-back-over-empty-lines)
(delete-region (point) pos)
(if (> n 0) (newline n))))
(when (> n 0) (newline n))))
(defun org-capture-empty-lines-after (&optional n)
"Set the correct number of empty lines after the inserted string.
@ -1376,7 +1372,7 @@ Point will remain at the first line after the inserted text."
(org-back-over-empty-lines)
(while (looking-at "[ \t]*\n") (replace-match ""))
(let ((pos (point)))
(if (> n 0) (newline n))
(when (> n 0) (newline n))
(goto-char pos)))
(defvar org-clock-marker) ; Defined in org.el
@ -1852,9 +1848,9 @@ Assume sexps have been marked with
(setq jump-to-captured t))
(append (list key desc type target template)
(if prepend '(:prepend t))
(if immediate '(:immediate-finish t))
(if jump-to-captured '(:jump-to-captured t)))))
(and prepend '(:prepend t))
(and immediate '(:immediate-finish t))
(and jump-to-captured '(:jump-to-captured t)))))
org-remember-templates))))

View File

@ -569,7 +569,7 @@ Where possible, use the standard interface for changing this line."
(action
(pcase key
("CLOCKSUM"
(error "This special column cannot be edited"))
(user-error "This special column cannot be edited"))
("ITEM"
(lambda () (org-with-point-at pom (org-edit-headline))))
("TODO"
@ -1036,8 +1036,8 @@ the current buffer."
(defun org-columns-uncompile-format (compiled)
"Turn the compiled columns format back into a string representation.
COMPILED is an alist, as returned by
`org-columns-compile-format', which see."
COMPILED is an alist, as returned by `org-columns-compile-format'."
(mapconcat
(lambda (spec)
(pcase spec

View File

@ -496,18 +496,13 @@ Unlike to `use-region-p', this function also checks
;;; Invisibility compatibility
(defun org-remove-from-invisibility-spec (arg)
"Remove elements from `buffer-invisibility-spec'."
(if (fboundp 'remove-from-invisibility-spec)
(remove-from-invisibility-spec arg)
(if (consp buffer-invisibility-spec)
(setq buffer-invisibility-spec
(delete arg buffer-invisibility-spec)))))
(define-obsolete-function-alias 'org-remove-from-invisibility-spec 'remove-from-invisibility-spec
"Org 9.2")
(defun org-in-invisibility-spec-p (arg)
"Is ARG a member of `buffer-invisibility-spec'?"
(if (consp buffer-invisibility-spec)
(member arg buffer-invisibility-spec)))
(when (consp buffer-invisibility-spec)
(member arg buffer-invisibility-spec)))
(defun org-move-to-column (column &optional force _buffer)
"Move to column COLUMN.
@ -526,8 +521,8 @@ Pass COLUMN and FORCE to `move-to-column'."
(let ((start 0) (n 1))
(while (string-match "\n" s start)
(setq start (match-end 0) n (1+ n)))
(if (and (> (length s) 0) (= (aref s (1- (length s))) ?\n))
(setq n (1- n)))
(when (and (> (length s) 0) (= (aref s (1- (length s))) ?\n))
(setq n (1- n)))
n))
(defun org-kill-new (string &rest args)

View File

@ -5958,11 +5958,11 @@ end of ELEM-A."
;; ELEM-A position in such a situation. Note that the case of
;; a footnote definition is impossible: it cannot contain two
;; paragraphs in a row because it cannot contain a blank line.
(if (and specialp
(or (not (eq (org-element-type elem-B) 'paragraph))
(/= (org-element-property :begin elem-B)
(org-element-property :contents-begin elem-B))))
(error "Cannot swap elements"))
(when (and specialp
(or (not (eq (org-element-type elem-B) 'paragraph))
(/= (org-element-property :begin elem-B)
(org-element-property :contents-begin elem-B))))
(error "Cannot swap elements"))
;; In a special situation, ELEM-A will have no indentation. We'll
;; give it ELEM-B's (which will in, in turn, have no indentation).
(let* ((ind-B (when specialp

View File

@ -543,11 +543,11 @@ This first checks the user list, then the built-in list."
(dolist (e org-entities)
(pcase e
(`(,name ,latex ,mathp ,html ,ascii ,latin ,utf8)
(if (equal ascii "|") (setq ascii "\\vert"))
(if (equal latin "|") (setq latin "\\vert"))
(if (equal utf8 "|") (setq utf8 "\\vert"))
(if (equal ascii "=>") (setq ascii "= >"))
(if (equal latin "=>") (setq latin "= >"))
(when (equal ascii "|") (setq ascii "\\vert"))
(when (equal latin "|") (setq latin "\\vert"))
(when (equal utf8 "|") (setq utf8 "\\vert"))
(when (equal ascii "=>") (setq ascii "= >"))
(when (equal latin "=>") (setq latin "= >"))
(insert "|" name
"|" (format "=%s=" latex)
"|" (format (if mathp "$%s$" "$\\mbox{%s}$") latex)

View File

@ -32,7 +32,7 @@
:store #'org-eshell-store-link)
(defun org-eshell-open (link)
"Switch to am eshell buffer and execute a command line.
"Switch to an eshell buffer and execute a command line.
The link can be just a command line (executed in the default
eshell buffer) or a command line prefixed by a buffer name
followed by a colon."

View File

@ -2260,7 +2260,7 @@ item is invisible."
(string-match "[.)]" (match-string 1))))
(match-beginning 4)
(match-end 0)))
(if desc (backward-char 1))
(when desc (backward-char 1))
t)))))
(defun org-list-repair ()

View File

@ -78,7 +78,7 @@
(org-with-gensyms (mpom)
`(let ((,mpom ,pom))
(save-excursion
(if (markerp ,mpom) (set-buffer (marker-buffer ,mpom)))
(when (markerp ,mpom) (set-buffer (marker-buffer ,mpom)))
(org-with-wide-buffer
(goto-char (or ,mpom (point)))
,@body)))))
@ -206,8 +206,7 @@ because otherwise all these markers will point to nowhere."
(defun org-base-buffer (buffer)
"Return the base buffer of BUFFER, if it has one. Else return the buffer."
(if (not buffer)
buffer
(when buffer
(or (buffer-base-buffer buffer)
buffer)))
@ -216,9 +215,7 @@ because otherwise all these markers will point to nowhere."
not an indirect buffer."
(let ((buf (or (get-file-buffer file)
(find-buffer-visiting file))))
(if buf
(or (buffer-base-buffer buf) buf)
nil)))
(org-base-buffer buf)))
(defun org-switch-to-buffer-other-window (&rest args)
"Switch to buffer in a second window on the current frame.
@ -672,14 +669,14 @@ The number of levels is controlled by `org-inlinetask-min-level'"
(defun org-overlay-display (ovl text &optional face evap)
"Make overlay OVL display TEXT with face FACE."
(overlay-put ovl 'display text)
(if face (overlay-put ovl 'face face))
(if evap (overlay-put ovl 'evaporate t)))
(when face (overlay-put ovl 'face face))
(when evap (overlay-put ovl 'evaporate t)))
(defun org-overlay-before-string (ovl text &optional face evap)
"Make overlay OVL display TEXT with face FACE."
(if face (org-add-props text nil 'face face))
(when face (org-add-props text nil 'face face))
(overlay-put ovl 'before-string text)
(if evap (overlay-put ovl 'evaporate t)))
(when evap (overlay-put ovl 'evaporate t)))
(defun org-find-overlays (prop &optional pos delete)
"Find all overlays specifying PROP at POS or point.

View File

@ -38,6 +38,10 @@
(declare-function org-entry-properties "org" (&optional pom which))
(declare-function org-tag-alist-to-string "org" (alist &optional skip-key))
(unless (fboundp 'pcomplete-uniquify-list)
;; The misspelled variant was made obsolete in Emacs 27.1
(defalias 'pcomplete-uniquify-list 'pcomplete-uniqify-list))
;;;; Customization variables
(defvar org-drawer-regexp)
@ -193,7 +197,7 @@ When completing for #+STARTUP, for example, this function returns
"Complete arguments for the #+LANGUAGE file option."
(require 'ox)
(pcomplete-here
(pcomplete-uniqify-list
(pcomplete-uniquify-list
(list org-export-default-language "en"))))
(defvar org-default-priority)
@ -218,7 +222,7 @@ When completing for #+STARTUP, for example, this function returns
(defun pcomplete/org-mode/file-option/startup ()
"Complete arguments for the #+STARTUP file option."
(while (pcomplete-here
(let ((opts (pcomplete-uniqify-list
(let ((opts (pcomplete-uniquify-list
(mapcar 'car org-startup-options))))
;; Some options are mutually exclusive, and shouldn't be completed
;; against if certain other options have already been seen.
@ -247,7 +251,7 @@ When completing for #+STARTUP, for example, this function returns
(defun pcomplete/org-mode/file-option/options ()
"Complete arguments for the #+OPTIONS file option."
(while (pcomplete-here
(pcomplete-uniqify-list
(pcomplete-uniquify-list
(append
;; Hard-coded OPTION items always available.
'("H:" "\\n:" "num:" "timestamp:" "arch:" "author:" "c:"
@ -266,7 +270,7 @@ When completing for #+STARTUP, for example, this function returns
(defun pcomplete/org-mode/file-option/infojs_opt ()
"Complete arguments for the #+INFOJS_OPT file option."
(while (pcomplete-here
(pcomplete-uniqify-list
(pcomplete-uniquify-list
(mapcar (lambda (item) (format "%s:" (car item)))
(bound-and-true-p org-html-infojs-opts-table))))))
@ -274,7 +278,7 @@ When completing for #+STARTUP, for example, this function returns
"Complete arguments for the #+BIND file option, which are variable names."
(let (vars)
(mapatoms
(lambda (a) (if (boundp a) (setq vars (cons (symbol-name a) vars)))))
(lambda (a) (when (boundp a) (setq vars (cons (symbol-name a) vars)))))
(pcomplete-here vars)))
(defvar org-link-abbrev-alist-local)
@ -282,7 +286,7 @@ When completing for #+STARTUP, for example, this function returns
(defun pcomplete/org-mode/link ()
"Complete against defined #+LINK patterns."
(pcomplete-here
(pcomplete-uniqify-list
(pcomplete-uniquify-list
(copy-sequence
(append (mapcar 'car org-link-abbrev-alist-local)
(mapcar 'car org-link-abbrev-alist))))))
@ -292,13 +296,13 @@ When completing for #+STARTUP, for example, this function returns
"Complete against TeX-style HTML entity names."
(require 'org-entities)
(while (pcomplete-here
(pcomplete-uniqify-list (remove nil (mapcar 'car-safe org-entities)))
(pcomplete-uniquify-list (remove nil (mapcar 'car-safe org-entities)))
(substring pcomplete-stub 1))))
(defvar org-todo-keywords-1)
(defun pcomplete/org-mode/todo ()
"Complete against known TODO keywords."
(pcomplete-here (pcomplete-uniqify-list (copy-sequence org-todo-keywords-1))))
(pcomplete-here (pcomplete-uniquify-list (copy-sequence org-todo-keywords-1))))
(defvar org-todo-line-regexp)
(defun pcomplete/org-mode/searchhead ()
@ -314,14 +318,14 @@ This needs more work, to handle headings with lots of spaces in them."
(push (org-make-org-heading-search-string
(match-string-no-properties 3))
tbl)))
(pcomplete-uniqify-list tbl)))
(pcomplete-uniquify-list tbl)))
(substring pcomplete-stub 1))))
(defun pcomplete/org-mode/tag ()
"Complete a tag name. Omit tags already set."
(while (pcomplete-here
(mapcar (lambda (x) (concat x ":"))
(let ((lst (pcomplete-uniqify-list
(let ((lst (pcomplete-uniquify-list
(or (remq
nil
(mapcar (lambda (x) (org-string-nw-p (car x)))
@ -338,7 +342,7 @@ This needs more work, to handle headings with lots of spaces in them."
(pcomplete-here
(mapcar (lambda (x)
(concat x ": "))
(let ((lst (pcomplete-uniqify-list
(let ((lst (pcomplete-uniquify-list
(copy-sequence (org-buffer-property-keys nil t t)))))
(dolist (prop (org-entry-properties))
(setq lst (delete (car prop) lst)))

View File

@ -468,19 +468,20 @@ You may specify the template with a template= query parameter, like this:
javascript:location.href = \\='org-protocol://capture?template=b\\='+ ...
Now template ?b will be used."
(if (and (boundp 'org-stored-links)
(org-protocol-do-capture info))
(message "Item captured."))
(when (and (boundp 'org-stored-links)
(org-protocol-do-capture info))
(message "Item captured."))
nil)
(defun org-protocol-convert-query-to-plist (query)
"Convert QUERY key=value pairs in the URL to a property list."
(if query
(apply 'append (mapcar (lambda (x)
(let ((c (split-string x "=")))
(list (intern (concat ":" (car c))) (cadr c))))
(split-string query "&")))))
(when query
(apply 'append (mapcar (lambda (x)
(let ((c (split-string x "=")))
(list (intern (concat ":" (car c))) (cadr c))))
(split-string query "&")))))
(defvar org-capture-templates)
(defun org-protocol-do-capture (info)
"Perform the actual capture based on INFO."
(let* ((temp-parts (org-protocol-parse-parameters info))
@ -494,8 +495,7 @@ Now template ?b will be used."
(template (or (plist-get parts :template)
org-protocol-default-template-key))
(url (and (plist-get parts :url) (org-protocol-sanitize-uri (plist-get parts :url))))
(type (and url (if (string-match "^\\([a-z]+\\):" url)
(match-string 1 url))))
(type (and url (string-match "^\\([a-z]+\\):" url) (match-string 1 url)))
(title (or (plist-get parts :title) ""))
(region (or (plist-get parts :body) ""))
(orglink (if url

View File

@ -551,13 +551,13 @@ and table.el tables."
(interactive)
(require 'table)
(cond
((org-at-table.el-p)
(if (y-or-n-p "Convert table to Org table? ")
(org-table-convert)))
((org-at-table-p)
(when (y-or-n-p "Convert table to table.el table? ")
(org-table-align)
(org-table-convert)))
((and (org-at-table.el-p)
(y-or-n-p "Convert table to Org table? "))
(org-table-convert))
((and (org-at-table-p)
(y-or-n-p "Convert table to table.el table? "))
(org-table-align)
(org-table-convert))
(t (call-interactively 'table-insert))))
;;;###autoload
@ -598,12 +598,11 @@ SIZE is a string Columns x Rows like for example \"3x2\"."
;; (mapcar (lambda (x) (insert line)) (make-list rows t))
(dotimes (_ rows) (insert line))
(goto-char pos)
(if (> rows 1)
;; Insert a hline after the first row.
(progn
(end-of-line 1)
(insert "\n|-")
(goto-char pos)))
(when (> rows 1)
;; Insert a hline after the first row.
(end-of-line 1)
(insert "\n|-")
(goto-char pos))
(org-table-align)))
;;;###autoload
@ -633,8 +632,8 @@ nil When nil, the command tries to be smart and figure out the
(if (> (count-lines beg end) org-table-convert-region-max-lines)
(user-error "Region is longer than `org-table-convert-region-max-lines' (%s) lines; not converting"
org-table-convert-region-max-lines)
(if (equal separator '(64))
(setq separator (read-regexp "Regexp for field separator")))
(when (equal separator '(64))
(setq separator (read-regexp "Regexp for field separator")))
(goto-char beg)
(beginning-of-line 1)
(setq beg (point-marker))
@ -993,9 +992,9 @@ Before doing so, re-align the table if necessary."
(interactive)
(org-table-maybe-eval-formula)
(org-table-maybe-recalculate-line)
(if (and org-table-automatic-realign
org-table-may-need-update)
(org-table-align))
(when (and org-table-automatic-realign
org-table-may-need-update)
(org-table-align))
(let ((end (org-table-end)))
(if (org-at-table-hline-p)
(end-of-line 1))
@ -1055,7 +1054,7 @@ With numeric argument N, move N-1 fields backward first."
(user-error "No more table fields before the current")
(goto-char (match-end 0))
(and (looking-at " ") (forward-char 1)))
(if (>= (point) pos) (org-table-beginning-of-field 2))))
(when (>= (point) pos) (org-table-beginning-of-field 2))))
(defun org-table-end-of-field (&optional n)
"Move to the end of the current table field.
@ -1069,9 +1068,9 @@ With numeric argument N, move N-1 fields forward first."
(when (re-search-forward "|" (point-at-eol 1) t)
(backward-char 1)
(skip-chars-backward " ")
(if (and (equal (char-before (point)) ?|) (looking-at " "))
(forward-char 1)))
(if (<= (point) pos) (org-table-end-of-field 2))))
(when (and (equal (char-before (point)) ?|) (equal (char-after (point)) ?\s))
(forward-char 1)))
(when (<= (point) pos) (org-table-end-of-field 2))))
;;;###autoload
(defun org-table-next-row ()

View File

@ -72,7 +72,7 @@ so that it can be yanked into an Org buffer with links working correctly."
(setq transform-start (region-beginning))
(setq transform-end (region-end))
;; Deactivate mark if current mark is activate.
(if (fboundp 'deactivate-mark) (deactivate-mark)))
(when (fboundp 'deactivate-mark) (deactivate-mark)))
(message "Transforming links...")
(save-excursion
(goto-char transform-start)
@ -85,10 +85,10 @@ so that it can be yanked into an Org buffer with links working correctly."
(if (<= (point) transform-end) ; if point is inside transform bound
(progn
;; get content between two links.
(if (> (point) temp-position)
(setq return-content (concat return-content
(buffer-substring
temp-position (point)))))
(when (> (point) temp-position)
(setq return-content (concat return-content
(buffer-substring
temp-position (point)))))
;; get link location at current point.
(setq link-location (get-text-property (point) 'w3m-href-anchor))
;; get link title at current point.
@ -103,10 +103,10 @@ so that it can be yanked into an Org buffer with links working correctly."
(goto-char temp-position) ; reset point before jump next anchor
(setq out-bound t))) ; for break out `while' loop
;; add the rest until end of the region to be copied
(if (< (point) transform-end)
(setq return-content
(concat return-content
(buffer-substring (point) transform-end))))
(when (< (point) transform-end)
(setq return-content
(concat return-content
(buffer-substring (point) transform-end))))
(org-kill-new return-content)
(message "Transforming links...done, use C-y to insert text into Org file")
(message "Copy with link transformation complete."))))

View File

@ -235,10 +235,10 @@ Stars are put in group 1 and the trimmed body in group 2.")
(let ((active (cdr pair)) (lang (symbol-name (car pair))))
(if active
(require (intern (concat "ob-" lang)))
(funcall 'fmakunbound
(intern (concat "org-babel-execute:" lang)))
(funcall 'fmakunbound
(intern (concat "org-babel-expand-body:" lang)))))))
(fmakunbound
(intern (concat "org-babel-execute:" lang)))
(fmakunbound
(intern (concat "org-babel-expand-body:" lang)))))))
(declare-function org-babel-tangle-file "ob-tangle" (file &optional target-file lang))
;;;###autoload
@ -9955,7 +9955,7 @@ If the link is in hidden text, expose it."
"Move backward to the previous link.
If the link is in hidden text, expose it."
(interactive)
(funcall 'org-next-link t))
(org-next-link t))
(defun org-translate-link (s)
"Translate a link string if a translation function has been defined."
@ -11209,7 +11209,7 @@ the *old* location.")
"Like `org-refile', but copy."
(interactive)
(let ((org-refile-keep t))
(funcall 'org-refile nil nil nil "Copy")))
(org-refile nil nil nil "Copy")))
(defun org-refile (&optional arg default-buffer rfloc msg)
"Move the entry or entries at point to another heading.
@ -13217,25 +13217,19 @@ EXTRA is additional text that will be inserted into the notes buffer."
(let ((org-inhibit-startup t)) (org-mode))
(insert (format "# Insert note for %s.
# Finish with C-c C-c, or cancel with C-c C-k.\n\n"
(cond
((eq org-log-note-purpose 'clock-out) "stopped clock")
((eq org-log-note-purpose 'done) "closed todo item")
((eq org-log-note-purpose 'state)
(cl-case org-log-note-purpose
(clock-out "stopped clock")
(done "closed todo item")
(reschedule "rescheduling")
(delschedule "no longer scheduled")
(redeadline "changing deadline")
(deldeadline "removing deadline")
(refile "refiling")
(note "this entry")
(state
(format "state change from \"%s\" to \"%s\""
(or org-log-note-previous-state "")
(or org-log-note-state "")))
((eq org-log-note-purpose 'reschedule)
"rescheduling")
((eq org-log-note-purpose 'delschedule)
"no longer scheduled")
((eq org-log-note-purpose 'redeadline)
"changing deadline")
((eq org-log-note-purpose 'deldeadline)
"removing deadline")
((eq org-log-note-purpose 'refile)
"refiling")
((eq org-log-note-purpose 'note)
"this entry")
(t (error "This should not happen")))))
(when org-log-note-extra (insert org-log-note-extra))
(setq-local org-finish-function 'org-store-log-note)
@ -13526,10 +13520,19 @@ from the `before-change-functions' in the current buffer."
(interactive)
(org-priority 'down))
(defun org-priority (&optional action _show)
(defun org-priority (&optional action show)
"Change the priority of an item.
ACTION can be `set', `up', `down', or a character."
When called interactively with a `\\[universal-argument]' prefix,
show the priority in the minibuffer instead of changing it.
When called programatically, ACTION can be `set', `up', `down',
or a character."
(interactive "P")
(when show
;; Deprecation warning inserted for Org 9.2; once enough time has
;; passed the SHOW argument should be removed.
(warn "`org-priority' called with deprecated SHOW argument"))
(if (equal action '(4))
(org-show-priority)
(unless org-enable-priority-commands
@ -13555,7 +13558,7 @@ ACTION can be `set', `up', `down', or a character."
(when (and (= (upcase org-highest-priority) org-highest-priority)
(= (upcase org-lowest-priority) org-lowest-priority))
(setq new (upcase new)))
(cond ((equal new ?\ ) (setq remove t))
(cond ((equal new ?\s) (setq remove t))
((or (< (upcase new) org-highest-priority) (> (upcase new) org-lowest-priority))
(user-error "Priority must be between `%c' and `%c'"
org-highest-priority org-lowest-priority))))
@ -14442,7 +14445,7 @@ This works in the agenda, and also in an Org buffer."
(assoc s2 ctable)))))
(defun org-fast-tag-insert (kwd tags face &optional end)
"Insert KDW, and the TAGS, the latter with face FACE.
"Insert KWD, and the TAGS, the latter with face FACE.
Also insert END."
(insert (format "%-12s" (concat kwd ":"))
(org-add-props (mapconcat 'identity tags " ") nil 'face face)
@ -21125,12 +21128,10 @@ If there is no description, use the link target."
"Toggle the literal or descriptive display of links."
(interactive)
(if org-descriptive-links
(progn (org-remove-from-invisibility-spec '(org-link))
(org-restart-font-lock)
(setq org-descriptive-links nil))
(progn (add-to-invisibility-spec '(org-link))
(org-restart-font-lock)
(setq org-descriptive-links t))))
(remove-from-invisibility-spec '(org-link))
(add-to-invisibility-spec '(org-link)))
(org-restart-font-lock)
(setq org-descriptive-links (not org-descriptive-links)))
(defun org-in-clocktable-p ()
"Check if the cursor is in a clocktable."
@ -22111,7 +22112,7 @@ fill each of the elements in the active region, instead of just
filling the current element."
(interactive (progn
(barf-if-buffer-read-only)
(list (if current-prefix-arg 'full) t)))
(list (when current-prefix-arg 'full) t)))
(cond
((and region transient-mark-mode mark-active
(not (eq (region-beginning) (region-end))))
@ -22995,8 +22996,6 @@ empty."
(defun org-at-target-p ()
(or (org-in-regexp org-radio-target-regexp)
(org-in-regexp org-target-regexp)))
;; Compatibility alias with Org versions < 7.8.03
(defalias 'org-on-target-p 'org-at-target-p)
(defun org-up-heading-all (arg)
"Move to the heading line of which the present line is a subheading.