2016-06-23 03:25:33 -04:00
|
|
|
|
;;; org-compat.el --- Compatibility Code for Older Emacsen -*- lexical-binding: t; -*-
|
2008-03-22 11:52:18 -04:00
|
|
|
|
|
2024-01-01 20:47:10 -05:00
|
|
|
|
;; Copyright (C) 2004-2024 Free Software Foundation, Inc.
|
2008-03-22 11:52:18 -04:00
|
|
|
|
|
2021-05-07 10:50:57 -04:00
|
|
|
|
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
|
2008-03-22 11:52:18 -04:00
|
|
|
|
;; Keywords: outlines, hypermedia, calendar, wp
|
2021-09-26 03:44:29 -04:00
|
|
|
|
;; URL: https://orgmode.org
|
2008-03-22 11:52:18 -04:00
|
|
|
|
;;
|
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
;;
|
2008-05-06 08:45:52 -04:00
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
2008-03-22 11:52:18 -04:00
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 08:45:52 -04:00
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
2008-03-22 11:52:18 -04:00
|
|
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2017-09-13 18:52:52 -04:00
|
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
2008-03-22 11:52:18 -04:00
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;;
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
Remove final parts of XEmacs compatibility code
* lisp/org-compat.el: Declare `org-add-hook', `org-decompose-region',
`org-detach-overlay', `org-file-equal-p', `org-float-time',
`org-indent-line-to', `org-indent-to-column', `org-looking-at-p',
`org-looking-back', `org-propertize', `org-re' and
`org-select-frame-set-input-focus' as obsolete.
(org-overlay-display, org-overlay-before-string, org-find-overlays):
Move to "org.el"
(org-xemacs-key-equivalents, org-xemacs-p): Remove variables.
(org-region-active-p): Drop XEmacs support.
(org-xemacs-without-invisibility): Remove macro.
(org-get-x-clipboard-compat): Remove function.
* lisp/org-macs.el (org-match-string-no-properties): Remove function.
* lisp/ob-core.el:
* lisp/org-agenda.el:
* lisp/org-archive.el:
* lisp/org-clock.el:
* lisp/org-colview.el:
* lisp/org-crypt.el:
* lisp/org-element.el:
* lisp/org-faces.el:
* lisp/org-feed.el:
* lisp/org-footnote.el:
* lisp/org-habit.el:
* lisp/org-id.el:
* lisp/org-indent.el:
* lisp/org-inlinetask.el:
* lisp/org-lint.el:
* lisp/org-list.el:
* lisp/org-mouse.el:
* lisp/org-pcomplete.el:
* lisp/org-src.el:
* lisp/org-table.el:
* lisp/org-timer.el:
* lisp/org.el:
* lisp/ox-ascii.el:
* lisp/ox-odt.el:
* lisp/ox.el:
* contrib/lisp/org-notify.el:
* contrib/lisp/ox-taskjuggler.el:
* contrib/lisp/org-wikinodes.el:
* testing/lisp/test-org-src.el:
* testing/lisp/test-org.el: Silence byte-compiler.
2016-05-26 06:18:00 -04:00
|
|
|
|
;; This file contains code needed for compatibility with older
|
2018-01-20 06:58:42 -05:00
|
|
|
|
;; versions of GNU Emacs and integration with other packages.
|
2008-03-22 11:52:18 -04:00
|
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
2022-08-04 09:53:05 -04:00
|
|
|
|
|
2016-06-23 03:25:33 -04:00
|
|
|
|
(require 'cl-lib)
|
2021-12-12 10:21:04 -05:00
|
|
|
|
(require 'seq)
|
2008-09-21 15:39:28 -04:00
|
|
|
|
(require 'org-macs)
|
|
|
|
|
|
2022-10-08 01:40:07 -04:00
|
|
|
|
(eval-when-compile (require 'subr-x)) ; Emacs < 28
|
|
|
|
|
|
2022-09-15 00:28:57 -04:00
|
|
|
|
;; We rely on org-compat when generating Org version. Checking Org
|
|
|
|
|
;; version here will interfere with Org build process.
|
|
|
|
|
;; (org-assert-version)
|
2022-08-04 09:53:05 -04:00
|
|
|
|
|
2018-01-20 07:32:03 -05:00
|
|
|
|
(declare-function org-agenda-diary-entry "org-agenda")
|
2017-10-22 09:01:43 -04:00
|
|
|
|
(declare-function org-agenda-maybe-redo "org-agenda" ())
|
2020-12-13 13:56:29 -05:00
|
|
|
|
(declare-function org-agenda-set-restriction-lock "org-agenda" (&optional type))
|
2018-04-28 18:18:59 -04:00
|
|
|
|
(declare-function org-agenda-remove-restriction-lock "org-agenda" (&optional noupdate))
|
2020-12-13 13:56:29 -05:00
|
|
|
|
(declare-function org-calendar-goto-agenda "org-agenda" ())
|
2018-04-29 06:03:17 -04:00
|
|
|
|
(declare-function org-align-tags "org" (&optional all))
|
2017-10-22 09:01:43 -04:00
|
|
|
|
(declare-function org-at-heading-p "org" (&optional ignored))
|
2022-04-28 16:40:13 -04:00
|
|
|
|
(declare-function org-at-table.el-p "org-table" ())
|
2022-10-03 18:37:46 -04:00
|
|
|
|
(declare-function org-back-to-heading "org" (&optional invisible-ok))
|
2021-10-16 12:01:56 -04:00
|
|
|
|
(declare-function org-element-at-point "org-element" (&optional pom cached-only))
|
|
|
|
|
(declare-function org-element-at-point-no-context "org-element" (&optional pom))
|
2017-10-22 09:01:43 -04:00
|
|
|
|
(declare-function org-element-context "org-element" (&optional element))
|
2023-05-16 06:41:53 -04:00
|
|
|
|
(declare-function org-element-lineage "org-element-ast" (blob &optional types with-self))
|
|
|
|
|
(declare-function org-element-type "org-element-ast" (node &optional anonymous))
|
|
|
|
|
(declare-function org-element-type-p "org-element-ast" (node types))
|
|
|
|
|
(declare-function org-element-property "org-element-ast" (property node))
|
2023-05-03 10:26:41 -04:00
|
|
|
|
(declare-function org-element-begin "org-element" (node))
|
|
|
|
|
(declare-function org-element-end "org-element" (node))
|
|
|
|
|
(declare-function org-element-contents-begin "org-element" (node))
|
|
|
|
|
(declare-function org-element-contents-end "org-element" (node))
|
|
|
|
|
(declare-function org-element-post-affiliated "org-element" (node))
|
2017-01-22 08:46:35 -05:00
|
|
|
|
(declare-function org-end-of-subtree "org" (&optional invisible-ok to-heading))
|
2018-06-19 16:53:59 -04:00
|
|
|
|
(declare-function org-get-heading "org" (&optional no-tags no-todo no-priority no-comment))
|
2018-04-29 06:03:17 -04:00
|
|
|
|
(declare-function org-get-tags "org" (&optional pos local))
|
2022-01-16 02:07:25 -05:00
|
|
|
|
(declare-function org-fold-hide-block-toggle "org-fold" (&optional force no-error element))
|
2019-03-03 17:49:22 -05:00
|
|
|
|
(declare-function org-link-display-format "ol" (s))
|
2018-11-26 18:04:41 -05:00
|
|
|
|
(declare-function org-link-set-parameters "ol" (type &rest rest))
|
2017-10-22 09:01:43 -04:00
|
|
|
|
(declare-function org-log-into-drawer "org" ())
|
2018-04-29 06:03:17 -04:00
|
|
|
|
(declare-function org-make-tag-string "org" (tags))
|
2022-10-03 18:37:46 -04:00
|
|
|
|
(declare-function org-next-visible-heading "org" (arg))
|
2017-10-22 09:01:43 -04:00
|
|
|
|
(declare-function org-reduced-level "org" (l))
|
2020-05-09 22:36:00 -04:00
|
|
|
|
(declare-function org-return "org" (&optional indent arg interactive))
|
2022-01-16 02:07:25 -05:00
|
|
|
|
(declare-function org-fold-show-context "org-fold" (&optional key))
|
2017-12-15 16:24:44 -05:00
|
|
|
|
(declare-function org-table-end "org-table" (&optional table-type))
|
2017-01-22 08:46:35 -05:00
|
|
|
|
(declare-function outline-next-heading "outline" ())
|
2017-10-22 09:01:43 -04:00
|
|
|
|
(declare-function speedbar-line-directory "speedbar" (&optional depth))
|
2016-09-07 10:12:10 -04:00
|
|
|
|
(declare-function table--at-cell-p "table" (position &optional object at-column))
|
2023-03-09 10:11:27 -05:00
|
|
|
|
(declare-function ob-clojure-eval-with-cmd "ob-clojure" (cmd expanded))
|
2022-10-03 18:37:46 -04:00
|
|
|
|
(declare-function org-fold-folded-p "org-fold" (&optional pos spec-or-alias))
|
|
|
|
|
(declare-function org-fold-hide-sublevels "org-fold" (levels))
|
|
|
|
|
(declare-function org-fold-hide-subtree "org-fold" ())
|
2022-01-16 02:07:25 -05:00
|
|
|
|
(declare-function org-fold-region "org-fold" (from to flag &optional spec))
|
|
|
|
|
(declare-function org-fold-show-all "org-fold" (&optional types))
|
2022-10-03 18:37:46 -04:00
|
|
|
|
(declare-function org-fold-show-children "org-fold" (&optional level))
|
|
|
|
|
(declare-function org-fold-show-entry "org-fold" (&optional hide-drawers))
|
2022-10-04 17:42:27 -04:00
|
|
|
|
;; `org-string-equal-ignore-case' is in _this_ file but isn't at the
|
|
|
|
|
;; top-level.
|
|
|
|
|
(declare-function org-string-equal-ignore-case "org-compat" (string1 string2))
|
2016-07-22 04:23:21 -04:00
|
|
|
|
|
2018-02-03 18:51:00 -05:00
|
|
|
|
(defvar calendar-mode-map)
|
2017-10-22 09:01:43 -04:00
|
|
|
|
(defvar org-complex-heading-regexp)
|
2018-02-03 18:51:00 -05:00
|
|
|
|
(defvar org-agenda-diary-file)
|
2018-04-28 18:18:59 -04:00
|
|
|
|
(defvar org-agenda-overriding-restriction)
|
|
|
|
|
(defvar org-agenda-restriction-lock-overlay)
|
2016-09-07 11:16:33 -04:00
|
|
|
|
(defvar org-table-any-border-regexp)
|
|
|
|
|
(defvar org-table-dataline-regexp)
|
|
|
|
|
(defvar org-table-tab-recognizes-table.el)
|
|
|
|
|
(defvar org-table1-hline-regexp)
|
2022-01-16 02:07:25 -05:00
|
|
|
|
(defvar org-fold-core-style)
|
2016-09-07 11:16:33 -04:00
|
|
|
|
|
2022-03-19 07:24:55 -04:00
|
|
|
|
|
|
|
|
|
;;; Emacs < 29 compatibility
|
|
|
|
|
|
2024-04-07 09:02:31 -04:00
|
|
|
|
(if (fboundp 'display-buffer-full-frame)
|
|
|
|
|
(defalias 'org-display-buffer-full-frame #'display-buffer-full-frame)
|
|
|
|
|
(defun org-display-buffer-full-frame (buffer alist)
|
|
|
|
|
"Display BUFFER in the current frame, taking the entire frame.
|
|
|
|
|
ALIST is an association list of action symbols and values. See
|
|
|
|
|
Info node `(elisp) Buffer Display Action Alists' for details of
|
|
|
|
|
such alists.
|
|
|
|
|
|
|
|
|
|
This is an action function for buffer display, see Info
|
|
|
|
|
node `(elisp) Buffer Display Action Functions'. It should be
|
|
|
|
|
called only by `display-buffer' or a function directly or
|
|
|
|
|
indirectly called by the latter."
|
|
|
|
|
(when-let ((window (or (display-buffer-reuse-window buffer alist)
|
|
|
|
|
(display-buffer-same-window buffer alist)
|
|
|
|
|
(display-buffer-pop-up-window buffer alist)
|
|
|
|
|
(display-buffer-use-some-window buffer alist))))
|
|
|
|
|
(delete-other-windows window)
|
|
|
|
|
window)))
|
|
|
|
|
|
2022-03-19 07:24:55 -04:00
|
|
|
|
(defvar org-file-has-changed-p--hash-table (make-hash-table :test #'equal)
|
|
|
|
|
"Internal variable used by `org-file-has-changed-p'.")
|
|
|
|
|
|
|
|
|
|
(if (fboundp 'file-has-changed-p)
|
|
|
|
|
(defalias 'org-file-has-changed-p #'file-has-changed-p)
|
|
|
|
|
(defun org-file-has-changed-p (file &optional tag)
|
|
|
|
|
"Return non-nil if FILE has changed.
|
|
|
|
|
The size and modification time of FILE are compared to the size
|
|
|
|
|
and modification time of the same FILE during a previous
|
|
|
|
|
invocation of `org-file-has-changed-p'. Thus, the first invocation
|
|
|
|
|
of `org-file-has-changed-p' always returns non-nil when FILE exists.
|
|
|
|
|
The optional argument TAG, which must be a symbol, can be used to
|
|
|
|
|
limit the comparison to invocations with identical tags; it can be
|
|
|
|
|
the symbol of the calling function, for example."
|
|
|
|
|
(let* ((file (directory-file-name (expand-file-name file)))
|
|
|
|
|
(remote-file-name-inhibit-cache t)
|
|
|
|
|
(fileattr (file-attributes file 'integer))
|
|
|
|
|
(attr (and fileattr
|
|
|
|
|
(cons (file-attribute-size fileattr)
|
|
|
|
|
(file-attribute-modification-time fileattr))))
|
|
|
|
|
(sym (concat (symbol-name tag) "@" file))
|
|
|
|
|
(cachedattr (gethash sym org-file-has-changed-p--hash-table)))
|
|
|
|
|
(when (not (equal attr cachedattr))
|
|
|
|
|
(puthash sym attr org-file-has-changed-p--hash-table)))))
|
|
|
|
|
|
2022-10-04 17:42:27 -04:00
|
|
|
|
(if (fboundp 'string-equal-ignore-case)
|
|
|
|
|
(defalias 'org-string-equal-ignore-case #'string-equal-ignore-case)
|
2022-10-04 17:42:27 -04:00
|
|
|
|
;; From Emacs subr.el.
|
2022-10-04 17:42:27 -04:00
|
|
|
|
(defun org-string-equal-ignore-case (string1 string2)
|
2022-10-04 17:42:27 -04:00
|
|
|
|
"Like `string-equal', but case-insensitive.
|
|
|
|
|
Upper-case and lower-case letters are treated as equal.
|
|
|
|
|
Unibyte strings are converted to multibyte for comparison."
|
|
|
|
|
(eq t (compare-strings string1 0 nil string2 0 nil t))))
|
2022-03-19 07:24:55 -04:00
|
|
|
|
|
2023-08-04 03:53:17 -04:00
|
|
|
|
(defun org-buffer-text-pixel-width ()
|
|
|
|
|
"Return pixel width of text in current buffer.
|
|
|
|
|
This function uses `buffer-text-pixel-size', when available, and falls
|
|
|
|
|
back to `window-text-pixel-size' otherwise."
|
|
|
|
|
(if (fboundp 'buffer-text-pixel-size)
|
|
|
|
|
(car (buffer-text-pixel-size nil nil t))
|
|
|
|
|
(if (get-buffer-window (current-buffer))
|
2023-12-05 14:40:28 -05:00
|
|
|
|
;; FIXME: 10000 because `most-positive-fixnum' ain't working
|
|
|
|
|
;; (tests failing) and this call will be removed after we drop
|
|
|
|
|
;; Emacs 28 support anyway.
|
2023-08-04 03:53:17 -04:00
|
|
|
|
(car (window-text-pixel-size
|
2023-12-05 14:40:28 -05:00
|
|
|
|
nil (point-min) (point-max) 10000))
|
2023-08-04 03:53:17 -04:00
|
|
|
|
(let ((dedicatedp (window-dedicated-p))
|
|
|
|
|
(oldbuffer (window-buffer)))
|
|
|
|
|
(unwind-protect
|
|
|
|
|
(progn
|
|
|
|
|
;; Do not throw error in dedicated windows.
|
|
|
|
|
(set-window-dedicated-p nil nil)
|
|
|
|
|
(set-window-buffer nil (current-buffer))
|
|
|
|
|
(car (window-text-pixel-size
|
2023-12-05 14:40:28 -05:00
|
|
|
|
nil (point-min) (point-max) 10000)))
|
2023-08-04 03:53:17 -04:00
|
|
|
|
(set-window-buffer nil oldbuffer)
|
|
|
|
|
(set-window-dedicated-p nil dedicatedp))))))
|
|
|
|
|
|
2021-08-10 16:02:40 -04:00
|
|
|
|
|
|
|
|
|
;;; Emacs < 28.1 compatibility
|
|
|
|
|
|
2023-10-16 04:23:39 -04:00
|
|
|
|
(if (= 2 (cdr (subr-arity (symbol-function 'get-buffer-create))))
|
|
|
|
|
;; Emacs >27.
|
|
|
|
|
(defalias 'org-get-buffer-create #'get-buffer-create)
|
|
|
|
|
(defun org-get-buffer-create (buffer-or-name &optional _)
|
|
|
|
|
"Call `get-buffer-create' with BUFFER-OR-NAME argument.
|
|
|
|
|
Ignore optional argument."
|
|
|
|
|
(get-buffer-create buffer-or-name)))
|
|
|
|
|
|
2021-10-16 11:26:43 -04:00
|
|
|
|
(if (fboundp 'file-name-concat)
|
|
|
|
|
(defalias 'org-file-name-concat #'file-name-concat)
|
|
|
|
|
(defun org-file-name-concat (directory &rest components)
|
|
|
|
|
"Append COMPONENTS to DIRECTORY and return the resulting string.
|
|
|
|
|
|
|
|
|
|
Elements in COMPONENTS must be a string or nil.
|
|
|
|
|
DIRECTORY or the non-final elements in COMPONENTS may or may not end
|
|
|
|
|
with a slash -- if they don't end with a slash, a slash will be
|
2023-12-03 17:31:30 -05:00
|
|
|
|
inserted before concatenating."
|
2021-10-16 11:26:43 -04:00
|
|
|
|
(save-match-data
|
|
|
|
|
(mapconcat
|
|
|
|
|
#'identity
|
|
|
|
|
(delq nil
|
|
|
|
|
(mapcar
|
|
|
|
|
(lambda (str)
|
2021-10-17 02:34:10 -04:00
|
|
|
|
(when (and str (not (seq-empty-p str))
|
2021-10-16 11:26:43 -04:00
|
|
|
|
(string-match "\\(.+\\)/?" str))
|
|
|
|
|
(match-string 1 str)))
|
|
|
|
|
(cons directory components)))
|
|
|
|
|
"/"))))
|
|
|
|
|
|
2021-08-15 05:01:39 -04:00
|
|
|
|
(if (fboundp 'directory-empty-p)
|
|
|
|
|
(defalias 'org-directory-empty-p #'directory-empty-p)
|
|
|
|
|
(defun org-directory-empty-p (dir)
|
|
|
|
|
"Return t if DIR names an existing directory containing no other files."
|
|
|
|
|
(and (file-directory-p dir)
|
|
|
|
|
(null (directory-files dir nil directory-files-no-dot-files-regexp t)))))
|
2021-08-10 16:02:40 -04:00
|
|
|
|
|
2022-10-04 17:42:27 -04:00
|
|
|
|
(if (fboundp 'string-clean-whitespace)
|
|
|
|
|
(defalias 'org-string-clean-whitespace #'string-clean-whitespace)
|
|
|
|
|
;; From Emacs subr-x.el.
|
|
|
|
|
(defun org-string-clean-whitespace (string)
|
|
|
|
|
"Clean up whitespace in STRING.
|
|
|
|
|
All sequences of whitespaces in STRING are collapsed into a
|
|
|
|
|
single space character, and leading/trailing whitespace is
|
|
|
|
|
removed."
|
|
|
|
|
(let ((blank "[[:blank:]\r\n]+"))
|
|
|
|
|
(string-trim (replace-regexp-in-string blank " " string t t)
|
|
|
|
|
blank blank))))
|
|
|
|
|
|
2022-10-04 17:42:27 -04:00
|
|
|
|
(if (fboundp 'format-prompt)
|
|
|
|
|
(defalias 'org-format-prompt #'format-prompt)
|
|
|
|
|
;; From Emacs minibuffer.el, inlining
|
|
|
|
|
;; `minibuffer-default-prompt-format' value and replacing `length<'
|
|
|
|
|
;; (both new in Emacs 28.1).
|
|
|
|
|
(defun org-format-prompt (prompt default &rest format-args)
|
|
|
|
|
"Compatibility substitute for `format-prompt'."
|
|
|
|
|
(concat
|
|
|
|
|
(if (null format-args)
|
|
|
|
|
prompt
|
|
|
|
|
(apply #'format prompt format-args))
|
|
|
|
|
(and default
|
|
|
|
|
(or (not (stringp default))
|
|
|
|
|
(> (length default) 0))
|
|
|
|
|
(format " (default %s)"
|
|
|
|
|
(if (consp default)
|
|
|
|
|
(car default)
|
|
|
|
|
default)))
|
|
|
|
|
": ")))
|
|
|
|
|
|
2018-05-10 09:41:50 -04:00
|
|
|
|
|
|
|
|
|
;;; Emacs < 27.1 compatibility
|
|
|
|
|
|
2023-02-10 06:37:09 -05:00
|
|
|
|
(if (version< emacs-version "29")
|
|
|
|
|
;; A stub when `combine-change-calls' was not yet there or had
|
|
|
|
|
;; critical bugs (see Emacs bug#60467).
|
|
|
|
|
(defmacro org-combine-change-calls (_beg _end &rest body)
|
|
|
|
|
(declare (debug (form form def-body)) (indent 2))
|
|
|
|
|
`(progn ,@body))
|
|
|
|
|
(defalias 'org-combine-change-calls 'combine-change-calls))
|
2021-10-17 02:34:10 -04:00
|
|
|
|
|
2023-07-05 11:50:44 -04:00
|
|
|
|
;; `flatten-tree' was added in Emacs 27.1.
|
|
|
|
|
(if (fboundp 'flatten-tree)
|
|
|
|
|
(defalias 'org--flatten-tree #'flatten-tree)
|
|
|
|
|
;; The implementation is taken from Emacs subr.el 8664ba18c7c5.
|
|
|
|
|
(defun org--flatten-tree (tree)
|
|
|
|
|
"Return a \"flattened\" copy of TREE.
|
|
|
|
|
|
|
|
|
|
A `flatten-tree' polyfill for compatibility with Emacs versions
|
|
|
|
|
older than 27.1"
|
|
|
|
|
(let (elems)
|
|
|
|
|
(while (consp tree)
|
|
|
|
|
(let ((elem (pop tree)))
|
|
|
|
|
(while (consp elem)
|
|
|
|
|
(push (cdr elem) tree)
|
|
|
|
|
(setq elem (car elem)))
|
|
|
|
|
(if elem (push elem elems))))
|
|
|
|
|
(if tree (push tree elems))
|
|
|
|
|
(nreverse elems))))
|
|
|
|
|
|
2021-10-17 02:34:10 -04:00
|
|
|
|
(if (version< emacs-version "27.1")
|
|
|
|
|
(defsubst org-replace-buffer-contents (source &optional _max-secs _max-costs)
|
|
|
|
|
(replace-buffer-contents source))
|
|
|
|
|
(defalias 'org-replace-buffer-contents #'replace-buffer-contents))
|
|
|
|
|
|
2019-08-13 23:12:18 -04:00
|
|
|
|
(unless (fboundp 'proper-list-p)
|
|
|
|
|
;; `proper-list-p' was added in Emacs 27.1. The function below is
|
|
|
|
|
;; taken from Emacs subr.el 200195e824b^.
|
|
|
|
|
(defun proper-list-p (object)
|
|
|
|
|
"Return OBJECT's length if it is a proper list, nil otherwise.
|
|
|
|
|
A proper list is neither circular nor dotted (i.e., its last cdr
|
|
|
|
|
is nil)."
|
|
|
|
|
(and (listp object) (ignore-errors (length object)))))
|
|
|
|
|
|
2019-08-13 22:19:04 -04:00
|
|
|
|
(if (fboundp 'xor)
|
|
|
|
|
;; `xor' was added in Emacs 27.1.
|
|
|
|
|
(defalias 'org-xor #'xor)
|
|
|
|
|
(defsubst org-xor (a b)
|
|
|
|
|
"Exclusive `or'."
|
|
|
|
|
(if a (not b) b)))
|
|
|
|
|
|
2018-05-10 09:41:50 -04:00
|
|
|
|
(unless (fboundp 'pcomplete-uniquify-list)
|
|
|
|
|
;; The misspelled variant was made obsolete in Emacs 27.1
|
|
|
|
|
(defalias 'pcomplete-uniquify-list 'pcomplete-uniqify-list))
|
|
|
|
|
|
2019-08-18 11:22:36 -04:00
|
|
|
|
(if (fboundp 'time-convert)
|
|
|
|
|
(progn
|
|
|
|
|
(defsubst org-time-convert-to-integer (time)
|
|
|
|
|
(time-convert time 'integer))
|
|
|
|
|
(defsubst org-time-convert-to-list (time)
|
|
|
|
|
(time-convert time 'list)))
|
|
|
|
|
(defun org-time-convert-to-integer (time)
|
|
|
|
|
(floor (float-time time)))
|
|
|
|
|
(defun org-time-convert-to-list (time)
|
|
|
|
|
(seconds-to-time (float-time time))))
|
2018-12-28 18:03:54 -05:00
|
|
|
|
|
2020-05-07 15:34:32 -04:00
|
|
|
|
;; `newline-and-indent' did not take a numeric argument before 27.1.
|
|
|
|
|
(if (version< emacs-version "27")
|
|
|
|
|
(defsubst org-newline-and-indent (&optional _arg)
|
|
|
|
|
(newline-and-indent))
|
|
|
|
|
(defalias 'org-newline-and-indent #'newline-and-indent))
|
|
|
|
|
|
2020-08-07 05:04:53 -04:00
|
|
|
|
(defun org--set-faces-extend (faces extend-p)
|
|
|
|
|
"Set the :extend attribute of FACES to EXTEND-P.
|
|
|
|
|
|
|
|
|
|
This is a no-op for Emacs versions lower than 27, since face
|
|
|
|
|
extension beyond end of line was not controllable."
|
|
|
|
|
(when (fboundp 'set-face-extend)
|
|
|
|
|
(mapc (lambda (f) (set-face-extend f extend-p)) faces)))
|
|
|
|
|
|
2021-05-05 11:54:36 -04:00
|
|
|
|
(if (fboundp 'string-distance)
|
|
|
|
|
(defalias 'org-string-distance 'string-distance)
|
|
|
|
|
(defun org-string-distance (s1 s2)
|
|
|
|
|
"Return the edit (levenshtein) distance between strings S1 S2."
|
|
|
|
|
(let* ((l1 (length s1))
|
|
|
|
|
(l2 (length s2))
|
|
|
|
|
(dist (vconcat (mapcar (lambda (_) (make-vector (1+ l2) nil))
|
|
|
|
|
(number-sequence 1 (1+ l1)))))
|
|
|
|
|
(in (lambda (i j) (aref (aref dist i) j))))
|
|
|
|
|
(setf (aref (aref dist 0) 0) 0)
|
|
|
|
|
(dolist (j (number-sequence 1 l2))
|
|
|
|
|
(setf (aref (aref dist 0) j) j))
|
|
|
|
|
(dolist (i (number-sequence 1 l1))
|
|
|
|
|
(setf (aref (aref dist i) 0) i)
|
|
|
|
|
(dolist (j (number-sequence 1 l2))
|
|
|
|
|
(setf (aref (aref dist i) j)
|
|
|
|
|
(min
|
|
|
|
|
(1+ (funcall in (1- i) j))
|
|
|
|
|
(1+ (funcall in i (1- j)))
|
|
|
|
|
(+ (if (equal (aref s1 (1- i)) (aref s2 (1- j))) 0 1)
|
|
|
|
|
(funcall in (1- i) (1- j)))))))
|
|
|
|
|
(funcall in l1 l2))))
|
|
|
|
|
|
|
|
|
|
(define-obsolete-function-alias 'org-babel-edit-distance 'org-string-distance
|
2021-05-16 02:57:08 -04:00
|
|
|
|
"9.5")
|
2021-05-05 11:54:36 -04:00
|
|
|
|
|
2022-06-18 03:48:01 -04:00
|
|
|
|
(unless (fboundp 'with-connection-local-variables)
|
|
|
|
|
;; Added in Emacs 27: commit:21f54feee8, 2019-03-09.
|
|
|
|
|
;; Redefining it using the old function `with-connection-local-profiles'.
|
|
|
|
|
(defmacro with-connection-local-variables (&rest body)
|
|
|
|
|
"Apply connection-local variables according to `default-directory'.
|
|
|
|
|
Execute BODY, and unwind connection-local variables."
|
|
|
|
|
(declare (debug t))
|
2022-11-03 22:36:25 -04:00
|
|
|
|
`(with-connection-local-profiles (connection-local-get-profiles nil)
|
2022-06-18 03:48:01 -04:00
|
|
|
|
,@body)))
|
|
|
|
|
|
2023-12-28 17:16:45 -05:00
|
|
|
|
;; assoc-delete-all missing from 26.1
|
|
|
|
|
(if (fboundp 'assoc-delete-all)
|
|
|
|
|
(defalias 'org-assoc-delete-all 'assoc-delete-all)
|
|
|
|
|
;; from compat/compat-27.el
|
|
|
|
|
(defun org-assoc-delete-all (key alist &optional test)
|
|
|
|
|
"Delete all matching key from alist, default test equal"
|
|
|
|
|
(unless test (setq test #'equal))
|
|
|
|
|
(while (and (consp (car alist))
|
|
|
|
|
(funcall test (caar alist) key))
|
|
|
|
|
(setq alist (cdr alist)))
|
|
|
|
|
(let ((tail alist) tail-cdr)
|
|
|
|
|
(while (setq tail-cdr (cdr tail))
|
|
|
|
|
(if (and (consp (car tail-cdr))
|
|
|
|
|
(funcall test (caar tail-cdr) key))
|
|
|
|
|
(setcdr tail (cdr tail-cdr))
|
|
|
|
|
(setq tail tail-cdr))))
|
|
|
|
|
alist))
|
|
|
|
|
|
2018-04-27 20:17:44 -04:00
|
|
|
|
|
|
|
|
|
;;; Emacs < 26.1 compatibility
|
|
|
|
|
|
|
|
|
|
(if (fboundp 'line-number-display-width)
|
|
|
|
|
(defalias 'org-line-number-display-width 'line-number-display-width)
|
|
|
|
|
(defun org-line-number-display-width (&rest _) 0))
|
|
|
|
|
|
2018-06-14 15:47:00 -04:00
|
|
|
|
(if (fboundp 'buffer-hash)
|
|
|
|
|
(defalias 'org-buffer-hash 'buffer-hash)
|
|
|
|
|
(defun org-buffer-hash () (md5 (current-buffer))))
|
|
|
|
|
|
2018-12-28 17:16:54 -05:00
|
|
|
|
(unless (fboundp 'file-attribute-modification-time)
|
|
|
|
|
(defsubst file-attribute-modification-time (attributes)
|
|
|
|
|
"The modification time in ATTRIBUTES returned by `file-attributes'.
|
|
|
|
|
This is the time of the last change to the file's contents, and
|
2021-12-06 02:13:06 -05:00
|
|
|
|
is a Lisp timestamp in the same style as `current-time'."
|
2018-12-28 17:16:54 -05:00
|
|
|
|
(nth 5 attributes)))
|
|
|
|
|
|
|
|
|
|
(unless (fboundp 'file-attribute-size)
|
|
|
|
|
(defsubst file-attribute-size (attributes)
|
|
|
|
|
"The size (in bytes) in ATTRIBUTES returned by `file-attributes'.
|
|
|
|
|
This is a floating point number if the size is too large for an integer."
|
|
|
|
|
(nth 7 attributes)))
|
|
|
|
|
|
2016-06-23 04:00:00 -04:00
|
|
|
|
|
2017-06-08 07:01:44 -04:00
|
|
|
|
;;; Obsolete aliases (remove them after the next major release).
|
2016-06-23 04:00:00 -04:00
|
|
|
|
|
|
|
|
|
;;;; XEmacs compatibility, now removed.
|
2021-05-16 02:57:08 -04:00
|
|
|
|
(define-obsolete-function-alias 'org-activate-mark 'activate-mark "9.0")
|
|
|
|
|
(define-obsolete-function-alias 'org-add-hook 'add-hook "9.0")
|
|
|
|
|
(define-obsolete-function-alias 'org-bound-and-true-p 'bound-and-true-p "9.0")
|
|
|
|
|
(define-obsolete-function-alias 'org-decompose-region 'decompose-region "9.0")
|
|
|
|
|
(define-obsolete-function-alias 'org-defvaralias 'defvaralias "9.0")
|
|
|
|
|
(define-obsolete-function-alias 'org-detach-overlay 'delete-overlay "9.0")
|
|
|
|
|
(define-obsolete-function-alias 'org-file-equal-p 'file-equal-p "9.0")
|
|
|
|
|
(define-obsolete-function-alias 'org-float-time 'float-time "9.0")
|
|
|
|
|
(define-obsolete-function-alias 'org-indent-line-to 'indent-line-to "9.0")
|
|
|
|
|
(define-obsolete-function-alias 'org-indent-to-column 'indent-to-column "9.0")
|
|
|
|
|
(define-obsolete-function-alias 'org-looking-at-p 'looking-at-p "9.0")
|
|
|
|
|
(define-obsolete-function-alias 'org-looking-back 'looking-back "9.0")
|
|
|
|
|
(define-obsolete-function-alias 'org-match-string-no-properties 'match-string-no-properties "9.0")
|
|
|
|
|
(define-obsolete-function-alias 'org-propertize 'propertize "9.0")
|
|
|
|
|
(define-obsolete-function-alias 'org-select-frame-set-input-focus 'select-frame-set-input-focus "9.0")
|
|
|
|
|
(define-obsolete-function-alias 'org-file-remote-p 'file-remote-p "9.2")
|
2016-06-23 04:00:00 -04:00
|
|
|
|
|
2022-01-16 02:37:31 -05:00
|
|
|
|
(define-obsolete-function-alias 'org-show-context 'org-fold-show-context "9.6")
|
|
|
|
|
(define-obsolete-function-alias 'org-show-entry 'org-fold-show-entry "9.6")
|
|
|
|
|
(define-obsolete-function-alias 'org-show-children 'org-fold-show-children "9.6")
|
|
|
|
|
|
|
|
|
|
|
2016-06-23 04:00:00 -04:00
|
|
|
|
(defmacro org-re (s)
|
2016-06-26 04:29:27 -04:00
|
|
|
|
"Replace posix classes in regular expression S."
|
|
|
|
|
(declare (debug (form))
|
2021-05-16 02:57:08 -04:00
|
|
|
|
(obsolete "you can safely remove it." "9.0"))
|
2016-06-23 04:00:00 -04:00
|
|
|
|
s)
|
|
|
|
|
|
|
|
|
|
;;;; Functions from cl-lib that Org used to have its own implementation of.
|
2021-05-16 02:57:08 -04:00
|
|
|
|
(define-obsolete-function-alias 'org-count 'cl-count "9.0")
|
|
|
|
|
(define-obsolete-function-alias 'org-every 'cl-every "9.0")
|
|
|
|
|
(define-obsolete-function-alias 'org-find-if 'cl-find-if "9.0")
|
|
|
|
|
(define-obsolete-function-alias 'org-reduce 'cl-reduce "9.0")
|
|
|
|
|
(define-obsolete-function-alias 'org-remove-if 'cl-remove-if "9.0")
|
|
|
|
|
(define-obsolete-function-alias 'org-remove-if-not 'cl-remove-if-not "9.0")
|
|
|
|
|
(define-obsolete-function-alias 'org-some 'cl-some "9.0")
|
|
|
|
|
(define-obsolete-function-alias 'org-floor* 'cl-floor "9.0")
|
2016-06-23 04:00:00 -04:00
|
|
|
|
|
2016-09-07 10:12:10 -04:00
|
|
|
|
(defun org-sublist (list start end)
|
|
|
|
|
"Return a section of LIST, from START to END.
|
|
|
|
|
Counting starts at 1."
|
|
|
|
|
(cl-subseq list (1- start) end))
|
2016-09-26 17:03:49 -04:00
|
|
|
|
(make-obsolete 'org-sublist
|
2016-12-22 07:16:30 -05:00
|
|
|
|
"use cl-subseq (note the 0-based counting)."
|
2021-05-16 02:57:08 -04:00
|
|
|
|
"9.0")
|
2016-09-07 10:12:10 -04:00
|
|
|
|
|
2021-10-04 23:43:14 -04:00
|
|
|
|
;;;; Functions available since Emacs 25.1
|
|
|
|
|
(define-obsolete-function-alias 'org-string-collate-lessp 'string-collate-lessp "9.6")
|
|
|
|
|
(define-obsolete-function-alias 'org-decode-time 'decode-time "9.6")
|
|
|
|
|
(define-obsolete-function-alias 'org-format-time-string 'format-time-string "9.6")
|
|
|
|
|
(define-obsolete-function-alias 'org-time-add 'time-add "9.6")
|
|
|
|
|
(define-obsolete-function-alias 'org-time-subtract 'time-subtract "9.6")
|
|
|
|
|
(define-obsolete-function-alias 'org-time-since 'time-since "9.6")
|
|
|
|
|
(define-obsolete-function-alias 'org-time-less-p 'time-less-p "9.6")
|
2016-09-07 10:12:10 -04:00
|
|
|
|
|
2016-06-23 04:00:00 -04:00
|
|
|
|
;;;; Functions available since Emacs 24.3
|
2021-05-16 02:57:08 -04:00
|
|
|
|
(define-obsolete-function-alias 'org-buffer-narrowed-p 'buffer-narrowed-p "9.0")
|
|
|
|
|
(define-obsolete-function-alias 'org-called-interactively-p 'called-interactively-p "9.0")
|
|
|
|
|
(define-obsolete-function-alias 'org-char-to-string 'char-to-string "9.0")
|
|
|
|
|
(define-obsolete-function-alias 'org-delete-directory 'delete-directory "9.0")
|
|
|
|
|
(define-obsolete-function-alias 'org-format-seconds 'format-seconds "9.0")
|
|
|
|
|
(define-obsolete-function-alias 'org-link-escape-browser 'url-encode-url "9.0")
|
|
|
|
|
(define-obsolete-function-alias 'org-no-warnings 'with-no-warnings "9.0")
|
|
|
|
|
(define-obsolete-function-alias 'org-number-sequence 'number-sequence "9.0")
|
|
|
|
|
(define-obsolete-function-alias 'org-pop-to-buffer-same-window 'pop-to-buffer-same-window "9.0")
|
|
|
|
|
(define-obsolete-function-alias 'org-string-match-p 'string-match-p "9.0")
|
2016-06-23 04:00:00 -04:00
|
|
|
|
|
2016-06-30 09:20:51 -04:00
|
|
|
|
;;;; Functions and variables from previous releases now obsolete.
|
2023-10-10 06:53:07 -04:00
|
|
|
|
(define-obsolete-variable-alias 'org-export-ignored-local-variables
|
|
|
|
|
'org-element-ignored-local-variables "Org 9.7")
|
2023-03-23 07:20:19 -04:00
|
|
|
|
(define-obsolete-function-alias 'org-habit-get-priority
|
|
|
|
|
'org-habit-get-urgency "Org 9.7")
|
2022-11-07 02:05:37 -05:00
|
|
|
|
(define-obsolete-function-alias 'org-timestamp-format
|
|
|
|
|
'org-format-timestamp "Org 9.6")
|
2022-09-06 09:42:11 -04:00
|
|
|
|
(define-obsolete-variable-alias 'org-export-before-processing-hook
|
|
|
|
|
'org-export-before-processing-functions "Org 9.6")
|
|
|
|
|
(define-obsolete-variable-alias 'org-export-before-parsing-hook
|
|
|
|
|
'org-export-before-parsing-functions "Org 9.6")
|
2016-06-30 09:20:51 -04:00
|
|
|
|
(define-obsolete-function-alias 'org-element-remove-indentation
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-remove-indentation "9.0")
|
2016-06-30 09:20:51 -04:00
|
|
|
|
(define-obsolete-variable-alias 'org-latex-create-formula-image-program
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-preview-latex-default-process "9.0")
|
2016-06-30 09:20:51 -04:00
|
|
|
|
(define-obsolete-variable-alias 'org-latex-preview-ltxpng-directory
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-preview-latex-image-directory "9.0")
|
ox-latex: Replace `org-latex-listings'
* lisp/ox-latex.el (org-latex-src-block, org-latex-keyword,
org-latex-inline-src-block, org-latex-template,
org-latex--caption/label-string, org-latex-engraved-preamble,
org-latex-listings): Replace `org-latex-listings' with
`org-latex-src-block-backend', which now can be set to listings/verbatim
and no longer advertises t/nil as valid values.
* lisp/ox-beamer.el (org-beamer-template): Update in the same manner as
`org-latex-template'.
* lisp/org-compat.el: Make `org-latex-listings' an obsolete alias for
`org-latex-src-block-backend'.
* testing/lisp/test-ox.el: Replace `org-latex-listings' reference with
`org-latex-src-block-backend'.
* doc/org-manual.org (Footnotes, LaTeX specific properties, Literal
Examples): Replace references to `org-latex-listings' with
`org-latex-src-block-backend'.
* etc/ORG-NEWS: Add a news entry noting this change.
The variable `org-latex-listings' originally indicated whether source
blocks should use the listings LaTeX package, or not. This usage has
evolved over the years, and now it sets one of four different
fontification backends. This renaming should make the variable name a
bit less misleading.
2022-05-07 02:46:28 -04:00
|
|
|
|
(define-obsolete-variable-alias 'org-latex-listings
|
|
|
|
|
'org-latex-src-block-backend "9.6")
|
2021-05-16 02:57:08 -04:00
|
|
|
|
(define-obsolete-function-alias 'org-table-p 'org-at-table-p "9.0")
|
|
|
|
|
(define-obsolete-function-alias 'org-on-heading-p 'org-at-heading-p "9.0")
|
|
|
|
|
(define-obsolete-function-alias 'org-at-regexp-p 'org-in-regexp "8.3")
|
2016-06-30 09:20:51 -04:00
|
|
|
|
(define-obsolete-function-alias 'org-image-file-name-regexp
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'image-file-name-regexp "9.0")
|
2016-06-30 09:20:51 -04:00
|
|
|
|
(define-obsolete-function-alias 'org-completing-read-no-i
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'completing-read "9.0")
|
2016-06-30 09:20:51 -04:00
|
|
|
|
(define-obsolete-function-alias 'org-icompleting-read
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'completing-read "9.0")
|
|
|
|
|
(define-obsolete-function-alias 'org-iread-file-name 'read-file-name "9.0")
|
2016-06-30 09:20:51 -04:00
|
|
|
|
(define-obsolete-function-alias 'org-days-to-time
|
2023-04-30 07:37:51 -04:00
|
|
|
|
'org-timestamp-to-now "8.2")
|
2016-06-30 09:20:51 -04:00
|
|
|
|
(define-obsolete-variable-alias 'org-agenda-ignore-drawer-properties
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-agenda-ignore-properties "9.0")
|
2016-06-30 09:20:51 -04:00
|
|
|
|
(define-obsolete-function-alias 'org-preview-latex-fragment
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-toggle-latex-fragment "8.3")
|
2016-06-30 09:20:51 -04:00
|
|
|
|
(define-obsolete-function-alias 'org-export-get-genealogy
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-element-lineage "9.0")
|
2016-06-30 09:20:51 -04:00
|
|
|
|
(define-obsolete-variable-alias 'org-latex-with-hyperref
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-latex-hyperref-template "9.0")
|
|
|
|
|
(define-obsolete-variable-alias 'hfy-optimisations 'hfy-optimizations "9.0")
|
2016-06-30 09:20:51 -04:00
|
|
|
|
(define-obsolete-variable-alias 'org-export-htmlized-org-css-url
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-org-htmlized-css-url "8.2")
|
|
|
|
|
(define-obsolete-function-alias 'org-list-parse-list 'org-list-to-lisp "9.0")
|
2016-06-30 09:20:51 -04:00
|
|
|
|
(define-obsolete-function-alias 'org-agenda-todayp
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-agenda-today-p "9.0")
|
2016-06-30 09:20:51 -04:00
|
|
|
|
(define-obsolete-function-alias 'org-babel-examplize-region
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-babel-examplify-region "9.0")
|
2017-01-24 23:54:58 -05:00
|
|
|
|
(define-obsolete-variable-alias 'org-babel-capitalize-example-region-markers
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-babel-uppercase-example-markers "9.1")
|
2017-01-24 23:54:58 -05:00
|
|
|
|
|
2021-05-16 02:57:08 -04:00
|
|
|
|
(define-obsolete-function-alias 'org-babel-trim 'org-trim "9.0")
|
2016-06-30 09:20:51 -04:00
|
|
|
|
(define-obsolete-variable-alias 'org-html-style 'org-html-head "24.4")
|
|
|
|
|
(define-obsolete-function-alias 'org-insert-columns-dblock
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-columns-insert-dblock "9.0")
|
2016-12-01 21:31:08 -05:00
|
|
|
|
(define-obsolete-variable-alias 'org-export-babel-evaluate
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-export-use-babel "9.1")
|
2017-06-08 07:01:44 -04:00
|
|
|
|
(define-obsolete-function-alias 'org-activate-bracket-links
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-activate-links "9.0")
|
|
|
|
|
(define-obsolete-function-alias 'org-activate-plain-links 'ignore "9.0")
|
|
|
|
|
(define-obsolete-function-alias 'org-activate-angle-links 'ignore "9.0")
|
|
|
|
|
(define-obsolete-function-alias 'org-remove-double-quotes 'org-strip-quotes "9.0")
|
2018-05-08 19:26:31 -04:00
|
|
|
|
(define-obsolete-function-alias 'org-get-indentation
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'current-indentation "9.2")
|
|
|
|
|
(define-obsolete-function-alias 'org-capture-member 'org-capture-get "9.2")
|
2018-05-10 09:41:50 -04:00
|
|
|
|
(define-obsolete-function-alias 'org-remove-from-invisibility-spec
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'remove-from-invisibility-spec "9.2")
|
2016-09-26 17:03:49 -04:00
|
|
|
|
|
2018-06-25 11:11:12 -04:00
|
|
|
|
(define-obsolete-variable-alias 'org-effort-durations 'org-duration-units
|
2021-05-16 02:57:08 -04:00
|
|
|
|
"9.2")
|
2018-06-25 11:11:12 -04:00
|
|
|
|
|
2019-02-13 17:52:13 -05:00
|
|
|
|
(define-obsolete-function-alias 'org-toggle-latex-fragment 'org-latex-preview
|
2021-05-16 02:57:08 -04:00
|
|
|
|
"9.3")
|
2019-02-13 17:52:13 -05:00
|
|
|
|
|
|
|
|
|
(define-obsolete-function-alias 'org-remove-latex-fragment-image-overlays
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-clear-latex-preview "9.3")
|
2019-02-13 17:52:13 -05:00
|
|
|
|
|
2022-01-16 02:37:31 -05:00
|
|
|
|
(define-obsolete-function-alias 'org-hide-archived-subtrees
|
|
|
|
|
'org-fold-hide-archived-subtrees "9.6")
|
|
|
|
|
|
|
|
|
|
(define-obsolete-function-alias 'org-flag-region
|
|
|
|
|
'org-fold-region "9.6")
|
|
|
|
|
|
|
|
|
|
(define-obsolete-function-alias 'org-flag-subtree
|
|
|
|
|
'org-fold-subtree "9.6")
|
|
|
|
|
|
|
|
|
|
(define-obsolete-function-alias 'org-hide-entry
|
|
|
|
|
'org-fold-hide-entry "9.6")
|
|
|
|
|
|
|
|
|
|
(define-obsolete-function-alias 'org-show-subtree
|
|
|
|
|
'org-fold-show-subtree "9.6")
|
|
|
|
|
|
|
|
|
|
(define-obsolete-function-alias 'org--hide-wrapper-toggle
|
|
|
|
|
'org-fold--hide-wrapper-toggle "9.6")
|
|
|
|
|
|
|
|
|
|
(define-obsolete-function-alias 'org-hide-block-toggle
|
|
|
|
|
'org-fold-hide-block-toggle "9.6")
|
|
|
|
|
|
|
|
|
|
(define-obsolete-function-alias 'org-hide-drawer-toggle
|
|
|
|
|
'org-fold-hide-drawer-toggle "9.6")
|
|
|
|
|
|
|
|
|
|
(define-obsolete-function-alias 'org--hide-drawers
|
|
|
|
|
'org-fold--hide-drawers "9.6")
|
|
|
|
|
|
|
|
|
|
(define-obsolete-function-alias 'org-hide-block-all
|
|
|
|
|
'org-fold-hide-block-all "9.6")
|
|
|
|
|
|
|
|
|
|
(define-obsolete-function-alias 'org-hide-drawer-all
|
|
|
|
|
'org-fold-hide-drawer-all "9.6")
|
|
|
|
|
|
|
|
|
|
(define-obsolete-function-alias 'org-show-all
|
|
|
|
|
'org-fold-show-all "9.6")
|
|
|
|
|
|
|
|
|
|
(define-obsolete-function-alias 'org-set-startup-visibility
|
|
|
|
|
'org-cycle-set-startup-visibility "9.6")
|
|
|
|
|
|
|
|
|
|
(define-obsolete-function-alias 'org-show-set-visibility
|
|
|
|
|
'org-fold-show-set-visibility "9.6")
|
|
|
|
|
|
|
|
|
|
(define-obsolete-function-alias 'org-check-before-invisible-edit
|
|
|
|
|
'org-fold-check-before-invisible-edit "9.6")
|
|
|
|
|
|
|
|
|
|
(define-obsolete-function-alias 'org-flag-above-first-heading
|
|
|
|
|
'org-fold-flag-above-first-heading "9.6")
|
|
|
|
|
|
|
|
|
|
(define-obsolete-function-alias 'org-show-branches-buffer
|
|
|
|
|
'org-fold-show-branches-buffer "9.6")
|
|
|
|
|
|
|
|
|
|
(define-obsolete-function-alias 'org-show-siblings
|
|
|
|
|
'org-fold-show-siblings "9.6")
|
|
|
|
|
|
|
|
|
|
(define-obsolete-function-alias 'org-show-hidden-entry
|
|
|
|
|
'org-fold-show-hidden-entry "9.6")
|
|
|
|
|
|
|
|
|
|
(define-obsolete-function-alias 'org-flag-heading
|
|
|
|
|
'org-fold-heading "9.6")
|
|
|
|
|
|
|
|
|
|
(define-obsolete-function-alias 'org-set-startup-visibility
|
|
|
|
|
'org-cycle-set-startup-visibility "9.6")
|
|
|
|
|
|
|
|
|
|
(define-obsolete-function-alias 'org-set-visibility-according-to-property
|
|
|
|
|
'org-cycle-set-visibility-according-to-property "9.6")
|
|
|
|
|
|
|
|
|
|
(define-obsolete-variable-alias 'org-scroll-position-to-restore
|
|
|
|
|
'org-cycle-scroll-position-to-restore "9.6")
|
|
|
|
|
(define-obsolete-function-alias 'org-optimize-window-after-visibility-change
|
|
|
|
|
'org-cycle-optimize-window-after-visibility-change "9.6")
|
|
|
|
|
|
|
|
|
|
(define-obsolete-function-alias 'org-force-cycle-archived
|
|
|
|
|
'org-cycle-force-archived "9.6")
|
|
|
|
|
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
(define-obsolete-variable-alias 'org-attach-directory
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-attach-id-dir "9.3")
|
|
|
|
|
(make-obsolete 'org-attach-store-link "No longer used" "9.4")
|
|
|
|
|
(make-obsolete 'org-attach-expand-link "No longer used" "9.4")
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
|
2021-05-18 10:31:39 -04:00
|
|
|
|
(define-obsolete-function-alias 'org-file-url-p 'org-url-p "9.5")
|
|
|
|
|
|
2022-01-16 02:37:31 -05:00
|
|
|
|
(define-obsolete-variable-alias 'org-show-context-detail
|
|
|
|
|
'org-fold-show-context-detail "9.6")
|
|
|
|
|
|
|
|
|
|
(define-obsolete-variable-alias 'org-catch-invisible-edits
|
|
|
|
|
'org-fold-catch-invisible-edits "9.6")
|
|
|
|
|
|
|
|
|
|
(define-obsolete-variable-alias 'org-reveal-start-hook
|
|
|
|
|
'org-fold-reveal-start-hook "9.6")
|
|
|
|
|
(define-obsolete-function-alias 'org-file-url-p 'org-url-p "9.6")
|
2022-01-15 01:14:36 -05:00
|
|
|
|
(define-obsolete-variable-alias 'org-plantuml-executable-args 'org-plantuml-args
|
|
|
|
|
"Org 9.6")
|
2024-01-21 08:21:33 -05:00
|
|
|
|
|
2024-05-01 12:36:40 -04:00
|
|
|
|
(defvar org-cached-props nil)
|
|
|
|
|
(defvar org-use-property-inheritance)
|
|
|
|
|
(declare-function org-entry-get "org" (epom property &optional inherit literal-nil))
|
|
|
|
|
(declare-function org-entry-properties "org" (&optional epom which))
|
|
|
|
|
(defun org-cached-entry-get (pom property)
|
|
|
|
|
(if (or (eq t org-use-property-inheritance)
|
|
|
|
|
(and (stringp org-use-property-inheritance)
|
|
|
|
|
(let ((case-fold-search t))
|
|
|
|
|
(string-match-p org-use-property-inheritance property)))
|
|
|
|
|
(and (listp org-use-property-inheritance)
|
|
|
|
|
(member-ignore-case property org-use-property-inheritance)))
|
|
|
|
|
;; Caching is not possible, check it directly.
|
|
|
|
|
(org-entry-get pom property 'inherit)
|
|
|
|
|
;; Get all properties, so we can do complicated checks easily.
|
|
|
|
|
(cdr (assoc-string property
|
|
|
|
|
(or org-cached-props
|
|
|
|
|
(setq org-cached-props (org-entry-properties pom)))
|
|
|
|
|
t))))
|
|
|
|
|
|
|
|
|
|
(make-obsolete 'org-cached-entry-get
|
|
|
|
|
"Performs badly. Instead use `org-entry-get' with the argument INHERIT set to `selective'"
|
|
|
|
|
"9.7")
|
|
|
|
|
|
2024-01-21 08:21:33 -05:00
|
|
|
|
(defconst org-latex-line-break-safe "\\\\[0pt]"
|
|
|
|
|
"Linebreak protecting the following [...].
|
|
|
|
|
|
|
|
|
|
Without \"[0pt]\" it would be interpreted as an optional argument to
|
|
|
|
|
the \\\\.
|
|
|
|
|
|
|
|
|
|
This constant, for example, makes the below code not err:
|
|
|
|
|
|
|
|
|
|
\\begin{tabular}{c|c}
|
|
|
|
|
[t] & s\\\\[0pt]
|
|
|
|
|
[I] & A\\\\[0pt]
|
|
|
|
|
[m] & kg
|
|
|
|
|
\\end{tabular}")
|
|
|
|
|
(make-obsolete 'org-latex-line-break-safe
|
|
|
|
|
"should not be used - it is not safe in all the scenarios."
|
|
|
|
|
"9.7")
|
|
|
|
|
|
2016-09-26 17:03:49 -04:00
|
|
|
|
(defun org-in-fixed-width-region-p ()
|
|
|
|
|
"Non-nil if point in a fixed-width region."
|
|
|
|
|
(save-match-data
|
2023-05-16 06:41:53 -04:00
|
|
|
|
(org-element-type-p (org-element-at-point) 'fixed-width)))
|
2016-09-26 17:03:49 -04:00
|
|
|
|
(make-obsolete 'org-in-fixed-width-region-p
|
2016-12-22 07:16:30 -05:00
|
|
|
|
"use `org-element' library"
|
2021-05-16 02:57:08 -04:00
|
|
|
|
"9.0")
|
2016-06-30 09:20:51 -04:00
|
|
|
|
|
2022-11-24 20:41:04 -05:00
|
|
|
|
;; FIXME: Unused; obsoleted; to be removed.
|
|
|
|
|
(defun org-let (list &rest body) ;FIXME: So many kittens are suffering here.
|
|
|
|
|
(declare (indent 1) (obsolete cl-progv "2021"))
|
|
|
|
|
(eval (cons 'let (cons list body))))
|
|
|
|
|
|
|
|
|
|
;; FIXME: Unused; obsoleted; to be removed.
|
|
|
|
|
(defun org-let2 (list1 list2 &rest body) ;FIXME: Where did our karma go?
|
|
|
|
|
(declare (indent 2) (obsolete cl-progv "2021"))
|
|
|
|
|
(eval (cons 'let (cons list1 (list (cons 'let (cons list2 body)))))))
|
|
|
|
|
|
|
|
|
|
(make-obsolete 'org-let "to be removed" "9.6")
|
|
|
|
|
(make-obsolete 'org-let2 "to be removed" "9.6")
|
|
|
|
|
|
2023-01-07 06:17:26 -05:00
|
|
|
|
(define-obsolete-function-alias 'org--math-always-on
|
|
|
|
|
'org--math-p "9.7")
|
|
|
|
|
|
2024-01-24 08:54:30 -05:00
|
|
|
|
(defmacro org-no-popups (&rest body)
|
|
|
|
|
"Suppress popup windows and evaluate BODY."
|
|
|
|
|
`(let (pop-up-frames pop-up-windows)
|
|
|
|
|
,@body))
|
|
|
|
|
(make-obsolete 'org-no-popups "no longer used" "9.7")
|
|
|
|
|
|
|
|
|
|
(defun org-switch-to-buffer-other-window (&rest args)
|
|
|
|
|
"Switch to buffer in a second window on the current frame.
|
|
|
|
|
In particular, do not allow pop-up frames.
|
|
|
|
|
Returns the newly created buffer."
|
2024-02-02 08:33:01 -05:00
|
|
|
|
(let (pop-up-frames pop-up-windows)
|
|
|
|
|
(apply #'switch-to-buffer-other-window args)))
|
|
|
|
|
(make-obsolete 'org-switch-to-buffer-other-window "no longer used" "9.7")
|
2024-01-24 08:54:30 -05:00
|
|
|
|
|
2023-05-29 05:41:09 -04:00
|
|
|
|
(make-obsolete 'org-refresh-category-properties "no longer used" "9.7")
|
2023-05-29 05:48:14 -04:00
|
|
|
|
(make-obsolete 'org-refresh-effort-properties "no longer used" "9.7")
|
2023-05-29 05:41:09 -04:00
|
|
|
|
|
2008-03-22 11:52:18 -04:00
|
|
|
|
(defun org-compatible-face (inherits specs)
|
|
|
|
|
"Make a compatible face specification.
|
2016-06-26 08:43:20 -04:00
|
|
|
|
If INHERITS is an existing face and if the Emacs version supports
|
|
|
|
|
it, just inherit the face. If INHERITS is not given and SPECS
|
|
|
|
|
is, use SPECS to define the face."
|
|
|
|
|
(declare (indent 1))
|
|
|
|
|
(if (facep inherits)
|
|
|
|
|
(list (list t :inherit inherits))
|
|
|
|
|
specs))
|
2021-05-16 02:57:08 -04:00
|
|
|
|
(make-obsolete 'org-compatible-face "you can remove it." "9.0")
|
2016-06-30 11:45:04 -04:00
|
|
|
|
|
2016-07-07 09:58:29 -04:00
|
|
|
|
(defun org-add-link-type (type &optional follow export)
|
|
|
|
|
"Add a new TYPE link.
|
|
|
|
|
FOLLOW and EXPORT are two functions.
|
|
|
|
|
|
|
|
|
|
FOLLOW should take the link path as the single argument and do whatever
|
|
|
|
|
is necessary to follow the link, for example find a file or display
|
|
|
|
|
a mail message.
|
|
|
|
|
|
|
|
|
|
EXPORT should format the link path for export to one of the export formats.
|
|
|
|
|
It should be a function accepting three arguments:
|
|
|
|
|
|
|
|
|
|
path the path of the link, the text after the prefix (like \"http:\")
|
|
|
|
|
desc the description of the link, if any
|
|
|
|
|
format the export format, a symbol like `html' or `latex' or `ascii'.
|
|
|
|
|
|
|
|
|
|
The function may use the FORMAT information to return different values
|
|
|
|
|
depending on the format. The return value will be put literally into
|
|
|
|
|
the exported file. If the return value is nil, this means Org should
|
|
|
|
|
do what it normally does with links which do not have EXPORT defined.
|
|
|
|
|
|
|
|
|
|
Org mode has a built-in default for exporting links. If you are happy with
|
|
|
|
|
this default, there is no need to define an export function for the link
|
|
|
|
|
type. For a simple example of an export function, see `org-bbdb.el'.
|
|
|
|
|
|
|
|
|
|
If TYPE already exists, update it with the arguments.
|
|
|
|
|
See `org-link-parameters' for documentation on the other parameters."
|
|
|
|
|
(org-link-set-parameters type :follow follow :export export)
|
|
|
|
|
(message "Created %s link." type))
|
|
|
|
|
|
2021-05-16 02:57:08 -04:00
|
|
|
|
(make-obsolete 'org-add-link-type "use `org-link-set-parameters' instead." "9.0")
|
2016-07-07 09:58:29 -04:00
|
|
|
|
|
2018-04-28 18:39:26 -04:00
|
|
|
|
;;;; Functions unused in Org core.
|
2016-09-07 10:12:10 -04:00
|
|
|
|
(defun org-table-recognize-table.el ()
|
|
|
|
|
"If there is a table.el table nearby, recognize it and move into it."
|
2019-03-13 19:07:48 -04:00
|
|
|
|
(when (org-at-table.el-p)
|
2023-05-10 09:27:13 -04:00
|
|
|
|
(forward-line 0)
|
2016-09-07 10:12:10 -04:00
|
|
|
|
(unless (or (looking-at org-table-dataline-regexp)
|
2016-12-22 07:16:30 -05:00
|
|
|
|
(not (looking-at org-table1-hline-regexp)))
|
2016-09-07 10:12:10 -04:00
|
|
|
|
(forward-line)
|
|
|
|
|
(when (looking-at org-table-any-border-regexp)
|
2016-12-22 07:16:30 -05:00
|
|
|
|
(forward-line -2)))
|
2016-09-07 10:12:10 -04:00
|
|
|
|
(if (re-search-forward "|" (org-table-end t) t)
|
2016-12-22 07:16:30 -05:00
|
|
|
|
(progn
|
|
|
|
|
(require 'table)
|
|
|
|
|
(if (table--at-cell-p (point)) t
|
|
|
|
|
(message "recognizing table.el table...")
|
|
|
|
|
(table-recognize-table)
|
|
|
|
|
(message "recognizing table.el table...done")))
|
2016-09-07 10:12:10 -04:00
|
|
|
|
(error "This should not happen"))))
|
|
|
|
|
|
2018-04-28 18:39:26 -04:00
|
|
|
|
;; Not used since commit 6d1e3082, Feb 2010.
|
2016-09-07 10:12:10 -04:00
|
|
|
|
(make-obsolete 'org-table-recognize-table.el
|
2018-04-29 05:53:37 -04:00
|
|
|
|
"please notify Org mailing list if you use this function."
|
2021-05-16 02:57:08 -04:00
|
|
|
|
"9.0")
|
2016-09-07 10:12:10 -04:00
|
|
|
|
|
2018-04-28 18:39:26 -04:00
|
|
|
|
(defmacro org-preserve-lc (&rest body)
|
|
|
|
|
(declare (debug (body))
|
2018-04-29 05:53:37 -04:00
|
|
|
|
(obsolete "please notify Org mailing list if you use this function."
|
2021-05-16 02:57:08 -04:00
|
|
|
|
"9.2"))
|
2018-04-28 18:39:26 -04:00
|
|
|
|
(org-with-gensyms (line col)
|
|
|
|
|
`(let ((,line (org-current-line))
|
|
|
|
|
(,col (current-column)))
|
|
|
|
|
(unwind-protect
|
|
|
|
|
(progn ,@body)
|
|
|
|
|
(org-goto-line ,line)
|
|
|
|
|
(org-move-to-column ,col)))))
|
|
|
|
|
|
2018-04-29 05:53:37 -04:00
|
|
|
|
(defun org-version-check (version &rest _)
|
|
|
|
|
"Non-nil if VERSION is lower (older) than `emacs-version'."
|
|
|
|
|
(declare (obsolete "use `version<' or `fboundp' instead."
|
2021-05-16 02:57:08 -04:00
|
|
|
|
"9.2"))
|
2018-04-29 05:53:37 -04:00
|
|
|
|
(version< version emacs-version))
|
|
|
|
|
|
2016-09-07 10:12:10 -04:00
|
|
|
|
(defun org-remove-angle-brackets (s)
|
|
|
|
|
(org-unbracket-string "<" ">" s))
|
2021-05-16 02:57:08 -04:00
|
|
|
|
(make-obsolete 'org-remove-angle-brackets 'org-unbracket-string "9.0")
|
2016-09-07 10:12:10 -04:00
|
|
|
|
|
2024-02-09 11:47:57 -05:00
|
|
|
|
(defcustom org-capture-bookmark t
|
|
|
|
|
"When non-nil, add bookmark pointing at the last stored position when capturing."
|
|
|
|
|
:group 'org-capture
|
|
|
|
|
:version "24.3"
|
|
|
|
|
:type 'boolean)
|
|
|
|
|
(make-obsolete-variable
|
|
|
|
|
'org-capture-bookmark
|
|
|
|
|
"use `org-bookmark-names-plist' instead."
|
|
|
|
|
"9.7")
|
|
|
|
|
|
2016-10-30 04:20:10 -04:00
|
|
|
|
(defcustom org-publish-sitemap-file-entry-format "%t"
|
|
|
|
|
"Format string for site-map file entry.
|
|
|
|
|
You could use brackets to delimit on what part the link will be.
|
|
|
|
|
|
|
|
|
|
%t is the title.
|
|
|
|
|
%a is the author.
|
2024-01-30 07:41:14 -05:00
|
|
|
|
%d is the date."
|
2016-10-30 04:20:10 -04:00
|
|
|
|
:group 'org-export-publish
|
|
|
|
|
:type 'string)
|
|
|
|
|
(make-obsolete-variable
|
|
|
|
|
'org-publish-sitemap-file-entry-format
|
|
|
|
|
"set `:sitemap-format-entry' in `org-publish-project-alist' instead."
|
2021-05-16 02:57:08 -04:00
|
|
|
|
"9.1")
|
2016-10-30 04:20:10 -04:00
|
|
|
|
|
2017-01-22 07:47:45 -05:00
|
|
|
|
(defvar org-agenda-skip-regexp)
|
|
|
|
|
(defun org-agenda-skip-entry-when-regexp-matches ()
|
|
|
|
|
"Check if the current entry contains match for `org-agenda-skip-regexp'.
|
|
|
|
|
If yes, it returns the end position of this entry, causing agenda commands
|
|
|
|
|
to skip the entry but continuing the search in the subtree. This is a
|
|
|
|
|
function that can be put into `org-agenda-skip-function' for the duration
|
|
|
|
|
of a command."
|
2021-05-16 02:57:08 -04:00
|
|
|
|
(declare (obsolete "use `org-agenda-skip-if' instead." "9.1"))
|
2017-01-22 07:47:45 -05:00
|
|
|
|
(let ((end (save-excursion (org-end-of-subtree t)))
|
|
|
|
|
skip)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(setq skip (re-search-forward org-agenda-skip-regexp end t)))
|
|
|
|
|
(and skip end)))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-skip-subtree-when-regexp-matches ()
|
|
|
|
|
"Check if the current subtree contains match for `org-agenda-skip-regexp'.
|
|
|
|
|
If yes, it returns the end position of this tree, causing agenda commands
|
|
|
|
|
to skip this subtree. This is a function that can be put into
|
|
|
|
|
`org-agenda-skip-function' for the duration of a command."
|
2021-05-16 02:57:08 -04:00
|
|
|
|
(declare (obsolete "use `org-agenda-skip-if' instead." "9.1"))
|
2017-01-22 07:47:45 -05:00
|
|
|
|
(let ((end (save-excursion (org-end-of-subtree t)))
|
|
|
|
|
skip)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(setq skip (re-search-forward org-agenda-skip-regexp end t)))
|
|
|
|
|
(and skip end)))
|
|
|
|
|
|
|
|
|
|
(defun org-agenda-skip-entry-when-regexp-matches-in-subtree ()
|
|
|
|
|
"Check if the current subtree contains match for `org-agenda-skip-regexp'.
|
|
|
|
|
If yes, it returns the end position of the current entry (NOT the tree),
|
|
|
|
|
causing agenda commands to skip the entry but continuing the search in
|
|
|
|
|
the subtree. This is a function that can be put into
|
|
|
|
|
`org-agenda-skip-function' for the duration of a command. An important
|
|
|
|
|
use of this function is for the stuck project list."
|
2021-05-16 02:57:08 -04:00
|
|
|
|
(declare (obsolete "use `org-agenda-skip-if' instead." "9.1"))
|
2017-01-22 07:47:45 -05:00
|
|
|
|
(let ((end (save-excursion (org-end-of-subtree t)))
|
|
|
|
|
(entry-end (save-excursion (outline-next-heading) (1- (point))))
|
|
|
|
|
skip)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(setq skip (re-search-forward org-agenda-skip-regexp end t)))
|
|
|
|
|
(and skip entry-end)))
|
|
|
|
|
|
2017-02-08 16:24:32 -05:00
|
|
|
|
(define-obsolete-function-alias 'org-minutes-to-clocksum-string
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-duration-from-minutes "9.1")
|
2017-02-08 16:24:32 -05:00
|
|
|
|
|
|
|
|
|
(define-obsolete-function-alias 'org-hh:mm-string-to-minutes
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-duration-to-minutes "9.1")
|
2017-02-08 16:24:32 -05:00
|
|
|
|
|
|
|
|
|
(define-obsolete-function-alias 'org-duration-string-to-minutes
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-duration-to-minutes "9.1")
|
2017-02-08 16:24:32 -05:00
|
|
|
|
|
2017-02-21 12:44:55 -05:00
|
|
|
|
(make-obsolete-variable 'org-time-clocksum-format
|
2021-09-29 03:22:47 -04:00
|
|
|
|
"set `org-duration-format' instead." "9.1")
|
2017-02-08 16:24:32 -05:00
|
|
|
|
|
2017-02-21 12:44:55 -05:00
|
|
|
|
(make-obsolete-variable 'org-time-clocksum-use-fractional
|
2021-09-29 03:22:47 -04:00
|
|
|
|
"set `org-duration-format' instead." "9.1")
|
2017-02-08 16:24:32 -05:00
|
|
|
|
|
2017-02-21 12:44:55 -05:00
|
|
|
|
(make-obsolete-variable 'org-time-clocksum-fractional-format
|
2021-09-29 03:22:47 -04:00
|
|
|
|
"set `org-duration-format' instead." "9.1")
|
2017-02-08 16:24:32 -05:00
|
|
|
|
|
2017-02-21 12:44:55 -05:00
|
|
|
|
(make-obsolete-variable 'org-time-clocksum-use-effort-durations
|
2021-09-29 03:22:47 -04:00
|
|
|
|
"set `org-duration-units' instead." "9.1")
|
2017-02-08 16:24:32 -05:00
|
|
|
|
|
2017-05-01 09:33:09 -04:00
|
|
|
|
(define-obsolete-function-alias 'org-babel-number-p
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-babel--string-to-number "9.0")
|
2017-05-01 09:33:09 -04:00
|
|
|
|
|
2017-06-05 09:04:23 -04:00
|
|
|
|
(define-obsolete-variable-alias 'org-usenet-links-prefer-google
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-gnus-prefer-web-links "9.1")
|
2017-06-05 09:04:23 -04:00
|
|
|
|
|
2017-06-14 13:11:33 -04:00
|
|
|
|
(define-obsolete-variable-alias 'org-texinfo-def-table-markup
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-texinfo-table-default-markup "9.1")
|
2017-06-14 13:11:33 -04:00
|
|
|
|
|
2019-02-25 07:46:41 -05:00
|
|
|
|
(define-obsolete-variable-alias 'org-agenda-overriding-columns-format
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-overriding-columns-format "9.2.2")
|
2019-02-25 07:46:41 -05:00
|
|
|
|
|
2018-11-26 18:04:41 -05:00
|
|
|
|
(define-obsolete-variable-alias 'org-doi-server-url
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-link-doi-server-url "9.3")
|
2018-11-26 18:04:41 -05:00
|
|
|
|
|
|
|
|
|
(define-obsolete-variable-alias 'org-email-link-description-format
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-link-email-description-format "9.3")
|
2018-11-26 18:04:41 -05:00
|
|
|
|
|
|
|
|
|
(define-obsolete-variable-alias 'org-make-link-description-function
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-link-make-description-function "9.3")
|
2018-11-26 18:04:41 -05:00
|
|
|
|
|
|
|
|
|
(define-obsolete-variable-alias 'org-from-is-user-regexp
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-link-from-user-regexp "9.3")
|
2018-11-26 18:04:41 -05:00
|
|
|
|
|
|
|
|
|
(define-obsolete-variable-alias 'org-descriptive-links
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-link-descriptive "9.3")
|
2018-11-26 18:04:41 -05:00
|
|
|
|
|
|
|
|
|
(define-obsolete-variable-alias 'org-context-in-file-links
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-link-context-for-files "9.3")
|
2018-11-26 18:04:41 -05:00
|
|
|
|
|
|
|
|
|
(define-obsolete-variable-alias 'org-keep-stored-link-after-insertion
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-link-keep-stored-after-insertion "9.3")
|
2018-11-26 18:04:41 -05:00
|
|
|
|
|
|
|
|
|
(define-obsolete-variable-alias 'org-display-internal-link-with-indirect-buffer
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-link-use-indirect-buffer-for-internals "9.3")
|
2018-11-26 18:04:41 -05:00
|
|
|
|
|
|
|
|
|
(define-obsolete-variable-alias 'org-confirm-shell-link-function
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-link-shell-confirm-function "9.3")
|
2018-11-26 18:04:41 -05:00
|
|
|
|
|
|
|
|
|
(define-obsolete-variable-alias 'org-confirm-shell-link-not-regexp
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-link-shell-skip-confirm-regexp "9.3")
|
2018-11-26 18:04:41 -05:00
|
|
|
|
|
|
|
|
|
(define-obsolete-variable-alias 'org-confirm-elisp-link-function
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-link-elisp-confirm-function "9.3")
|
2018-11-26 18:04:41 -05:00
|
|
|
|
|
|
|
|
|
(define-obsolete-variable-alias 'org-confirm-elisp-link-not-regexp
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-link-elisp-skip-confirm-regexp "9.3")
|
2018-11-26 18:04:41 -05:00
|
|
|
|
|
|
|
|
|
(define-obsolete-function-alias 'org-file-complete-link
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-link-complete-file "9.3")
|
2018-11-26 18:04:41 -05:00
|
|
|
|
|
|
|
|
|
(define-obsolete-function-alias 'org-email-link-description
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-link-email-description "9.3")
|
2018-11-26 18:04:41 -05:00
|
|
|
|
|
|
|
|
|
(define-obsolete-function-alias 'org-make-link-string
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-link-make-string "9.3")
|
2018-11-26 18:04:41 -05:00
|
|
|
|
|
|
|
|
|
(define-obsolete-function-alias 'org-store-link-props
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-link-store-props "9.3")
|
2018-11-26 18:04:41 -05:00
|
|
|
|
|
|
|
|
|
(define-obsolete-function-alias 'org-add-link-props
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-link-add-props "9.3")
|
2018-11-26 18:04:41 -05:00
|
|
|
|
|
|
|
|
|
(define-obsolete-function-alias 'org-make-org-heading-search-string
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-link-heading-search-string "9.3")
|
2018-11-26 18:04:41 -05:00
|
|
|
|
|
|
|
|
|
(define-obsolete-function-alias 'org-make-link-regexps
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-link-make-regexps "9.3")
|
2018-11-26 18:04:41 -05:00
|
|
|
|
|
Org document property-drawers
Add functionality to define property-blocks on document level, in
addition to at headline level.
* doc/org-manual.org:
* etc/ORG-NEWS: Document new functionality.
* lisp/org.el (org-keyword-regexp): Define constant instead of
hardcoding.
(org-file-properties): Renamed, see next line.
(org-keyword-properties): Renamed from above. Due to the fact that
properties can be defined for the whole document using property
drawers this local variable needs a rename to make its name less
ambigous.
(org-refresh-properties, org-refresh-property, org-entry-properties)
(org-refresh-category-properties, org-get-property-block)
(org-entry-get-with-inheritance, org-entry-put)
(org-insert-property-drawer, org-end-of-subtree): Made to work before
first headline.
(org-at-property-block-p): New function to validate if point is at the
start of a property block.
(org-property-global-value): Renamed, see next line.
(org-property-global-or-keyword-value): Renamed from above to match
its functionality better.
(org-back-to-heading-or-point-min): New function to make a document
work as a level 0 node in the outline.
(org-at-keyword-p): Predicate function to answer to if we're currently
at a keyword line or not.
(org-up-heading-or-point-min): New function to make a document work as
a level 0 node in the outline.
* lisp/org-element.el (org-element--current-element): Can now detect
property-blocks before first headline according to it's positional
rules.
* lisp/org-attach.el (org-attach): Make it possible to call the
attachment dispatcher also before the first headline, since document
property drawers make attachments possible for the whole document
now.
* lisp/org-capture.el: Modified only due to rename of function in
org.el.
* lisp/org-compat.el (org-file-properties)
(org-property-global-value): Renamed functions declared obsolete.
* testing/lisp/test-org.el (org/insert-property-drawer)
(org/set-property, org/delete-property, org/delete-property-globally):
Additions of tests to check if they work before first headline.
(org/at-property-p, org/at-property-block-p, org/get-property-block)
(org/entry-get, org/refresh-properties): New tests
* testing/examples/property-inheritance.org: Switch from
property-keywords to a property-drawer in the testfile.
Functionality should be the same, but now using a document drawer
instead of property-keywords.
Reason for switching is that I'd like us to slowly depricate
property-keywords.
* testing/lisp/test-org-element.el:
* contrib/lisp/ox-taskjuggler.el: A comment is modified only due to
rename of function in org.el.
2019-05-26 16:13:09 -04:00
|
|
|
|
(define-obsolete-function-alias 'org-property-global-value
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-property-global-or-keyword-value "9.3")
|
Org document property-drawers
Add functionality to define property-blocks on document level, in
addition to at headline level.
* doc/org-manual.org:
* etc/ORG-NEWS: Document new functionality.
* lisp/org.el (org-keyword-regexp): Define constant instead of
hardcoding.
(org-file-properties): Renamed, see next line.
(org-keyword-properties): Renamed from above. Due to the fact that
properties can be defined for the whole document using property
drawers this local variable needs a rename to make its name less
ambigous.
(org-refresh-properties, org-refresh-property, org-entry-properties)
(org-refresh-category-properties, org-get-property-block)
(org-entry-get-with-inheritance, org-entry-put)
(org-insert-property-drawer, org-end-of-subtree): Made to work before
first headline.
(org-at-property-block-p): New function to validate if point is at the
start of a property block.
(org-property-global-value): Renamed, see next line.
(org-property-global-or-keyword-value): Renamed from above to match
its functionality better.
(org-back-to-heading-or-point-min): New function to make a document
work as a level 0 node in the outline.
(org-at-keyword-p): Predicate function to answer to if we're currently
at a keyword line or not.
(org-up-heading-or-point-min): New function to make a document work as
a level 0 node in the outline.
* lisp/org-element.el (org-element--current-element): Can now detect
property-blocks before first headline according to it's positional
rules.
* lisp/org-attach.el (org-attach): Make it possible to call the
attachment dispatcher also before the first headline, since document
property drawers make attachments possible for the whole document
now.
* lisp/org-capture.el: Modified only due to rename of function in
org.el.
* lisp/org-compat.el (org-file-properties)
(org-property-global-value): Renamed functions declared obsolete.
* testing/lisp/test-org.el (org/insert-property-drawer)
(org/set-property, org/delete-property, org/delete-property-globally):
Additions of tests to check if they work before first headline.
(org/at-property-p, org/at-property-block-p, org/get-property-block)
(org/entry-get, org/refresh-properties): New tests
* testing/examples/property-inheritance.org: Switch from
property-keywords to a property-drawer in the testfile.
Functionality should be the same, but now using a document drawer
instead of property-keywords.
Reason for switching is that I'd like us to slowly depricate
property-keywords.
* testing/lisp/test-org-element.el:
* contrib/lisp/ox-taskjuggler.el: A comment is modified only due to
rename of function in org.el.
2019-05-26 16:13:09 -04:00
|
|
|
|
|
2021-05-16 02:57:08 -04:00
|
|
|
|
(make-obsolete-variable 'org-file-properties 'org-keyword-properties "9.3")
|
2019-12-15 13:07:51 -05:00
|
|
|
|
|
2018-11-26 18:04:41 -05:00
|
|
|
|
(define-obsolete-variable-alias 'org-angle-link-re
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-link-angle-re "9.3")
|
2018-11-26 18:04:41 -05:00
|
|
|
|
|
|
|
|
|
(define-obsolete-variable-alias 'org-plain-link-re
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-link-plain-re "9.3")
|
2018-11-26 18:04:41 -05:00
|
|
|
|
|
|
|
|
|
(define-obsolete-variable-alias 'org-bracket-link-regexp
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-link-bracket-re "9.3")
|
2018-11-26 18:04:41 -05:00
|
|
|
|
|
|
|
|
|
(define-obsolete-variable-alias 'org-bracket-link-analytic-regexp
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-link-bracket-re "9.3")
|
2018-11-26 18:04:41 -05:00
|
|
|
|
|
|
|
|
|
(define-obsolete-variable-alias 'org-any-link-re
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-link-any-re "9.3")
|
2018-11-26 18:04:41 -05:00
|
|
|
|
|
|
|
|
|
(define-obsolete-function-alias 'org-open-link-from-string
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-link-open-from-string "9.3")
|
2018-11-26 18:04:41 -05:00
|
|
|
|
|
|
|
|
|
(define-obsolete-function-alias 'org-add-angle-brackets
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-link-add-angle-brackets "9.3")
|
2018-11-26 18:04:41 -05:00
|
|
|
|
|
2017-12-06 10:03:23 -05:00
|
|
|
|
;; The function was made obsolete by commit 65399674d5 of 2013-02-22.
|
|
|
|
|
;; This make-obsolete call was added 2016-09-01.
|
2017-07-02 03:19:09 -04:00
|
|
|
|
(make-obsolete 'org-capture-import-remember-templates
|
|
|
|
|
"use the `org-capture-templates' variable instead."
|
2021-05-16 02:57:08 -04:00
|
|
|
|
"9.0")
|
2017-07-02 03:19:09 -04:00
|
|
|
|
|
2017-12-06 10:03:23 -05:00
|
|
|
|
(defun org-show-block-all ()
|
|
|
|
|
"Unfold all blocks in the current buffer."
|
|
|
|
|
(interactive)
|
2022-01-16 02:07:25 -05:00
|
|
|
|
(org-fold-show-all '(blocks)))
|
2017-12-06 10:03:23 -05:00
|
|
|
|
|
|
|
|
|
(make-obsolete 'org-show-block-all
|
|
|
|
|
"use `org-show-all' instead."
|
2021-05-16 02:57:08 -04:00
|
|
|
|
"9.2")
|
2017-12-06 10:03:23 -05:00
|
|
|
|
|
2021-05-16 02:57:08 -04:00
|
|
|
|
(define-obsolete-function-alias 'org-get-tags-at 'org-get-tags "9.2")
|
2018-04-18 11:55:10 -04:00
|
|
|
|
|
2018-04-18 12:07:29 -04:00
|
|
|
|
(defun org-get-local-tags ()
|
|
|
|
|
"Get a list of tags defined in the current headline."
|
2021-05-16 02:57:08 -04:00
|
|
|
|
(declare (obsolete "use `org-get-tags' instead." "9.2"))
|
2018-04-18 12:07:29 -04:00
|
|
|
|
(org-get-tags nil 'local))
|
|
|
|
|
|
|
|
|
|
(defun org-get-local-tags-at (&optional pos)
|
|
|
|
|
"Get a list of tags defined in the current headline."
|
2021-05-16 02:57:08 -04:00
|
|
|
|
(declare (obsolete "use `org-get-tags' instead." "9.2"))
|
2018-04-18 12:07:29 -04:00
|
|
|
|
(org-get-tags pos 'local))
|
2017-02-08 16:24:32 -05:00
|
|
|
|
|
2018-04-18 17:57:51 -04:00
|
|
|
|
(defun org-get-tags-string ()
|
|
|
|
|
"Get the TAGS string in the current headline."
|
2021-05-16 02:57:08 -04:00
|
|
|
|
(declare (obsolete "use `org-make-tag-string' instead." "9.2"))
|
2018-04-18 17:57:51 -04:00
|
|
|
|
(org-make-tag-string (org-get-tags nil t)))
|
|
|
|
|
|
2021-05-16 02:57:08 -04:00
|
|
|
|
(define-obsolete-function-alias 'org-set-tags-to 'org-set-tags "9.2")
|
2018-04-20 04:45:19 -04:00
|
|
|
|
|
|
|
|
|
(defun org-align-all-tags ()
|
|
|
|
|
"Align the tags in all headings."
|
2021-05-16 02:57:08 -04:00
|
|
|
|
(declare (obsolete "use `org-align-tags' instead." "9.2"))
|
2018-04-20 04:45:19 -04:00
|
|
|
|
(org-align-tags t))
|
|
|
|
|
|
2020-05-09 06:48:53 -04:00
|
|
|
|
(define-obsolete-function-alias
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-at-property-block-p 'org-at-property-drawer-p "9.4")
|
2020-05-09 06:48:53 -04:00
|
|
|
|
|
2020-04-18 06:01:45 -04:00
|
|
|
|
(defun org-flag-drawer (flag &optional element beg end)
|
|
|
|
|
"When FLAG is non-nil, hide the drawer we are at.
|
|
|
|
|
Otherwise make it visible.
|
|
|
|
|
|
|
|
|
|
When optional argument ELEMENT is a parsed drawer, as returned by
|
|
|
|
|
`org-element-at-point', hide or show that drawer instead.
|
|
|
|
|
|
|
|
|
|
When buffer positions BEG and END are provided, hide or show that
|
|
|
|
|
region as a drawer without further ado."
|
2021-05-16 02:57:08 -04:00
|
|
|
|
(declare (obsolete "use `org-hide-drawer-toggle' instead." "9.4"))
|
2024-04-06 08:21:10 -04:00
|
|
|
|
(if (and beg end) (org-fold-region beg end flag 'drawer)
|
2020-04-18 06:01:45 -04:00
|
|
|
|
(let ((drawer
|
|
|
|
|
(or element
|
|
|
|
|
(and (save-excursion
|
2023-05-10 09:27:13 -04:00
|
|
|
|
(forward-line 0)
|
2020-04-18 06:01:45 -04:00
|
|
|
|
(looking-at-p "^[ \t]*:\\(\\(?:\\w\\|[-_]\\)+\\):[ \t]*$"))
|
|
|
|
|
(org-element-at-point)))))
|
2023-05-16 06:41:53 -04:00
|
|
|
|
(when (org-element-type-p drawer '(drawer property-drawer))
|
2023-05-03 10:26:41 -04:00
|
|
|
|
(let ((post (org-element-post-affiliated drawer)))
|
2022-01-16 02:07:25 -05:00
|
|
|
|
(org-fold-region
|
2020-04-18 06:01:45 -04:00
|
|
|
|
(save-excursion (goto-char post) (line-end-position))
|
2023-05-03 10:26:41 -04:00
|
|
|
|
(save-excursion (goto-char (org-element-end drawer))
|
2020-04-18 06:01:45 -04:00
|
|
|
|
(skip-chars-backward " \t\n")
|
|
|
|
|
(line-end-position))
|
2024-04-06 08:21:10 -04:00
|
|
|
|
flag 'drawer)
|
2020-04-18 06:01:45 -04:00
|
|
|
|
;; When the drawer is hidden away, make sure point lies in
|
|
|
|
|
;; a visible part of the buffer.
|
|
|
|
|
(when (invisible-p (max (1- (point)) (point-min)))
|
|
|
|
|
(goto-char post)))))))
|
|
|
|
|
|
2020-04-18 06:13:34 -04:00
|
|
|
|
(defun org-hide-block-toggle-maybe ()
|
|
|
|
|
"Toggle visibility of block at point.
|
|
|
|
|
Unlike to `org-hide-block-toggle', this function does not throw
|
|
|
|
|
an error. Return a non-nil value when toggling is successful."
|
2021-05-16 02:57:08 -04:00
|
|
|
|
(declare (obsolete "use `org-hide-block-toggle' instead." "9.4"))
|
2020-04-18 06:13:34 -04:00
|
|
|
|
(interactive)
|
2022-01-16 02:07:25 -05:00
|
|
|
|
(org-fold-hide-block-toggle nil t))
|
2020-04-18 06:13:34 -04:00
|
|
|
|
|
2020-04-18 06:16:27 -04:00
|
|
|
|
(defun org-hide-block-toggle-all ()
|
|
|
|
|
"Toggle the visibility of all blocks in the current buffer."
|
|
|
|
|
(declare (obsolete "please notify Org mailing list if you use this function."
|
2021-05-16 02:57:08 -04:00
|
|
|
|
"9.4"))
|
2020-04-18 06:16:27 -04:00
|
|
|
|
(let ((start (point-min))
|
|
|
|
|
(end (point-max)))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char start)
|
|
|
|
|
(while (and (< (point) end)
|
|
|
|
|
(re-search-forward "^[ \t]*#\\+begin_?\
|
2023-04-25 15:06:50 -04:00
|
|
|
|
\\([^ \n]+\\)\\(\\([^\n]+\\)\\)?\n\\(\\(?:.\\|\n\\)+?\\)#\\+end_?\\1[ \t]*$" end t))
|
2020-04-18 06:16:27 -04:00
|
|
|
|
(save-excursion
|
|
|
|
|
(save-match-data
|
|
|
|
|
(goto-char (match-beginning 0))
|
2022-01-16 02:07:25 -05:00
|
|
|
|
(org-fold-hide-block-toggle)))))))
|
2020-04-18 06:16:27 -04:00
|
|
|
|
|
2020-05-05 13:01:07 -04:00
|
|
|
|
(defun org-return-indent ()
|
|
|
|
|
"Goto next table row or insert a newline and indent.
|
|
|
|
|
Calls `org-table-next-row' or `newline-and-indent', depending on
|
|
|
|
|
context. See the individual commands for more information."
|
|
|
|
|
(declare (obsolete "use `org-return' with INDENT set to t instead."
|
2021-05-16 02:57:08 -04:00
|
|
|
|
"9.4"))
|
2020-05-05 13:01:07 -04:00
|
|
|
|
(interactive)
|
|
|
|
|
(org-return t))
|
|
|
|
|
|
2018-04-29 06:02:01 -04:00
|
|
|
|
(defmacro org-with-silent-modifications (&rest body)
|
2021-05-16 02:57:08 -04:00
|
|
|
|
(declare (obsolete "use `with-silent-modifications' instead." "9.2")
|
2018-04-29 06:02:01 -04:00
|
|
|
|
(debug (body)))
|
|
|
|
|
`(with-silent-modifications ,@body))
|
|
|
|
|
|
2018-10-06 03:40:33 -04:00
|
|
|
|
(define-obsolete-function-alias 'org-babel-strip-quotes
|
2021-05-16 02:57:08 -04:00
|
|
|
|
'org-strip-quotes "9.2")
|
2018-10-06 03:40:33 -04:00
|
|
|
|
|
2020-02-23 06:57:07 -05:00
|
|
|
|
(define-obsolete-variable-alias 'org-sort-agenda-notime-is-late
|
|
|
|
|
'org-agenda-sort-notime-is-late "9.4")
|
|
|
|
|
|
|
|
|
|
(define-obsolete-variable-alias 'org-sort-agenda-noeffort-is-high
|
|
|
|
|
'org-agenda-sort-noeffort-is-high "9.4")
|
|
|
|
|
|
2020-03-12 04:55:00 -04:00
|
|
|
|
(defconst org-maybe-keyword-time-regexp
|
|
|
|
|
(concat "\\(\\<\\(\\(?:CLO\\(?:CK\\|SED\\)\\|DEADLINE\\|SCHEDULED\\):\\)\\)?"
|
2020-02-20 09:45:44 -05:00
|
|
|
|
" *\\([[<][0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [^]\r\n>]*[]>]"
|
2020-03-12 04:55:00 -04:00
|
|
|
|
"\\|"
|
|
|
|
|
"<%%([^\r\n>]*>\\)")
|
|
|
|
|
"Matches a timestamp, possibly preceded by a keyword.")
|
2020-03-12 04:08:27 -04:00
|
|
|
|
(make-obsolete-variable
|
|
|
|
|
'org-maybe-keyword-time-regexp
|
|
|
|
|
"use `org-planning-line-re', followed by `org-ts-regexp-both' instead."
|
2021-05-16 02:57:08 -04:00
|
|
|
|
"9.4")
|
2020-03-12 04:08:27 -04:00
|
|
|
|
|
2021-05-16 02:57:08 -04:00
|
|
|
|
(define-obsolete-function-alias 'org-copy 'org-refile-copy "9.4")
|
2021-01-07 00:14:27 -05:00
|
|
|
|
|
2021-09-19 18:27:02 -04:00
|
|
|
|
(define-obsolete-function-alias 'org-get-last-sibling 'org-get-previous-sibling "9.4")
|
|
|
|
|
|
2022-07-24 12:39:25 -04:00
|
|
|
|
(define-obsolete-function-alias 'org-publish-cache-ctime-of-src
|
|
|
|
|
'org-publish-cache-mtime-of-src "9.6")
|
|
|
|
|
|
2022-03-31 20:02:38 -04:00
|
|
|
|
(define-obsolete-function-alias 'org-truely-invisible-p
|
|
|
|
|
'org-truly-invisible-p "9.6"
|
|
|
|
|
"Compatibility alias for legacy misspelling of `org-truly-invisible-p'.")
|
|
|
|
|
|
2022-07-23 10:16:54 -04:00
|
|
|
|
|
|
|
|
|
(defconst org-latex-babel-language-alist
|
|
|
|
|
'(("af" . "afrikaans")
|
|
|
|
|
("bg" . "bulgarian")
|
|
|
|
|
("ca" . "catalan")
|
|
|
|
|
("cs" . "czech")
|
|
|
|
|
("cy" . "welsh")
|
|
|
|
|
("da" . "danish")
|
|
|
|
|
("de" . "germanb")
|
|
|
|
|
("de-at" . "naustrian")
|
|
|
|
|
("de-de" . "ngerman")
|
|
|
|
|
("el" . "greek")
|
|
|
|
|
("en" . "english")
|
|
|
|
|
("en-au" . "australian")
|
|
|
|
|
("en-ca" . "canadian")
|
|
|
|
|
("en-gb" . "british")
|
|
|
|
|
("en-ie" . "irish")
|
|
|
|
|
("en-nz" . "newzealand")
|
|
|
|
|
("en-us" . "american")
|
|
|
|
|
("es" . "spanish")
|
|
|
|
|
("et" . "estonian")
|
|
|
|
|
("eu" . "basque")
|
|
|
|
|
("fi" . "finnish")
|
|
|
|
|
("fr" . "french")
|
|
|
|
|
("fr-ca" . "canadien")
|
|
|
|
|
("gl" . "galician")
|
|
|
|
|
("hr" . "croatian")
|
|
|
|
|
("hu" . "hungarian")
|
|
|
|
|
("id" . "indonesian")
|
|
|
|
|
("is" . "icelandic")
|
|
|
|
|
("it" . "italian")
|
|
|
|
|
("la" . "latin")
|
|
|
|
|
("ms" . "malay")
|
|
|
|
|
("nl" . "dutch")
|
|
|
|
|
("nb" . "norsk")
|
|
|
|
|
("nn" . "nynorsk")
|
|
|
|
|
("no" . "norsk")
|
|
|
|
|
("pl" . "polish")
|
|
|
|
|
("pt" . "portuguese")
|
|
|
|
|
("pt-br" . "brazilian")
|
|
|
|
|
("ro" . "romanian")
|
|
|
|
|
("ru" . "russian")
|
|
|
|
|
("sa" . "sanskrit")
|
|
|
|
|
("sb" . "uppersorbian")
|
|
|
|
|
("sk" . "slovak")
|
|
|
|
|
("sl" . "slovene")
|
|
|
|
|
("sq" . "albanian")
|
|
|
|
|
("sr" . "serbian")
|
|
|
|
|
("sv" . "swedish")
|
|
|
|
|
("ta" . "tamil")
|
|
|
|
|
("tr" . "turkish")
|
|
|
|
|
("uk" . "ukrainian"))
|
|
|
|
|
"Alist between language code and corresponding Babel option.")
|
|
|
|
|
|
|
|
|
|
(defconst org-latex-polyglossia-language-alist
|
|
|
|
|
'(("am" "amharic")
|
|
|
|
|
("ar" "arabic")
|
|
|
|
|
("ast" "asturian")
|
|
|
|
|
("bg" "bulgarian")
|
|
|
|
|
("bn" "bengali")
|
|
|
|
|
("bo" "tibetan")
|
|
|
|
|
("br" "breton")
|
|
|
|
|
("ca" "catalan")
|
|
|
|
|
("cop" "coptic")
|
|
|
|
|
("cs" "czech")
|
|
|
|
|
("cy" "welsh")
|
|
|
|
|
("da" "danish")
|
|
|
|
|
("de" "german" "german")
|
|
|
|
|
("de-at" "german" "austrian")
|
|
|
|
|
("de-de" "german" "german")
|
|
|
|
|
("dsb" "lsorbian")
|
|
|
|
|
("dv" "divehi")
|
|
|
|
|
("el" "greek")
|
|
|
|
|
("en" "english" "usmax")
|
|
|
|
|
("en-au" "english" "australian")
|
|
|
|
|
("en-gb" "english" "uk")
|
|
|
|
|
("en-nz" "english" "newzealand")
|
|
|
|
|
("en-us" "english" "usmax")
|
|
|
|
|
("eo" "esperanto")
|
|
|
|
|
("es" "spanish")
|
|
|
|
|
("et" "estonian")
|
|
|
|
|
("eu" "basque")
|
|
|
|
|
("fa" "farsi")
|
|
|
|
|
("fi" "finnish")
|
|
|
|
|
("fr" "french")
|
|
|
|
|
("fu" "friulan")
|
|
|
|
|
("ga" "irish")
|
|
|
|
|
("gd" "scottish")
|
|
|
|
|
("gl" "galician")
|
|
|
|
|
("he" "hebrew")
|
|
|
|
|
("hi" "hindi")
|
|
|
|
|
("hr" "croatian")
|
|
|
|
|
("hsb" "usorbian")
|
|
|
|
|
("hu" "magyar")
|
|
|
|
|
("hy" "armenian")
|
|
|
|
|
("ia" "interlingua")
|
|
|
|
|
("id" "bahasai")
|
|
|
|
|
("is" "icelandic")
|
|
|
|
|
("it" "italian")
|
|
|
|
|
("kn" "kannada")
|
|
|
|
|
("la" "latin" "modern")
|
|
|
|
|
("la-classic" "latin" "classic")
|
|
|
|
|
("la-medieval" "latin" "medieval")
|
|
|
|
|
("la-modern" "latin" "modern")
|
|
|
|
|
("lo" "lao")
|
|
|
|
|
("lt" "lithuanian")
|
|
|
|
|
("lv" "latvian")
|
|
|
|
|
("ml" "malayalam")
|
|
|
|
|
("mr" "maranthi")
|
|
|
|
|
("nb" "norsk")
|
|
|
|
|
("nko" "nko")
|
|
|
|
|
("nl" "dutch")
|
|
|
|
|
("nn" "nynorsk")
|
|
|
|
|
("no" "norsk")
|
|
|
|
|
("oc" "occitan")
|
|
|
|
|
("pl" "polish")
|
|
|
|
|
("pms" "piedmontese")
|
|
|
|
|
("pt" "portuges")
|
|
|
|
|
("pt-br" "brazilian")
|
|
|
|
|
("rm" "romansh")
|
|
|
|
|
("ro" "romanian")
|
|
|
|
|
("ru" "russian")
|
|
|
|
|
("sa" "sanskrit")
|
|
|
|
|
("se" "samin")
|
|
|
|
|
("sk" "slovak")
|
|
|
|
|
("sl" "slovenian")
|
|
|
|
|
("sq" "albanian")
|
|
|
|
|
("sr" "serbian")
|
|
|
|
|
("sv" "swedish")
|
|
|
|
|
("syr" "syriac")
|
|
|
|
|
("ta" "tamil")
|
|
|
|
|
("te" "telugu")
|
|
|
|
|
("th" "thai")
|
|
|
|
|
("tk" "turkmen")
|
|
|
|
|
("tr" "turkish")
|
|
|
|
|
("uk" "ukrainian")
|
|
|
|
|
("ur" "urdu")
|
|
|
|
|
("vi" "vietnamese"))
|
|
|
|
|
"Alist between language code and corresponding Polyglossia option.")
|
|
|
|
|
|
2022-07-19 10:51:55 -04:00
|
|
|
|
(make-obsolete-variable 'org-latex-babel-language-alist
|
|
|
|
|
"set `org-latex-language-alist' instead." "9.6")
|
|
|
|
|
|
|
|
|
|
(make-obsolete-variable 'org-latex-polyglossia-language-alist
|
|
|
|
|
"set `org-latex-language-alist' instead." "9.6")
|
|
|
|
|
|
2023-01-27 10:47:05 -05:00
|
|
|
|
(defconst org-babel-python-mode 'python
|
|
|
|
|
"Python mode for use in running python interactively.")
|
|
|
|
|
|
|
|
|
|
(make-obsolete-variable
|
|
|
|
|
'org-babel-python-mode
|
|
|
|
|
"Only the built-in Python mode is supported in ob-python now."
|
|
|
|
|
"9.7")
|
|
|
|
|
|
2023-03-09 10:11:27 -05:00
|
|
|
|
(define-obsolete-function-alias 'ob-clojure-eval-with-babashka
|
|
|
|
|
#'ob-clojure-eval-with-cmd "9.7")
|
|
|
|
|
|
2023-05-18 07:33:15 -04:00
|
|
|
|
(define-obsolete-function-alias 'org-export-get-parent
|
|
|
|
|
'org-element-parent "9.7")
|
|
|
|
|
(define-obsolete-function-alias 'org-export-get-parent-element
|
|
|
|
|
'org-element-parent-element "9.7")
|
2023-05-03 08:56:35 -04:00
|
|
|
|
|
2023-12-05 08:30:55 -05:00
|
|
|
|
(define-obsolete-function-alias 'org-print-speed-command
|
|
|
|
|
'org--print-speed-command "9.7"
|
|
|
|
|
"Internal function. Subject of unannounced changes.")
|
|
|
|
|
|
2016-07-18 17:43:01 -04:00
|
|
|
|
;;;; Obsolete link types
|
|
|
|
|
|
2018-11-26 18:04:41 -05:00
|
|
|
|
(eval-after-load 'ol
|
2016-07-20 15:44:10 -04:00
|
|
|
|
'(progn
|
|
|
|
|
(org-link-set-parameters "file+emacs") ;since Org 9.0
|
|
|
|
|
(org-link-set-parameters "file+sys"))) ;since Org 9.0
|
2016-07-18 17:43:01 -04:00
|
|
|
|
|
|
|
|
|
|
2022-07-19 10:51:55 -04:00
|
|
|
|
|
|
|
|
|
|
2016-06-30 11:45:04 -04:00
|
|
|
|
|
|
|
|
|
;;; Miscellaneous functions
|
2008-03-22 11:52:18 -04:00
|
|
|
|
|
2009-10-13 03:41:40 -04:00
|
|
|
|
(defun org-get-x-clipboard (value)
|
Remove final parts of XEmacs compatibility code
* lisp/org-compat.el: Declare `org-add-hook', `org-decompose-region',
`org-detach-overlay', `org-file-equal-p', `org-float-time',
`org-indent-line-to', `org-indent-to-column', `org-looking-at-p',
`org-looking-back', `org-propertize', `org-re' and
`org-select-frame-set-input-focus' as obsolete.
(org-overlay-display, org-overlay-before-string, org-find-overlays):
Move to "org.el"
(org-xemacs-key-equivalents, org-xemacs-p): Remove variables.
(org-region-active-p): Drop XEmacs support.
(org-xemacs-without-invisibility): Remove macro.
(org-get-x-clipboard-compat): Remove function.
* lisp/org-macs.el (org-match-string-no-properties): Remove function.
* lisp/ob-core.el:
* lisp/org-agenda.el:
* lisp/org-archive.el:
* lisp/org-clock.el:
* lisp/org-colview.el:
* lisp/org-crypt.el:
* lisp/org-element.el:
* lisp/org-faces.el:
* lisp/org-feed.el:
* lisp/org-footnote.el:
* lisp/org-habit.el:
* lisp/org-id.el:
* lisp/org-indent.el:
* lisp/org-inlinetask.el:
* lisp/org-lint.el:
* lisp/org-list.el:
* lisp/org-mouse.el:
* lisp/org-pcomplete.el:
* lisp/org-src.el:
* lisp/org-table.el:
* lisp/org-timer.el:
* lisp/org.el:
* lisp/ox-ascii.el:
* lisp/ox-odt.el:
* lisp/ox.el:
* contrib/lisp/org-notify.el:
* contrib/lisp/ox-taskjuggler.el:
* contrib/lisp/org-wikinodes.el:
* testing/lisp/test-org-src.el:
* testing/lisp/test-org.el: Silence byte-compiler.
2016-05-26 06:18:00 -04:00
|
|
|
|
"Get the value of the X or Windows clipboard."
|
2016-09-07 11:16:33 -04:00
|
|
|
|
(cond ((and (eq window-system 'x)
|
2016-12-22 07:16:30 -05:00
|
|
|
|
(fboundp 'gui-get-selection)) ;Silence byte-compiler.
|
|
|
|
|
(org-no-properties
|
|
|
|
|
(ignore-errors
|
|
|
|
|
(or (gui-get-selection value 'UTF8_STRING)
|
|
|
|
|
(gui-get-selection value 'COMPOUND_TEXT)
|
|
|
|
|
(gui-get-selection value 'STRING)
|
|
|
|
|
(gui-get-selection value 'TEXT)))))
|
|
|
|
|
((and (eq window-system 'w32) (fboundp 'w32-get-clipboard-data))
|
|
|
|
|
(w32-get-clipboard-data))))
|
2009-10-13 03:41:40 -04:00
|
|
|
|
|
2017-10-22 09:01:43 -04:00
|
|
|
|
|
Remove final parts of XEmacs compatibility code
* lisp/org-compat.el: Declare `org-add-hook', `org-decompose-region',
`org-detach-overlay', `org-file-equal-p', `org-float-time',
`org-indent-line-to', `org-indent-to-column', `org-looking-at-p',
`org-looking-back', `org-propertize', `org-re' and
`org-select-frame-set-input-focus' as obsolete.
(org-overlay-display, org-overlay-before-string, org-find-overlays):
Move to "org.el"
(org-xemacs-key-equivalents, org-xemacs-p): Remove variables.
(org-region-active-p): Drop XEmacs support.
(org-xemacs-without-invisibility): Remove macro.
(org-get-x-clipboard-compat): Remove function.
* lisp/org-macs.el (org-match-string-no-properties): Remove function.
* lisp/ob-core.el:
* lisp/org-agenda.el:
* lisp/org-archive.el:
* lisp/org-clock.el:
* lisp/org-colview.el:
* lisp/org-crypt.el:
* lisp/org-element.el:
* lisp/org-faces.el:
* lisp/org-feed.el:
* lisp/org-footnote.el:
* lisp/org-habit.el:
* lisp/org-id.el:
* lisp/org-indent.el:
* lisp/org-inlinetask.el:
* lisp/org-lint.el:
* lisp/org-list.el:
* lisp/org-mouse.el:
* lisp/org-pcomplete.el:
* lisp/org-src.el:
* lisp/org-table.el:
* lisp/org-timer.el:
* lisp/org.el:
* lisp/ox-ascii.el:
* lisp/ox-odt.el:
* lisp/ox.el:
* contrib/lisp/org-notify.el:
* contrib/lisp/ox-taskjuggler.el:
* contrib/lisp/org-wikinodes.el:
* testing/lisp/test-org-src.el:
* testing/lisp/test-org.el: Silence byte-compiler.
2016-05-26 06:18:00 -04:00
|
|
|
|
;;; Region compatibility
|
2008-03-22 11:52:18 -04:00
|
|
|
|
|
|
|
|
|
(defvar org-ignore-region nil
|
2013-03-26 07:50:14 -04:00
|
|
|
|
"Non-nil means temporarily disable the active region.")
|
2008-03-22 11:52:18 -04:00
|
|
|
|
|
|
|
|
|
(defun org-region-active-p ()
|
2016-06-26 08:35:22 -04:00
|
|
|
|
"Non-nil when the region active.
|
|
|
|
|
Unlike to `use-region-p', this function also checks
|
|
|
|
|
`org-ignore-region'."
|
|
|
|
|
(and (not org-ignore-region) (use-region-p)))
|
2008-03-22 11:52:18 -04:00
|
|
|
|
|
2009-02-20 11:20:46 -05:00
|
|
|
|
(defun org-cursor-to-region-beginning ()
|
|
|
|
|
(when (and (org-region-active-p)
|
2016-12-22 07:16:30 -05:00
|
|
|
|
(> (point) (region-beginning)))
|
2009-02-20 11:20:46 -05:00
|
|
|
|
(exchange-point-and-mark)))
|
|
|
|
|
|
2017-10-22 09:01:43 -04:00
|
|
|
|
|
Remove final parts of XEmacs compatibility code
* lisp/org-compat.el: Declare `org-add-hook', `org-decompose-region',
`org-detach-overlay', `org-file-equal-p', `org-float-time',
`org-indent-line-to', `org-indent-to-column', `org-looking-at-p',
`org-looking-back', `org-propertize', `org-re' and
`org-select-frame-set-input-focus' as obsolete.
(org-overlay-display, org-overlay-before-string, org-find-overlays):
Move to "org.el"
(org-xemacs-key-equivalents, org-xemacs-p): Remove variables.
(org-region-active-p): Drop XEmacs support.
(org-xemacs-without-invisibility): Remove macro.
(org-get-x-clipboard-compat): Remove function.
* lisp/org-macs.el (org-match-string-no-properties): Remove function.
* lisp/ob-core.el:
* lisp/org-agenda.el:
* lisp/org-archive.el:
* lisp/org-clock.el:
* lisp/org-colview.el:
* lisp/org-crypt.el:
* lisp/org-element.el:
* lisp/org-faces.el:
* lisp/org-feed.el:
* lisp/org-footnote.el:
* lisp/org-habit.el:
* lisp/org-id.el:
* lisp/org-indent.el:
* lisp/org-inlinetask.el:
* lisp/org-lint.el:
* lisp/org-list.el:
* lisp/org-mouse.el:
* lisp/org-pcomplete.el:
* lisp/org-src.el:
* lisp/org-table.el:
* lisp/org-timer.el:
* lisp/org.el:
* lisp/ox-ascii.el:
* lisp/ox-odt.el:
* lisp/ox.el:
* contrib/lisp/org-notify.el:
* contrib/lisp/ox-taskjuggler.el:
* contrib/lisp/org-wikinodes.el:
* testing/lisp/test-org-src.el:
* testing/lisp/test-org.el: Silence byte-compiler.
2016-05-26 06:18:00 -04:00
|
|
|
|
;;; Invisibility compatibility
|
2008-03-22 11:52:18 -04:00
|
|
|
|
|
|
|
|
|
(defun org-in-invisibility-spec-p (arg)
|
|
|
|
|
"Is ARG a member of `buffer-invisibility-spec'?"
|
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.
2018-05-09 21:02:35 -04:00
|
|
|
|
(when (consp buffer-invisibility-spec)
|
|
|
|
|
(member arg buffer-invisibility-spec)))
|
2008-03-22 11:52:18 -04:00
|
|
|
|
|
2016-06-23 03:25:33 -04:00
|
|
|
|
(defun org-move-to-column (column &optional force _buffer)
|
2014-03-20 10:04:49 -04:00
|
|
|
|
"Move to column COLUMN.
|
Remove final parts of XEmacs compatibility code
* lisp/org-compat.el: Declare `org-add-hook', `org-decompose-region',
`org-detach-overlay', `org-file-equal-p', `org-float-time',
`org-indent-line-to', `org-indent-to-column', `org-looking-at-p',
`org-looking-back', `org-propertize', `org-re' and
`org-select-frame-set-input-focus' as obsolete.
(org-overlay-display, org-overlay-before-string, org-find-overlays):
Move to "org.el"
(org-xemacs-key-equivalents, org-xemacs-p): Remove variables.
(org-region-active-p): Drop XEmacs support.
(org-xemacs-without-invisibility): Remove macro.
(org-get-x-clipboard-compat): Remove function.
* lisp/org-macs.el (org-match-string-no-properties): Remove function.
* lisp/ob-core.el:
* lisp/org-agenda.el:
* lisp/org-archive.el:
* lisp/org-clock.el:
* lisp/org-colview.el:
* lisp/org-crypt.el:
* lisp/org-element.el:
* lisp/org-faces.el:
* lisp/org-feed.el:
* lisp/org-footnote.el:
* lisp/org-habit.el:
* lisp/org-id.el:
* lisp/org-indent.el:
* lisp/org-inlinetask.el:
* lisp/org-lint.el:
* lisp/org-list.el:
* lisp/org-mouse.el:
* lisp/org-pcomplete.el:
* lisp/org-src.el:
* lisp/org-table.el:
* lisp/org-timer.el:
* lisp/org.el:
* lisp/ox-ascii.el:
* lisp/ox-odt.el:
* lisp/ox.el:
* contrib/lisp/org-notify.el:
* contrib/lisp/ox-taskjuggler.el:
* contrib/lisp/org-wikinodes.el:
* testing/lisp/test-org-src.el:
* testing/lisp/test-org.el: Silence byte-compiler.
2016-05-26 06:18:00 -04:00
|
|
|
|
Pass COLUMN and FORCE to `move-to-column'."
|
2014-05-26 08:55:50 -04:00
|
|
|
|
(let ((buffer-invisibility-spec
|
2016-12-22 07:16:30 -05:00
|
|
|
|
(if (listp buffer-invisibility-spec)
|
|
|
|
|
(remove '(org-filtered) buffer-invisibility-spec)
|
|
|
|
|
buffer-invisibility-spec)))
|
Remove final parts of XEmacs compatibility code
* lisp/org-compat.el: Declare `org-add-hook', `org-decompose-region',
`org-detach-overlay', `org-file-equal-p', `org-float-time',
`org-indent-line-to', `org-indent-to-column', `org-looking-at-p',
`org-looking-back', `org-propertize', `org-re' and
`org-select-frame-set-input-focus' as obsolete.
(org-overlay-display, org-overlay-before-string, org-find-overlays):
Move to "org.el"
(org-xemacs-key-equivalents, org-xemacs-p): Remove variables.
(org-region-active-p): Drop XEmacs support.
(org-xemacs-without-invisibility): Remove macro.
(org-get-x-clipboard-compat): Remove function.
* lisp/org-macs.el (org-match-string-no-properties): Remove function.
* lisp/ob-core.el:
* lisp/org-agenda.el:
* lisp/org-archive.el:
* lisp/org-clock.el:
* lisp/org-colview.el:
* lisp/org-crypt.el:
* lisp/org-element.el:
* lisp/org-faces.el:
* lisp/org-feed.el:
* lisp/org-footnote.el:
* lisp/org-habit.el:
* lisp/org-id.el:
* lisp/org-indent.el:
* lisp/org-inlinetask.el:
* lisp/org-lint.el:
* lisp/org-list.el:
* lisp/org-mouse.el:
* lisp/org-pcomplete.el:
* lisp/org-src.el:
* lisp/org-table.el:
* lisp/org-timer.el:
* lisp/org.el:
* lisp/ox-ascii.el:
* lisp/ox-odt.el:
* lisp/ox.el:
* contrib/lisp/org-notify.el:
* contrib/lisp/ox-taskjuggler.el:
* contrib/lisp/org-wikinodes.el:
* testing/lisp/test-org-src.el:
* testing/lisp/test-org.el: Silence byte-compiler.
2016-05-26 06:18:00 -04:00
|
|
|
|
(move-to-column column force)))
|
2008-10-14 10:50:02 -04:00
|
|
|
|
|
2012-05-07 16:37:31 -04:00
|
|
|
|
(defmacro org-find-library-dir (library)
|
2012-10-07 09:01:39 -04:00
|
|
|
|
`(file-name-directory (or (locate-library ,library) "")))
|
2009-04-06 01:23:46 -04:00
|
|
|
|
|
2009-01-19 17:13:58 -05:00
|
|
|
|
(defun org-count-lines (s)
|
|
|
|
|
"How many lines in string S?"
|
|
|
|
|
(let ((start 0) (n 1))
|
|
|
|
|
(while (string-match "\n" s start)
|
|
|
|
|
(setq start (match-end 0) n (1+ n)))
|
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.
2018-05-09 21:02:35 -04:00
|
|
|
|
(when (and (> (length s) 0) (= (aref s (1- (length s))) ?\n))
|
|
|
|
|
(setq n (1- n)))
|
2009-01-19 17:13:58 -05:00
|
|
|
|
n))
|
|
|
|
|
|
2009-06-30 01:24:57 -04:00
|
|
|
|
(defun org-kill-new (string &rest args)
|
|
|
|
|
(remove-text-properties 0 (length string) '(line-prefix t wrap-prefix t)
|
2016-12-22 07:16:30 -05:00
|
|
|
|
string)
|
2009-06-30 01:24:57 -04:00
|
|
|
|
(apply 'kill-new string args))
|
|
|
|
|
|
2017-01-25 21:34:58 -05:00
|
|
|
|
;; `file-local-name' was added in Emacs 26.1.
|
|
|
|
|
(defalias 'org-babel-local-file-name
|
|
|
|
|
(if (fboundp 'file-local-name)
|
|
|
|
|
'file-local-name
|
|
|
|
|
(lambda (file)
|
|
|
|
|
"Return the local name component of FILE."
|
|
|
|
|
(or (file-remote-p file 'localname) file))))
|
|
|
|
|
|
2012-08-26 14:04:41 -04:00
|
|
|
|
;;;###autoload
|
2012-07-15 04:41:27 -04:00
|
|
|
|
(defmacro org-check-version ()
|
|
|
|
|
"Try very hard to provide sensible version strings."
|
|
|
|
|
(let* ((org-dir (org-find-library-dir "org"))
|
2016-12-22 07:16:30 -05:00
|
|
|
|
(org-version.el (concat org-dir "org-version.el"))
|
|
|
|
|
(org-fixup.el (concat org-dir "../mk/org-fixup.el")))
|
2012-07-15 04:41:27 -04:00
|
|
|
|
(if (require 'org-version org-version.el 'noerror)
|
2016-12-22 07:16:30 -05:00
|
|
|
|
'(progn
|
|
|
|
|
(autoload 'org-release "org-version.el")
|
|
|
|
|
(autoload 'org-git-version "org-version.el"))
|
2012-07-15 04:41:27 -04:00
|
|
|
|
(if (require 'org-fixup org-fixup.el 'noerror)
|
2016-12-22 07:16:30 -05:00
|
|
|
|
'(org-fixup)
|
|
|
|
|
;; provide fallback definitions and complain
|
|
|
|
|
(warn "Could not define org version correctly. Check installation!")
|
|
|
|
|
'(progn
|
|
|
|
|
(defun org-release () "N/A")
|
|
|
|
|
(defun org-git-version () "N/A !!check installation!!"))))))
|
2012-07-15 04:41:27 -04:00
|
|
|
|
|
2022-06-30 07:06:21 -04:00
|
|
|
|
(define-obsolete-function-alias 'org-define-error #'define-error "9.6")
|
|
|
|
|
(define-obsolete-function-alias 'org-without-partial-completion 'progn "9.6")
|
2016-08-24 11:05:54 -04:00
|
|
|
|
|
2017-10-22 09:01:43 -04:00
|
|
|
|
|
|
|
|
|
;;; Integration with and fixes for other packages
|
|
|
|
|
|
|
|
|
|
(defgroup org-imenu-and-speedbar nil
|
|
|
|
|
"Options concerning imenu and speedbar in Org mode."
|
|
|
|
|
:tag "Org Imenu and Speedbar"
|
|
|
|
|
:group 'org-structure)
|
|
|
|
|
|
|
|
|
|
(defcustom org-imenu-depth 2
|
|
|
|
|
"The maximum level for Imenu access to Org headlines.
|
|
|
|
|
This also applied for speedbar access."
|
|
|
|
|
:type 'integer)
|
|
|
|
|
|
|
|
|
|
;;;; Imenu
|
|
|
|
|
|
|
|
|
|
(defvar-local org-imenu-markers nil
|
|
|
|
|
"All markers currently used by Imenu.")
|
|
|
|
|
|
|
|
|
|
(defun org-imenu-get-tree ()
|
|
|
|
|
"Produce the index for Imenu."
|
|
|
|
|
(dolist (x org-imenu-markers) (move-marker x nil))
|
|
|
|
|
(setq org-imenu-markers nil)
|
2018-06-12 19:13:16 -04:00
|
|
|
|
(org-with-wide-buffer
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(let* ((re (concat "^" (org-get-limited-outline-regexp)))
|
|
|
|
|
(subs (make-vector (1+ org-imenu-depth) nil))
|
|
|
|
|
(last-level 0))
|
2017-10-22 09:01:43 -04:00
|
|
|
|
(while (re-search-backward re nil t)
|
2018-06-12 19:13:16 -04:00
|
|
|
|
(let ((level (org-reduced-level (funcall outline-level)))
|
|
|
|
|
(headline (org-no-properties
|
|
|
|
|
(org-link-display-format (org-get-heading t t t t)))))
|
|
|
|
|
(when (and (<= level org-imenu-depth) (org-string-nw-p headline))
|
|
|
|
|
(let* ((m (point-marker))
|
|
|
|
|
(item (propertize headline 'org-imenu-marker m 'org-imenu t)))
|
|
|
|
|
(push m org-imenu-markers)
|
|
|
|
|
(if (>= level last-level)
|
|
|
|
|
(push (cons item m) (aref subs level))
|
|
|
|
|
(push (cons item
|
|
|
|
|
(cl-mapcan #'identity (cl-subseq subs (1+ level))))
|
|
|
|
|
(aref subs level))
|
|
|
|
|
(cl-loop for i from (1+ level) to org-imenu-depth
|
|
|
|
|
do (aset subs i nil)))
|
|
|
|
|
(setq last-level level)))))
|
|
|
|
|
(aref subs 1))))
|
2017-10-22 09:01:43 -04:00
|
|
|
|
|
2020-11-06 00:32:16 -05:00
|
|
|
|
(eval-after-load 'imenu
|
2017-10-22 09:01:43 -04:00
|
|
|
|
'(progn
|
|
|
|
|
(add-hook 'imenu-after-jump-hook
|
|
|
|
|
(lambda ()
|
|
|
|
|
(when (derived-mode-p 'org-mode)
|
2022-01-16 02:07:25 -05:00
|
|
|
|
(org-fold-show-context 'org-goto))))
|
2018-06-12 19:13:16 -04:00
|
|
|
|
(add-hook 'org-mode-hook
|
|
|
|
|
(lambda ()
|
|
|
|
|
(setq imenu-create-index-function 'org-imenu-get-tree)))))
|
2017-10-22 09:01:43 -04:00
|
|
|
|
|
|
|
|
|
;;;; Speedbar
|
|
|
|
|
|
|
|
|
|
(defvar org-speedbar-restriction-lock-overlay (make-overlay 1 1)
|
|
|
|
|
"Overlay marking the agenda restriction line in speedbar.")
|
|
|
|
|
(overlay-put org-speedbar-restriction-lock-overlay
|
|
|
|
|
'face 'org-agenda-restriction-lock)
|
|
|
|
|
(overlay-put org-speedbar-restriction-lock-overlay
|
|
|
|
|
'help-echo "Agendas are currently limited to this item.")
|
|
|
|
|
(delete-overlay org-speedbar-restriction-lock-overlay)
|
|
|
|
|
|
|
|
|
|
(defun org-speedbar-set-agenda-restriction ()
|
|
|
|
|
"Restrict future agenda commands to the location at point in speedbar.
|
2018-04-28 06:09:56 -04:00
|
|
|
|
If there is already a restriction lock at the location, remove it.
|
|
|
|
|
|
2017-10-22 09:01:43 -04:00
|
|
|
|
To get rid of the restriction, use `\\[org-agenda-remove-restriction-lock]'."
|
|
|
|
|
(interactive)
|
|
|
|
|
(require 'org-agenda)
|
|
|
|
|
(let (p m tp np dir txt)
|
|
|
|
|
(cond
|
2022-09-06 08:50:59 -04:00
|
|
|
|
((setq p (text-property-any (line-beginning-position) (line-end-position)
|
2017-10-22 09:01:43 -04:00
|
|
|
|
'org-imenu t))
|
|
|
|
|
(setq m (get-text-property p 'org-imenu-marker))
|
|
|
|
|
(with-current-buffer (marker-buffer m)
|
|
|
|
|
(goto-char m)
|
2018-04-28 06:09:56 -04:00
|
|
|
|
(if (and org-agenda-overriding-restriction
|
|
|
|
|
(member org-agenda-restriction-lock-overlay
|
|
|
|
|
(overlays-at (point))))
|
|
|
|
|
(org-agenda-remove-restriction-lock 'noupdate)
|
|
|
|
|
(org-agenda-set-restriction-lock 'subtree))))
|
2022-09-06 08:50:59 -04:00
|
|
|
|
((setq p (text-property-any (line-beginning-position) (line-end-position)
|
2017-10-22 09:01:43 -04:00
|
|
|
|
'speedbar-function 'speedbar-find-file))
|
|
|
|
|
(setq tp (previous-single-property-change
|
|
|
|
|
(1+ p) 'speedbar-function)
|
|
|
|
|
np (next-single-property-change
|
|
|
|
|
tp 'speedbar-function)
|
|
|
|
|
dir (speedbar-line-directory)
|
|
|
|
|
txt (buffer-substring-no-properties (or tp (point-min))
|
|
|
|
|
(or np (point-max))))
|
|
|
|
|
(with-current-buffer (find-file-noselect
|
|
|
|
|
(let ((default-directory dir))
|
|
|
|
|
(expand-file-name txt)))
|
|
|
|
|
(unless (derived-mode-p 'org-mode)
|
|
|
|
|
(user-error "Cannot restrict to non-Org mode file"))
|
|
|
|
|
(org-agenda-set-restriction-lock 'file)))
|
|
|
|
|
(t (user-error "Don't know how to restrict Org mode agenda")))
|
|
|
|
|
(move-overlay org-speedbar-restriction-lock-overlay
|
2022-08-22 22:54:57 -04:00
|
|
|
|
(line-beginning-position) (line-end-position))
|
2017-10-22 09:01:43 -04:00
|
|
|
|
(setq current-prefix-arg nil)
|
|
|
|
|
(org-agenda-maybe-redo)))
|
|
|
|
|
|
|
|
|
|
(defvar speedbar-file-key-map)
|
|
|
|
|
(declare-function speedbar-add-supported-extension "speedbar" (extension))
|
2020-11-06 00:32:16 -05:00
|
|
|
|
(eval-after-load 'speedbar
|
2017-10-22 09:01:43 -04:00
|
|
|
|
'(progn
|
|
|
|
|
(speedbar-add-supported-extension ".org")
|
|
|
|
|
(define-key speedbar-file-key-map "<" 'org-speedbar-set-agenda-restriction)
|
|
|
|
|
(define-key speedbar-file-key-map "\C-c\C-x<" 'org-speedbar-set-agenda-restriction)
|
|
|
|
|
(define-key speedbar-file-key-map ">" 'org-agenda-remove-restriction-lock)
|
|
|
|
|
(define-key speedbar-file-key-map "\C-c\C-x>" 'org-agenda-remove-restriction-lock)
|
|
|
|
|
(add-hook 'speedbar-visiting-tag-hook
|
2022-01-16 02:07:25 -05:00
|
|
|
|
(lambda () (and (derived-mode-p 'org-mode) (org-fold-show-context 'org-goto))))))
|
2017-10-22 09:01:43 -04:00
|
|
|
|
|
2018-06-13 16:15:56 -04:00
|
|
|
|
;;;; Add Log
|
|
|
|
|
|
|
|
|
|
(defun org-add-log-current-headline ()
|
|
|
|
|
"Return current headline or nil.
|
|
|
|
|
This function ignores inlinetasks. It is meant to be used as
|
|
|
|
|
`add-log-current-defun-function' value."
|
|
|
|
|
(org-with-limited-levels (org-get-heading t t t t)))
|
|
|
|
|
|
2017-10-22 09:01:43 -04:00
|
|
|
|
;;;; Flyspell
|
|
|
|
|
|
|
|
|
|
(defun org--flyspell-object-check-p (element)
|
|
|
|
|
"Non-nil when Flyspell can check object at point.
|
|
|
|
|
ELEMENT is the element at point."
|
|
|
|
|
(let ((object (save-excursion
|
|
|
|
|
(when (looking-at-p "\\>") (backward-char))
|
|
|
|
|
(org-element-context element))))
|
|
|
|
|
(cl-case (org-element-type object)
|
|
|
|
|
;; Prevent checks in links due to keybinding conflict with
|
|
|
|
|
;; Flyspell.
|
2022-01-22 09:48:26 -05:00
|
|
|
|
((citation citation-reference code entity export-snippet inline-babel-call
|
|
|
|
|
inline-src-block line-break latex-fragment link macro
|
|
|
|
|
statistics-cookie target timestamp verbatim)
|
2017-10-22 09:01:43 -04:00
|
|
|
|
nil)
|
|
|
|
|
(footnote-reference
|
|
|
|
|
;; Only in inline footnotes, within the definition.
|
|
|
|
|
(and (eq (org-element-property :type object) 'inline)
|
|
|
|
|
(< (save-excursion
|
2023-05-03 10:26:41 -04:00
|
|
|
|
(goto-char (org-element-begin object))
|
2017-10-22 09:01:43 -04:00
|
|
|
|
(search-forward ":" nil t 2))
|
|
|
|
|
(point))))
|
|
|
|
|
(otherwise t))))
|
|
|
|
|
|
|
|
|
|
(defun org-mode-flyspell-verify ()
|
|
|
|
|
"Function used for `flyspell-generic-check-word-predicate'."
|
|
|
|
|
(if (org-at-heading-p)
|
2021-03-07 11:06:34 -05:00
|
|
|
|
;; At a headline or an inlinetask, check title only.
|
2023-05-10 09:27:13 -04:00
|
|
|
|
(and (save-excursion (forward-line 0)
|
2017-10-22 09:01:43 -04:00
|
|
|
|
(and (let ((case-fold-search t))
|
|
|
|
|
(not (looking-at-p "\\*+ END[ \t]*$")))
|
|
|
|
|
(let ((case-fold-search nil))
|
|
|
|
|
(looking-at org-complex-heading-regexp))))
|
|
|
|
|
(match-beginning 4)
|
|
|
|
|
(>= (point) (match-beginning 4))
|
|
|
|
|
(or (not (match-beginning 5))
|
2021-03-07 11:06:34 -05:00
|
|
|
|
(< (point) (match-beginning 5)))
|
|
|
|
|
;; Ignore checks in code, verbatim and others.
|
2021-10-16 11:56:29 -04:00
|
|
|
|
(org--flyspell-object-check-p (org-element-at-point-no-context)))
|
|
|
|
|
(let* ((element (org-element-at-point-no-context))
|
2023-05-03 10:26:41 -04:00
|
|
|
|
(post-affiliated (org-element-post-affiliated element)))
|
2017-10-22 09:01:43 -04:00
|
|
|
|
(cond
|
|
|
|
|
;; Ignore checks in all affiliated keywords but captions.
|
|
|
|
|
((< (point) post-affiliated)
|
|
|
|
|
(and (save-excursion
|
2023-05-10 09:27:13 -04:00
|
|
|
|
(forward-line 0)
|
2017-10-22 09:01:43 -04:00
|
|
|
|
(let ((case-fold-search t)) (looking-at "[ \t]*#\\+CAPTION:")))
|
|
|
|
|
(> (point) (match-end 0))
|
|
|
|
|
(org--flyspell-object-check-p element)))
|
|
|
|
|
;; Ignore checks in LOGBOOK (or equivalent) drawer.
|
|
|
|
|
((let ((log (org-log-into-drawer)))
|
|
|
|
|
(and log
|
2023-05-18 07:35:35 -04:00
|
|
|
|
(let ((drawer (org-element-lineage element 'drawer)))
|
2017-10-22 09:01:43 -04:00
|
|
|
|
(and drawer
|
2022-10-04 17:42:27 -04:00
|
|
|
|
(org-string-equal-ignore-case
|
2022-07-26 13:47:03 -04:00
|
|
|
|
log (org-element-property :drawer-name drawer))))))
|
2017-10-22 09:01:43 -04:00
|
|
|
|
nil)
|
|
|
|
|
(t
|
|
|
|
|
(cl-case (org-element-type element)
|
|
|
|
|
((comment quote-section) t)
|
|
|
|
|
(comment-block
|
|
|
|
|
;; Allow checks between block markers, not on them.
|
|
|
|
|
(and (> (line-beginning-position) post-affiliated)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(end-of-line)
|
|
|
|
|
(skip-chars-forward " \r\t\n")
|
2023-05-03 10:26:41 -04:00
|
|
|
|
(< (point) (org-element-end element)))))
|
2017-10-22 09:01:43 -04:00
|
|
|
|
;; Arbitrary list of keywords where checks are meaningful.
|
|
|
|
|
;; Make sure point is on the value part of the element.
|
|
|
|
|
(keyword
|
|
|
|
|
(and (member (org-element-property :key element)
|
|
|
|
|
'("DESCRIPTION" "TITLE"))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(search-backward ":" (line-beginning-position) t))))
|
|
|
|
|
;; Check is globally allowed in paragraphs verse blocks and
|
|
|
|
|
;; table rows (after affiliated keywords) but some objects
|
|
|
|
|
;; must not be affected.
|
|
|
|
|
((paragraph table-row verse-block)
|
2023-05-03 10:26:41 -04:00
|
|
|
|
(let ((cbeg (org-element-contents-begin element))
|
|
|
|
|
(cend (org-element-contents-end element)))
|
2017-10-22 09:01:43 -04:00
|
|
|
|
(and cbeg (>= (point) cbeg) (< (point) cend)
|
|
|
|
|
(org--flyspell-object-check-p element))))))))))
|
|
|
|
|
(put 'org-mode 'flyspell-mode-predicate 'org-mode-flyspell-verify)
|
|
|
|
|
|
|
|
|
|
(defun org-remove-flyspell-overlays-in (beg end)
|
|
|
|
|
"Remove flyspell overlays in region."
|
|
|
|
|
(and (bound-and-true-p flyspell-mode)
|
|
|
|
|
(fboundp 'flyspell-delete-region-overlays)
|
|
|
|
|
(flyspell-delete-region-overlays beg end)))
|
|
|
|
|
|
|
|
|
|
(defvar flyspell-delayed-commands)
|
2020-11-06 00:32:16 -05:00
|
|
|
|
(eval-after-load 'flyspell
|
2017-10-22 09:01:43 -04:00
|
|
|
|
'(add-to-list 'flyspell-delayed-commands 'org-self-insert-command))
|
|
|
|
|
|
|
|
|
|
;;;; Bookmark
|
|
|
|
|
|
Replace all uses of the old `defadvice` with the new `advice-add`
* lisp/org.el (org-run-like-in-org-mode): Strength reduce `eval`
to `cl-progv`.
(org--check-org-structure-template-alist): Strength reduce `eval`
to `symbol-value`.
(org-map-entries, org-eval-in-calendar, org-diary-sexp-entry):
Make sure we use the new lexically scoped dialect.
(org--math-always-on): New function, extracted from advice.
(org-cdlatex-mode): Use it with `advice-add`.
(org-self-insert-command): Simplify `and`+`listp` into `consp`.
(org-submit-bug-report):
Make sure we use the new lexically scoped dialect.
* lisp/org-protocol.el (org-protocol-convert-query-to-plist):
Use `cl-mapcan`.
(org--protocol-detect-protocol-server): New function, extracted
from advice.
(server-visit-files): Use it with `advice-add`.
* lisp/org-mouse.el (org--mouse-dnd-insert-text): New function, extracted
from advice.
(dnd-insert-text): Use it with `advice-add`.
(org--mouse-dnd-open-file): New function, extracted from advice.
(dnd-open-file): Use it with `advice-add`.
(org--mouse-open-at-point): New function, extracted from advice.
(org-mode-hook): Advise `org-open-at-point` with `advice-add`.
* lisp/org-ctags.el (org--ctags-load-tag-list): New function, extracted
from advice.
(visit-tags-table): Use it with `advice-add`.
(org--ctags-set-org-mark-before-finding-tag): New function, extracted
from advice.
(xref-find-definitions): Use it with `advice-add`.
* lisp/org-compat.el (org-bookmark-jump-unhide): Accept (unused) args.
(save-place-find-file-hook): Use `advice-add`.
(org--ecb-show-context): New function, extracted from advice.
(ecb-method-clicked): Use it with `advice-add`.
(org-mark-jump-unhide): Accept (unused) args.
(pop-to-mark-command, exchange-point-and-mark, pop-global-mark):
Use `advice-add`.
Along the way, remove some redundant `:group` args
(redundant because they specify the same group as would be used by
default anyway) and make a few other simplifications.
Also don't bother putting `advice-add` within an eval-after-load
since the advice machinery already takes care of handling it.
2022-04-01 01:50:01 -04:00
|
|
|
|
(defun org-bookmark-jump-unhide (&rest _)
|
2017-10-22 09:01:43 -04:00
|
|
|
|
"Unhide the current position, to show the bookmark location."
|
|
|
|
|
(and (derived-mode-p 'org-mode)
|
|
|
|
|
(or (org-invisible-p)
|
|
|
|
|
(save-excursion (goto-char (max (point-min) (1- (point))))
|
|
|
|
|
(org-invisible-p)))
|
2022-01-16 02:07:25 -05:00
|
|
|
|
(org-fold-show-context 'bookmark-jump)))
|
2017-10-22 09:01:43 -04:00
|
|
|
|
|
|
|
|
|
;; Make `bookmark-jump' shows the jump location if it was hidden.
|
Replace all uses of the old `defadvice` with the new `advice-add`
* lisp/org.el (org-run-like-in-org-mode): Strength reduce `eval`
to `cl-progv`.
(org--check-org-structure-template-alist): Strength reduce `eval`
to `symbol-value`.
(org-map-entries, org-eval-in-calendar, org-diary-sexp-entry):
Make sure we use the new lexically scoped dialect.
(org--math-always-on): New function, extracted from advice.
(org-cdlatex-mode): Use it with `advice-add`.
(org-self-insert-command): Simplify `and`+`listp` into `consp`.
(org-submit-bug-report):
Make sure we use the new lexically scoped dialect.
* lisp/org-protocol.el (org-protocol-convert-query-to-plist):
Use `cl-mapcan`.
(org--protocol-detect-protocol-server): New function, extracted
from advice.
(server-visit-files): Use it with `advice-add`.
* lisp/org-mouse.el (org--mouse-dnd-insert-text): New function, extracted
from advice.
(dnd-insert-text): Use it with `advice-add`.
(org--mouse-dnd-open-file): New function, extracted from advice.
(dnd-open-file): Use it with `advice-add`.
(org--mouse-open-at-point): New function, extracted from advice.
(org-mode-hook): Advise `org-open-at-point` with `advice-add`.
* lisp/org-ctags.el (org--ctags-load-tag-list): New function, extracted
from advice.
(visit-tags-table): Use it with `advice-add`.
(org--ctags-set-org-mark-before-finding-tag): New function, extracted
from advice.
(xref-find-definitions): Use it with `advice-add`.
* lisp/org-compat.el (org-bookmark-jump-unhide): Accept (unused) args.
(save-place-find-file-hook): Use `advice-add`.
(org--ecb-show-context): New function, extracted from advice.
(ecb-method-clicked): Use it with `advice-add`.
(org-mark-jump-unhide): Accept (unused) args.
(pop-to-mark-command, exchange-point-and-mark, pop-global-mark):
Use `advice-add`.
Along the way, remove some redundant `:group` args
(redundant because they specify the same group as would be used by
default anyway) and make a few other simplifications.
Also don't bother putting `advice-add` within an eval-after-load
since the advice machinery already takes care of handling it.
2022-04-01 01:50:01 -04:00
|
|
|
|
(add-hook 'bookmark-after-jump-hook #'org-bookmark-jump-unhide)
|
2017-10-22 09:01:43 -04:00
|
|
|
|
|
2018-01-20 06:58:42 -05:00
|
|
|
|
;;;; Calendar
|
|
|
|
|
|
|
|
|
|
(defcustom org-calendar-to-agenda-key 'default
|
|
|
|
|
"Key to be installed in `calendar-mode-map' for switching to the agenda.
|
|
|
|
|
|
|
|
|
|
The command `org-calendar-goto-agenda' will be bound to this key.
|
|
|
|
|
|
|
|
|
|
When set to `default', bind the function to `c', but only if it is
|
|
|
|
|
available in the Calendar keymap. This is the default choice because
|
|
|
|
|
`c' can then be used to switch back and forth between agenda and calendar.
|
|
|
|
|
|
|
|
|
|
When nil, `org-calendar-goto-agenda' is not bound to any key."
|
|
|
|
|
:group 'org-agenda
|
|
|
|
|
:type '(choice
|
|
|
|
|
(const :tag "Bind to `c' if available" default)
|
|
|
|
|
(key-sequence :tag "Other binding")
|
|
|
|
|
(const :tag "No binding" nil))
|
|
|
|
|
:safe (lambda (v) (or (symbolp v) (stringp v)))
|
|
|
|
|
:package-version '(Org . "9.2"))
|
|
|
|
|
|
|
|
|
|
(defcustom org-calendar-insert-diary-entry-key [?i]
|
|
|
|
|
"The key to be installed in `calendar-mode-map' for adding diary entries.
|
|
|
|
|
This option is irrelevant until `org-agenda-diary-file' has been configured
|
|
|
|
|
to point to an Org file. When that is the case, the command
|
|
|
|
|
`org-agenda-diary-entry' will be bound to the key given here, by default
|
|
|
|
|
`i'. In the calendar, `i' normally adds entries to `diary-file'. So
|
|
|
|
|
if you want to continue doing this, you need to change this to a different
|
|
|
|
|
key."
|
|
|
|
|
:group 'org-agenda
|
|
|
|
|
:type 'sexp)
|
|
|
|
|
|
|
|
|
|
(defun org--setup-calendar-bindings ()
|
|
|
|
|
"Bind Org functions in Calendar keymap."
|
|
|
|
|
(pcase org-calendar-to-agenda-key
|
|
|
|
|
(`nil nil)
|
|
|
|
|
((and key (pred stringp))
|
|
|
|
|
(local-set-key (kbd key) #'org-calendar-goto-agenda))
|
|
|
|
|
((guard (not (lookup-key calendar-mode-map "c")))
|
|
|
|
|
(local-set-key "c" #'org-calendar-goto-agenda))
|
|
|
|
|
(_ nil))
|
2021-06-25 05:11:43 -04:00
|
|
|
|
(when (and (boundp 'org-agenda-diary-file)
|
|
|
|
|
(not (eq org-agenda-diary-file 'diary-file)))
|
2018-01-20 06:58:42 -05:00
|
|
|
|
(local-set-key org-calendar-insert-diary-entry-key
|
|
|
|
|
#'org-agenda-diary-entry)))
|
|
|
|
|
|
2020-11-06 00:32:16 -05:00
|
|
|
|
(eval-after-load 'calendar
|
2020-02-17 10:29:21 -05:00
|
|
|
|
'(add-hook 'calendar-mode-hook #'org--setup-calendar-bindings))
|
2018-01-20 06:58:42 -05:00
|
|
|
|
|
2017-10-22 09:01:43 -04:00
|
|
|
|
;;;; Saveplace
|
|
|
|
|
|
|
|
|
|
;; Make sure saveplace shows the location if it was hidden
|
Replace all uses of the old `defadvice` with the new `advice-add`
* lisp/org.el (org-run-like-in-org-mode): Strength reduce `eval`
to `cl-progv`.
(org--check-org-structure-template-alist): Strength reduce `eval`
to `symbol-value`.
(org-map-entries, org-eval-in-calendar, org-diary-sexp-entry):
Make sure we use the new lexically scoped dialect.
(org--math-always-on): New function, extracted from advice.
(org-cdlatex-mode): Use it with `advice-add`.
(org-self-insert-command): Simplify `and`+`listp` into `consp`.
(org-submit-bug-report):
Make sure we use the new lexically scoped dialect.
* lisp/org-protocol.el (org-protocol-convert-query-to-plist):
Use `cl-mapcan`.
(org--protocol-detect-protocol-server): New function, extracted
from advice.
(server-visit-files): Use it with `advice-add`.
* lisp/org-mouse.el (org--mouse-dnd-insert-text): New function, extracted
from advice.
(dnd-insert-text): Use it with `advice-add`.
(org--mouse-dnd-open-file): New function, extracted from advice.
(dnd-open-file): Use it with `advice-add`.
(org--mouse-open-at-point): New function, extracted from advice.
(org-mode-hook): Advise `org-open-at-point` with `advice-add`.
* lisp/org-ctags.el (org--ctags-load-tag-list): New function, extracted
from advice.
(visit-tags-table): Use it with `advice-add`.
(org--ctags-set-org-mark-before-finding-tag): New function, extracted
from advice.
(xref-find-definitions): Use it with `advice-add`.
* lisp/org-compat.el (org-bookmark-jump-unhide): Accept (unused) args.
(save-place-find-file-hook): Use `advice-add`.
(org--ecb-show-context): New function, extracted from advice.
(ecb-method-clicked): Use it with `advice-add`.
(org-mark-jump-unhide): Accept (unused) args.
(pop-to-mark-command, exchange-point-and-mark, pop-global-mark):
Use `advice-add`.
Along the way, remove some redundant `:group` args
(redundant because they specify the same group as would be used by
default anyway) and make a few other simplifications.
Also don't bother putting `advice-add` within an eval-after-load
since the advice machinery already takes care of handling it.
2022-04-01 01:50:01 -04:00
|
|
|
|
(advice-add 'save-place-find-file-hook :after #'org-bookmark-jump-unhide)
|
2017-10-22 09:01:43 -04:00
|
|
|
|
|
|
|
|
|
;;;; Ecb
|
|
|
|
|
|
|
|
|
|
;; Make sure ecb shows the location if it was hidden
|
Replace all uses of the old `defadvice` with the new `advice-add`
* lisp/org.el (org-run-like-in-org-mode): Strength reduce `eval`
to `cl-progv`.
(org--check-org-structure-template-alist): Strength reduce `eval`
to `symbol-value`.
(org-map-entries, org-eval-in-calendar, org-diary-sexp-entry):
Make sure we use the new lexically scoped dialect.
(org--math-always-on): New function, extracted from advice.
(org-cdlatex-mode): Use it with `advice-add`.
(org-self-insert-command): Simplify `and`+`listp` into `consp`.
(org-submit-bug-report):
Make sure we use the new lexically scoped dialect.
* lisp/org-protocol.el (org-protocol-convert-query-to-plist):
Use `cl-mapcan`.
(org--protocol-detect-protocol-server): New function, extracted
from advice.
(server-visit-files): Use it with `advice-add`.
* lisp/org-mouse.el (org--mouse-dnd-insert-text): New function, extracted
from advice.
(dnd-insert-text): Use it with `advice-add`.
(org--mouse-dnd-open-file): New function, extracted from advice.
(dnd-open-file): Use it with `advice-add`.
(org--mouse-open-at-point): New function, extracted from advice.
(org-mode-hook): Advise `org-open-at-point` with `advice-add`.
* lisp/org-ctags.el (org--ctags-load-tag-list): New function, extracted
from advice.
(visit-tags-table): Use it with `advice-add`.
(org--ctags-set-org-mark-before-finding-tag): New function, extracted
from advice.
(xref-find-definitions): Use it with `advice-add`.
* lisp/org-compat.el (org-bookmark-jump-unhide): Accept (unused) args.
(save-place-find-file-hook): Use `advice-add`.
(org--ecb-show-context): New function, extracted from advice.
(ecb-method-clicked): Use it with `advice-add`.
(org-mark-jump-unhide): Accept (unused) args.
(pop-to-mark-command, exchange-point-and-mark, pop-global-mark):
Use `advice-add`.
Along the way, remove some redundant `:group` args
(redundant because they specify the same group as would be used by
default anyway) and make a few other simplifications.
Also don't bother putting `advice-add` within an eval-after-load
since the advice machinery already takes care of handling it.
2022-04-01 01:50:01 -04:00
|
|
|
|
(advice-add 'ecb-method-clicked :after #'org--ecb-show-context)
|
|
|
|
|
(defun org--ecb-show-context (&rest _)
|
|
|
|
|
"Make hierarchy visible when jumping into location from ECB tree buffer."
|
|
|
|
|
(when (derived-mode-p 'org-mode)
|
2022-01-16 02:07:25 -05:00
|
|
|
|
(org-fold-show-context)))
|
2017-10-22 09:01:43 -04:00
|
|
|
|
|
|
|
|
|
;;;; Simple
|
|
|
|
|
|
Replace all uses of the old `defadvice` with the new `advice-add`
* lisp/org.el (org-run-like-in-org-mode): Strength reduce `eval`
to `cl-progv`.
(org--check-org-structure-template-alist): Strength reduce `eval`
to `symbol-value`.
(org-map-entries, org-eval-in-calendar, org-diary-sexp-entry):
Make sure we use the new lexically scoped dialect.
(org--math-always-on): New function, extracted from advice.
(org-cdlatex-mode): Use it with `advice-add`.
(org-self-insert-command): Simplify `and`+`listp` into `consp`.
(org-submit-bug-report):
Make sure we use the new lexically scoped dialect.
* lisp/org-protocol.el (org-protocol-convert-query-to-plist):
Use `cl-mapcan`.
(org--protocol-detect-protocol-server): New function, extracted
from advice.
(server-visit-files): Use it with `advice-add`.
* lisp/org-mouse.el (org--mouse-dnd-insert-text): New function, extracted
from advice.
(dnd-insert-text): Use it with `advice-add`.
(org--mouse-dnd-open-file): New function, extracted from advice.
(dnd-open-file): Use it with `advice-add`.
(org--mouse-open-at-point): New function, extracted from advice.
(org-mode-hook): Advise `org-open-at-point` with `advice-add`.
* lisp/org-ctags.el (org--ctags-load-tag-list): New function, extracted
from advice.
(visit-tags-table): Use it with `advice-add`.
(org--ctags-set-org-mark-before-finding-tag): New function, extracted
from advice.
(xref-find-definitions): Use it with `advice-add`.
* lisp/org-compat.el (org-bookmark-jump-unhide): Accept (unused) args.
(save-place-find-file-hook): Use `advice-add`.
(org--ecb-show-context): New function, extracted from advice.
(ecb-method-clicked): Use it with `advice-add`.
(org-mark-jump-unhide): Accept (unused) args.
(pop-to-mark-command, exchange-point-and-mark, pop-global-mark):
Use `advice-add`.
Along the way, remove some redundant `:group` args
(redundant because they specify the same group as would be used by
default anyway) and make a few other simplifications.
Also don't bother putting `advice-add` within an eval-after-load
since the advice machinery already takes care of handling it.
2022-04-01 01:50:01 -04:00
|
|
|
|
(defun org-mark-jump-unhide (&rest _)
|
2017-10-22 09:01:43 -04:00
|
|
|
|
"Make the point visible with `org-show-context' after jumping to the mark."
|
|
|
|
|
(when (and (derived-mode-p 'org-mode)
|
|
|
|
|
(org-invisible-p))
|
2022-01-16 02:07:25 -05:00
|
|
|
|
(org-fold-show-context 'mark-goto)))
|
2017-10-22 09:01:43 -04:00
|
|
|
|
|
Replace all uses of the old `defadvice` with the new `advice-add`
* lisp/org.el (org-run-like-in-org-mode): Strength reduce `eval`
to `cl-progv`.
(org--check-org-structure-template-alist): Strength reduce `eval`
to `symbol-value`.
(org-map-entries, org-eval-in-calendar, org-diary-sexp-entry):
Make sure we use the new lexically scoped dialect.
(org--math-always-on): New function, extracted from advice.
(org-cdlatex-mode): Use it with `advice-add`.
(org-self-insert-command): Simplify `and`+`listp` into `consp`.
(org-submit-bug-report):
Make sure we use the new lexically scoped dialect.
* lisp/org-protocol.el (org-protocol-convert-query-to-plist):
Use `cl-mapcan`.
(org--protocol-detect-protocol-server): New function, extracted
from advice.
(server-visit-files): Use it with `advice-add`.
* lisp/org-mouse.el (org--mouse-dnd-insert-text): New function, extracted
from advice.
(dnd-insert-text): Use it with `advice-add`.
(org--mouse-dnd-open-file): New function, extracted from advice.
(dnd-open-file): Use it with `advice-add`.
(org--mouse-open-at-point): New function, extracted from advice.
(org-mode-hook): Advise `org-open-at-point` with `advice-add`.
* lisp/org-ctags.el (org--ctags-load-tag-list): New function, extracted
from advice.
(visit-tags-table): Use it with `advice-add`.
(org--ctags-set-org-mark-before-finding-tag): New function, extracted
from advice.
(xref-find-definitions): Use it with `advice-add`.
* lisp/org-compat.el (org-bookmark-jump-unhide): Accept (unused) args.
(save-place-find-file-hook): Use `advice-add`.
(org--ecb-show-context): New function, extracted from advice.
(ecb-method-clicked): Use it with `advice-add`.
(org-mark-jump-unhide): Accept (unused) args.
(pop-to-mark-command, exchange-point-and-mark, pop-global-mark):
Use `advice-add`.
Along the way, remove some redundant `:group` args
(redundant because they specify the same group as would be used by
default anyway) and make a few other simplifications.
Also don't bother putting `advice-add` within an eval-after-load
since the advice machinery already takes care of handling it.
2022-04-01 01:50:01 -04:00
|
|
|
|
(advice-add 'pop-to-mark-command :after #'org-mark-jump-unhide)
|
2017-10-22 09:01:43 -04:00
|
|
|
|
|
Replace all uses of the old `defadvice` with the new `advice-add`
* lisp/org.el (org-run-like-in-org-mode): Strength reduce `eval`
to `cl-progv`.
(org--check-org-structure-template-alist): Strength reduce `eval`
to `symbol-value`.
(org-map-entries, org-eval-in-calendar, org-diary-sexp-entry):
Make sure we use the new lexically scoped dialect.
(org--math-always-on): New function, extracted from advice.
(org-cdlatex-mode): Use it with `advice-add`.
(org-self-insert-command): Simplify `and`+`listp` into `consp`.
(org-submit-bug-report):
Make sure we use the new lexically scoped dialect.
* lisp/org-protocol.el (org-protocol-convert-query-to-plist):
Use `cl-mapcan`.
(org--protocol-detect-protocol-server): New function, extracted
from advice.
(server-visit-files): Use it with `advice-add`.
* lisp/org-mouse.el (org--mouse-dnd-insert-text): New function, extracted
from advice.
(dnd-insert-text): Use it with `advice-add`.
(org--mouse-dnd-open-file): New function, extracted from advice.
(dnd-open-file): Use it with `advice-add`.
(org--mouse-open-at-point): New function, extracted from advice.
(org-mode-hook): Advise `org-open-at-point` with `advice-add`.
* lisp/org-ctags.el (org--ctags-load-tag-list): New function, extracted
from advice.
(visit-tags-table): Use it with `advice-add`.
(org--ctags-set-org-mark-before-finding-tag): New function, extracted
from advice.
(xref-find-definitions): Use it with `advice-add`.
* lisp/org-compat.el (org-bookmark-jump-unhide): Accept (unused) args.
(save-place-find-file-hook): Use `advice-add`.
(org--ecb-show-context): New function, extracted from advice.
(ecb-method-clicked): Use it with `advice-add`.
(org-mark-jump-unhide): Accept (unused) args.
(pop-to-mark-command, exchange-point-and-mark, pop-global-mark):
Use `advice-add`.
Along the way, remove some redundant `:group` args
(redundant because they specify the same group as would be used by
default anyway) and make a few other simplifications.
Also don't bother putting `advice-add` within an eval-after-load
since the advice machinery already takes care of handling it.
2022-04-01 01:50:01 -04:00
|
|
|
|
(advice-add 'exchange-point-and-mark :after #'org-mark-jump-unhide)
|
|
|
|
|
(advice-add 'pop-global-mark :after #'org-mark-jump-unhide)
|
2017-10-22 09:01:43 -04:00
|
|
|
|
|
|
|
|
|
;;;; Session
|
|
|
|
|
|
|
|
|
|
;; Make "session.el" ignore our circular variable.
|
|
|
|
|
(defvar session-globals-exclude)
|
2020-11-06 00:32:16 -05:00
|
|
|
|
(eval-after-load 'session
|
2017-10-22 09:01:43 -04:00
|
|
|
|
'(add-to-list 'session-globals-exclude 'org-mark-ring))
|
|
|
|
|
|
2022-01-16 02:38:20 -05:00
|
|
|
|
;;;; outline-mode
|
|
|
|
|
|
|
|
|
|
;; Folding in outline-mode is not compatible with org-mode folding
|
|
|
|
|
;; anymore. Working around to avoid breakage of external packages
|
|
|
|
|
;; assuming the compatibility.
|
2022-09-06 08:14:23 -04:00
|
|
|
|
(define-advice outline-flag-region (:around (oldfun from to flag &rest extra) fix-for-org-fold)
|
2022-01-16 02:38:20 -05:00
|
|
|
|
"Run `org-fold-region' when in org-mode."
|
2022-09-03 04:05:42 -04:00
|
|
|
|
(if (derived-mode-p 'org-mode)
|
|
|
|
|
(org-fold-region (max from (point-min)) (min to (point-max)) flag 'headline)
|
2022-11-30 10:59:41 -05:00
|
|
|
|
;; Apply EXTRA to avoid breakages if advised function definition
|
2022-09-06 08:14:23 -04:00
|
|
|
|
;; changes.
|
|
|
|
|
(apply oldfun from to flag extra)))
|
2022-01-16 02:38:20 -05:00
|
|
|
|
|
2022-09-06 08:14:23 -04:00
|
|
|
|
(define-advice outline-next-visible-heading (:around (oldfun arg &rest extra) fix-for-org-fold)
|
2022-01-16 02:38:20 -05:00
|
|
|
|
"Run `org-next-visible-heading' when in org-mode."
|
2022-09-03 04:05:42 -04:00
|
|
|
|
(if (derived-mode-p 'org-mode)
|
|
|
|
|
(org-next-visible-heading arg)
|
2022-11-30 10:59:41 -05:00
|
|
|
|
;; Apply EXTRA to avoid breakages if advised function definition
|
2022-09-06 08:14:23 -04:00
|
|
|
|
;; changes.
|
|
|
|
|
(apply oldfun arg extra)))
|
2022-01-16 02:38:20 -05:00
|
|
|
|
|
2022-09-06 08:14:23 -04:00
|
|
|
|
(define-advice outline-back-to-heading (:around (oldfun &optional invisible-ok &rest extra) fix-for-org-fold)
|
2022-01-16 02:38:20 -05:00
|
|
|
|
"Run `org-back-to-heading' when in org-mode."
|
2022-09-03 04:05:42 -04:00
|
|
|
|
(if (derived-mode-p 'org-mode)
|
|
|
|
|
(progn
|
2023-05-10 09:27:13 -04:00
|
|
|
|
(forward-line 0)
|
2022-09-03 04:05:42 -04:00
|
|
|
|
(or (org-at-heading-p (not invisible-ok))
|
|
|
|
|
(let (found)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(while (not found)
|
|
|
|
|
(or (re-search-backward (concat "^\\(?:" outline-regexp "\\)")
|
|
|
|
|
nil t)
|
|
|
|
|
(signal 'outline-before-first-heading nil))
|
|
|
|
|
(setq found (and (or invisible-ok (not (org-fold-folded-p)))
|
|
|
|
|
(point)))))
|
|
|
|
|
(goto-char found)
|
|
|
|
|
found)))
|
2022-11-30 10:59:41 -05:00
|
|
|
|
;; Apply EXTRA to avoid breakages if advised function definition
|
2022-09-06 08:14:23 -04:00
|
|
|
|
;; changes.
|
|
|
|
|
(apply oldfun invisible-ok extra)))
|
2022-09-03 04:05:42 -04:00
|
|
|
|
|
2022-09-06 08:14:23 -04:00
|
|
|
|
(define-advice outline-on-heading-p (:around (oldfun &optional invisible-ok &rest extra) fix-for-org-fold)
|
2022-01-16 02:38:20 -05:00
|
|
|
|
"Run `org-at-heading-p' when in org-mode."
|
2022-09-03 04:05:42 -04:00
|
|
|
|
(if (derived-mode-p 'org-mode)
|
|
|
|
|
(org-at-heading-p (not invisible-ok))
|
2022-11-30 10:59:41 -05:00
|
|
|
|
;; Apply EXTRA to avoid breakages if advised function definition
|
2022-09-06 08:14:23 -04:00
|
|
|
|
;; changes.
|
|
|
|
|
(apply oldfun invisible-ok extra)))
|
2022-01-16 02:38:20 -05:00
|
|
|
|
|
2022-09-06 08:14:23 -04:00
|
|
|
|
(define-advice outline-hide-sublevels (:around (oldfun levels &rest extra) fix-for-org-fold)
|
2022-01-16 02:38:20 -05:00
|
|
|
|
"Run `org-fold-hide-sublevels' when in org-mode."
|
2022-09-03 04:05:42 -04:00
|
|
|
|
(if (derived-mode-p 'org-mode)
|
|
|
|
|
(org-fold-hide-sublevels levels)
|
2022-11-30 10:59:41 -05:00
|
|
|
|
;; Apply EXTRA to avoid breakages if advised function definition
|
2022-09-06 08:14:23 -04:00
|
|
|
|
;; changes.
|
|
|
|
|
(apply oldfun levels extra)))
|
2022-09-03 04:05:42 -04:00
|
|
|
|
|
2022-09-06 08:14:23 -04:00
|
|
|
|
(define-advice outline-toggle-children (:around (oldfun &rest extra) fix-for-org-fold)
|
2022-01-16 02:38:20 -05:00
|
|
|
|
"Run `org-fold-hide-sublevels' when in org-mode."
|
2022-09-03 04:05:42 -04:00
|
|
|
|
(if (derived-mode-p 'org-mode)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(org-back-to-heading)
|
|
|
|
|
(if (not (org-fold-folded-p (line-end-position)))
|
|
|
|
|
(org-fold-hide-subtree)
|
|
|
|
|
(org-fold-show-children)
|
|
|
|
|
(org-fold-show-entry 'hide-drawers)))
|
2022-11-30 10:59:41 -05:00
|
|
|
|
;; Apply EXTRA to avoid breakages if advised function definition
|
2022-09-06 08:14:23 -04:00
|
|
|
|
;; changes.
|
|
|
|
|
(apply oldfun extra)))
|
2022-01-16 02:38:20 -05:00
|
|
|
|
|
|
|
|
|
;; TODO: outline-headers-as-kill
|
|
|
|
|
|
2021-05-03 10:30:04 -04:00
|
|
|
|
;;;; Speed commands
|
|
|
|
|
|
|
|
|
|
(make-obsolete-variable 'org-speed-commands-user
|
|
|
|
|
"configure `org-speed-commands' instead." "9.5")
|
2008-03-22 11:52:18 -04:00
|
|
|
|
(provide 'org-compat)
|
|
|
|
|
|
2020-02-18 17:37:24 -05:00
|
|
|
|
;; Local variables:
|
|
|
|
|
;; generated-autoload-file: "org-loaddefs.el"
|
|
|
|
|
;; End:
|
|
|
|
|
|
2008-03-22 11:52:18 -04:00
|
|
|
|
;;; org-compat.el ends here
|