forked from mirrors/org-mode
Mark `org-get-indentation' as obsolete
* lisp/org-macs.el (org-get-indentation): Move function... * lisp/org-compat: ... here. * lisp/ob-core.el (org-babel-demarcate-block): (org-babel-insert-result): (org-babel-update-block-body): * lisp/ob-exp.el (org-babel-exp-process-buffer): * lisp/org-agenda.el (org-agenda-get-some-entry-text): * lisp/org-capture.el (org-capture-place-item): * lisp/org-clock.el (org-clock-in): * lisp/org-element.el (org-element-swap-A-B): * lisp/org-feed.el (org-feed-format-entry): * lisp/org-indent.el (org-indent-add-properties): * lisp/org-list.el (org-in-item-p): (org-list-struct): (org-list-struct-apply-struct): (org-list-item-body-column): (org-toggle-item): * lisp/org-src.el (org-src--edit-element): * lisp/org.el (org-fixup-indentation): (org-cdlatex-environment-indent): (org--get-expected-indentation): (org-indent-region): (org-toggle-fixed-width): * lisp/ox.el (org-export-expand-include-keyword): Use `current-indentation' instead.
This commit is contained in:
parent
0c03971b09
commit
0dda9bf1c1
|
@ -61,8 +61,6 @@
|
|||
(declare-function org-element-type "org-element" (element))
|
||||
(declare-function org-entry-get "org" (pom property &optional inherit literal-nil))
|
||||
(declare-function org-escape-code-in-region "org-src" (beg end))
|
||||
(declare-function org-get-indentation "org" (&optional line))
|
||||
(declare-function org-get-indentation "org" (&optional line))
|
||||
(declare-function org-in-regexp "org" (regexp &optional nlines visually))
|
||||
(declare-function org-indent-line "org" ())
|
||||
(declare-function org-list-get-list-end "org-list" (item struct prevs))
|
||||
|
@ -1889,7 +1887,7 @@ region is not active then the point is demarcated."
|
|||
(save-excursion
|
||||
(goto-char place)
|
||||
(let ((lang (nth 0 info))
|
||||
(indent (make-string (org-get-indentation) ?\s)))
|
||||
(indent (make-string (current-indentation) ?\s)))
|
||||
(when (string-match "^[[:space:]]*$"
|
||||
(buffer-substring (point-at-bol)
|
||||
(point-at-eol)))
|
||||
|
@ -2286,7 +2284,7 @@ INFO may provide the values of these header arguments (in the
|
|||
(goto-char (org-element-property :end inline))
|
||||
(skip-chars-backward " \t"))
|
||||
(unless inline
|
||||
(setq indent (org-get-indentation))
|
||||
(setq indent (current-indentation))
|
||||
(forward-line 1))
|
||||
(setq beg (point))
|
||||
(cond
|
||||
|
@ -2554,7 +2552,7 @@ file's directory then expand relative links."
|
|||
(unless (eq (org-element-type element) 'src-block)
|
||||
(error "Not in a source block"))
|
||||
(goto-char (org-babel-where-is-src-block-head element))
|
||||
(let* ((ind (org-get-indentation))
|
||||
(let* ((ind (current-indentation))
|
||||
(body-start (line-beginning-position 2))
|
||||
(body (org-element-normalize-string
|
||||
(if (or org-src-preserve-indentation
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
(declare-function org-escape-code-in-string "org-src" (s))
|
||||
(declare-function org-export-copy-buffer "ox" ())
|
||||
(declare-function org-fill-template "org" (template alist))
|
||||
(declare-function org-get-indentation "org" (&optional line))
|
||||
(declare-function org-in-commented-heading-p "org" (&optional no-inheritance))
|
||||
|
||||
(defvar org-src-preserve-indentation)
|
||||
|
@ -244,7 +243,7 @@ this template."
|
|||
(insert rep))))
|
||||
(`src-block
|
||||
(let ((match-start (copy-marker (match-beginning 0)))
|
||||
(ind (org-get-indentation)))
|
||||
(ind (current-indentation)))
|
||||
;; Take care of matched block: compute
|
||||
;; replacement string. In particular, a nil
|
||||
;; REPLACEMENT means the block is left as-is
|
||||
|
|
|
@ -3555,10 +3555,10 @@ removed from the entry content. Currently only `planning' is allowed here."
|
|||
;; find and remove min common indentation
|
||||
(goto-char (point-min))
|
||||
(untabify (point-min) (point-max))
|
||||
(setq ind (org-get-indentation))
|
||||
(setq ind (current-indentation))
|
||||
(while (not (eobp))
|
||||
(unless (looking-at "[ \t]*$")
|
||||
(setq ind (min ind (org-get-indentation))))
|
||||
(setq ind (min ind (current-indentation))))
|
||||
(beginning-of-line 2))
|
||||
(goto-char (point-min))
|
||||
(while (not (eobp))
|
||||
|
|
|
@ -1158,10 +1158,10 @@ may have been stored before."
|
|||
(goto-char beg)
|
||||
(when (org-list-search-forward (org-item-beginning-re) end t)
|
||||
(goto-char (match-beginning 0))
|
||||
(setq ind (org-get-indentation))))
|
||||
(setq ind (current-indentation))))
|
||||
(goto-char end)
|
||||
(when (org-list-search-backward (org-item-beginning-re) beg t)
|
||||
(setq ind (org-get-indentation))
|
||||
(setq ind (current-indentation))
|
||||
(org-end-of-item)))
|
||||
(unless ind (goto-char end)))
|
||||
;; Remove common indentation
|
||||
|
@ -1178,7 +1178,7 @@ may have been stored before."
|
|||
(unless (eolp) (save-excursion (insert "\n")))
|
||||
(unless ind
|
||||
(org-indent-line)
|
||||
(setq ind (org-get-indentation))
|
||||
(setq ind (current-indentation))
|
||||
(delete-region beg (point)))
|
||||
;; Set the correct indentation, depending on context
|
||||
(setq ind (make-string ind ?\ ))
|
||||
|
|
|
@ -1314,7 +1314,7 @@ the default behavior."
|
|||
(end-of-line 0)
|
||||
(org-in-item-p)))
|
||||
(beginning-of-line 1)
|
||||
(indent-line-to (- (org-get-indentation) 2)))
|
||||
(indent-line-to (- (current-indentation) 2)))
|
||||
(insert org-clock-string " ")
|
||||
(setq org-clock-effort (org-entry-get (point) org-effort-property))
|
||||
(setq org-clock-total-time (org-clock-sum-current-item
|
||||
|
|
|
@ -215,6 +215,8 @@ Counting starts at 1."
|
|||
'org-activate-links "Org 9.0")
|
||||
(define-obsolete-function-alias 'org-activate-plain-links 'ignore "Org 9.0")
|
||||
(define-obsolete-function-alias 'org-activate-angle-links 'ignore "Org 9.0")
|
||||
(define-obsolete-function-alias 'org-get-indentation
|
||||
'current-indentation "Org 9.2")
|
||||
|
||||
(defun org-in-fixed-width-region-p ()
|
||||
"Non-nil if point in a fixed-width region."
|
||||
|
|
|
@ -5967,7 +5967,7 @@ end of ELEM-A."
|
|||
;; give it ELEM-B's (which will in, in turn, have no indentation).
|
||||
(let* ((ind-B (when specialp
|
||||
(goto-char (org-element-property :begin elem-B))
|
||||
(org-get-indentation)))
|
||||
(current-indentation)))
|
||||
(beg-A (org-element-property :begin elem-A))
|
||||
(end-A (save-excursion
|
||||
(goto-char (org-element-property :end elem-A))
|
||||
|
|
|
@ -566,7 +566,7 @@ If that property is already present, nothing changes."
|
|||
(if (looking-at
|
||||
(concat "^\\([ \t]*\\)%" name "[ \t]*$"))
|
||||
(org-feed-make-indented-block
|
||||
v (org-get-indentation))
|
||||
v (current-indentation))
|
||||
v))))))))
|
||||
(when replacement
|
||||
(insert
|
||||
|
|
|
@ -357,7 +357,7 @@ stopped."
|
|||
level (org-list-item-body-column (point))))
|
||||
;; Regular line.
|
||||
(t
|
||||
(org-indent-set-line-properties level (org-get-indentation))))))))))
|
||||
(org-indent-set-line-properties level (current-indentation))))))))))
|
||||
|
||||
(defun org-indent-notify-modified-headline (beg end)
|
||||
"Set `org-indent-modified-headline-flag' depending on context.
|
||||
|
|
|
@ -126,7 +126,6 @@
|
|||
(declare-function org-export-get-next-element "ox" (blob info &optional n))
|
||||
(declare-function org-export-with-backend "ox" (backend data &optional contents info))
|
||||
(declare-function org-fix-tags-on-the-fly "org" ())
|
||||
(declare-function org-get-indentation "org" (&optional line))
|
||||
(declare-function org-get-todo-state "org" ())
|
||||
(declare-function org-in-block-p "org" (names))
|
||||
(declare-function org-in-regexp "org" (re &optional nlines visually))
|
||||
|
@ -428,7 +427,7 @@ group 4: description tag")
|
|||
(ind-ref (if (or (looking-at "^[ \t]*$")
|
||||
(and inlinetask-re (looking-at inlinetask-re)))
|
||||
10000
|
||||
(org-get-indentation))))
|
||||
(current-indentation))))
|
||||
(cond
|
||||
((eq (nth 2 context) 'invalid) nil)
|
||||
((looking-at item-re) (point))
|
||||
|
@ -450,7 +449,7 @@ group 4: description tag")
|
|||
;; Look for an item, less indented that reference line.
|
||||
(catch 'exit
|
||||
(while t
|
||||
(let ((ind (org-get-indentation)))
|
||||
(let ((ind (current-indentation)))
|
||||
(cond
|
||||
;; This is exactly what we want.
|
||||
((and (looking-at item-re) (< ind ind-ref))
|
||||
|
@ -620,7 +619,7 @@ Assume point is at an item."
|
|||
(item-re (org-item-re))
|
||||
(inlinetask-re (and (featurep 'org-inlinetask)
|
||||
(org-inlinetask-outline-regexp)))
|
||||
(beg-cell (cons (point) (org-get-indentation)))
|
||||
(beg-cell (cons (point) (current-indentation)))
|
||||
itm-lst itm-lst-2 end-lst end-lst-2 struct
|
||||
(assoc-at-point
|
||||
(function
|
||||
|
@ -648,7 +647,7 @@ Assume point is at an item."
|
|||
(save-excursion
|
||||
(catch 'exit
|
||||
(while t
|
||||
(let ((ind (org-get-indentation)))
|
||||
(let ((ind (current-indentation)))
|
||||
(cond
|
||||
((<= (point) lim-up)
|
||||
;; At upward limit: if we ended at an item, store it,
|
||||
|
@ -708,7 +707,7 @@ Assume point is at an item."
|
|||
;; position of items in END-LST-2.
|
||||
(catch 'exit
|
||||
(while t
|
||||
(let ((ind (org-get-indentation)))
|
||||
(let ((ind (current-indentation)))
|
||||
(cond
|
||||
((>= (point) lim-down)
|
||||
;; At downward limit: this is de facto the end of the
|
||||
|
@ -1884,7 +1883,7 @@ Initial position of cursor is restored after the changes."
|
|||
(org-inlinetask-goto-beginning))
|
||||
;; Shift only non-empty lines.
|
||||
((looking-at-p "^[ \t]*\\S-")
|
||||
(indent-line-to (+ (org-get-indentation) delta))))
|
||||
(indent-line-to (+ (current-indentation) delta))))
|
||||
(forward-line -1)))))
|
||||
(modify-item
|
||||
(function
|
||||
|
@ -1893,7 +1892,7 @@ Initial position of cursor is restored after the changes."
|
|||
(lambda (item)
|
||||
(goto-char item)
|
||||
(let* ((new-ind (org-list-get-ind item struct))
|
||||
(old-ind (org-get-indentation))
|
||||
(old-ind (current-indentation))
|
||||
(new-bul (org-list-bullet-string
|
||||
(org-list-get-bullet item struct)))
|
||||
(old-bul (org-list-get-bullet item old-struct))
|
||||
|
@ -1968,7 +1967,7 @@ Initial position of cursor is restored after the changes."
|
|||
;; Ignore empty lines. Also ignore blocks and
|
||||
;; drawers contents.
|
||||
(unless (looking-at-p "[ \t]*$")
|
||||
(setq min-ind (min (org-get-indentation) min-ind))
|
||||
(setq min-ind (min (current-indentation) min-ind))
|
||||
(cond
|
||||
((and (looking-at "#\\+BEGIN\\(:\\|_\\S-+\\)")
|
||||
(re-search-forward
|
||||
|
@ -2092,7 +2091,7 @@ Possible values are: `folded', `children' or `subtree'. See
|
|||
;; Descriptive list item. Body starts after item's tag, if
|
||||
;; possible.
|
||||
(let ((start (1+ (- (match-beginning 1) (line-beginning-position))))
|
||||
(ind (org-get-indentation)))
|
||||
(ind (current-indentation)))
|
||||
(if (> start (+ ind org-list-description-max-indent))
|
||||
(+ ind 5)
|
||||
start))
|
||||
|
@ -2965,7 +2964,7 @@ With a prefix argument ARG, change the region in a single item."
|
|||
(save-excursion
|
||||
(catch 'exit
|
||||
(while (< (point) end)
|
||||
(let ((i (org-get-indentation)))
|
||||
(let ((i (current-indentation)))
|
||||
(cond
|
||||
;; Skip blank lines and inline tasks.
|
||||
((looking-at "^[ \t]*$"))
|
||||
|
@ -2981,7 +2980,7 @@ With a prefix argument ARG, change the region in a single item."
|
|||
(while (< (point) end)
|
||||
(unless (or (looking-at "^[ \t]*$")
|
||||
(looking-at org-outline-regexp-bol))
|
||||
(indent-line-to (+ (org-get-indentation) delta)))
|
||||
(indent-line-to (+ (current-indentation) delta)))
|
||||
(forward-line))))))
|
||||
(skip-blanks
|
||||
(lambda (pos)
|
||||
|
@ -3073,7 +3072,7 @@ With a prefix argument ARG, change the region in a single item."
|
|||
;; set them as item's body.
|
||||
(arg (let* ((bul (org-list-bullet-string "-"))
|
||||
(bul-len (length bul))
|
||||
(ref-ind (org-get-indentation)))
|
||||
(ref-ind (current-indentation)))
|
||||
(skip-chars-forward " \t")
|
||||
(insert bul)
|
||||
(forward-line)
|
||||
|
|
|
@ -317,17 +317,6 @@ it for output."
|
|||
|
||||
;;; Indentation
|
||||
|
||||
(defun org-get-indentation (&optional line)
|
||||
"Get the indentation of the current line, interpreting tabs.
|
||||
When LINE is given, assume it represents a line and compute its indentation."
|
||||
(if line
|
||||
(when (string-match "^ *" (org-remove-tabs line))
|
||||
(match-end 0))
|
||||
(save-excursion
|
||||
(beginning-of-line 1)
|
||||
(skip-chars-forward " \t")
|
||||
(current-column))))
|
||||
|
||||
(defun org-do-remove-indentation (&optional n)
|
||||
"Remove the maximum common indentation from the buffer.
|
||||
When optional argument N is a positive integer, remove exactly
|
||||
|
|
|
@ -48,7 +48,6 @@
|
|||
(declare-function org-element-type "org-element" (element))
|
||||
(declare-function org-footnote-goto-definition "org-footnote"
|
||||
(label &optional location))
|
||||
(declare-function org-get-indentation "org" (&optional line))
|
||||
(declare-function org-switch-to-buffer-other-window "org" (&rest args))
|
||||
(declare-function org-trim "org" (s &optional keep-lead))
|
||||
|
||||
|
@ -502,7 +501,7 @@ Leave point in edit buffer."
|
|||
(type (org-element-type datum))
|
||||
(ind (org-with-wide-buffer
|
||||
(goto-char (org-element-property :begin datum))
|
||||
(org-get-indentation)))
|
||||
(current-indentation)))
|
||||
(preserve-ind
|
||||
(and (memq type '(example-block src-block))
|
||||
(or (org-element-property :preserve-indent datum)
|
||||
|
|
20
lisp/org.el
20
lisp/org.el
|
@ -8126,7 +8126,7 @@ Assume point is at a heading or an inlinetask beginning."
|
|||
((looking-at-p org-outline-regexp) (forward-line))
|
||||
((looking-at-p "[ \t]*$") (forward-line))
|
||||
(t
|
||||
(indent-line-to (+ (org-get-indentation) diff))
|
||||
(indent-line-to (+ (current-indentation) diff))
|
||||
(beginning-of-line)
|
||||
(or (and (looking-at-p "[ \t]*#\\+BEGIN_\\(EXAMPLE\\|SRC\\)")
|
||||
(let ((e (org-element-at-point)))
|
||||
|
@ -18095,7 +18095,7 @@ environment remains unintended."
|
|||
(let ((ind (if (bolp) 0
|
||||
(save-excursion
|
||||
(org-return-indent)
|
||||
(prog1 (org-get-indentation)
|
||||
(prog1 (current-indentation)
|
||||
(when (progn (skip-chars-forward " \t") (eolp))
|
||||
(delete-region beg (point)))))))
|
||||
(bol (progn (skip-chars-backward " \t") (bolp))))
|
||||
|
@ -21523,7 +21523,7 @@ ELEMENT."
|
|||
((item plain-list) (org-list-item-body-column post-affiliated))
|
||||
(t
|
||||
(goto-char start)
|
||||
(org-get-indentation))))
|
||||
(current-indentation))))
|
||||
((memq type '(headline inlinetask nil))
|
||||
(if (org-match-line "[ \t]*$")
|
||||
(org--get-expected-indentation element t)
|
||||
|
@ -21556,7 +21556,7 @@ ELEMENT."
|
|||
(setq start (org-element-property :begin previous)))
|
||||
(t (goto-char (org-element-property :begin previous))
|
||||
(throw 'exit
|
||||
(if (bolp) (org-get-indentation)
|
||||
(if (bolp) (current-indentation)
|
||||
;; At first paragraph in an item or
|
||||
;; a footnote definition.
|
||||
(org--get-expected-indentation
|
||||
|
@ -21575,7 +21575,7 @@ ELEMENT."
|
|||
((and (memq type '(footnote-definition plain-list))
|
||||
(> (count-lines (point) pos) 2))
|
||||
(goto-char start)
|
||||
(org-get-indentation))
|
||||
(current-indentation))
|
||||
;; Line above is the first one of a paragraph at the
|
||||
;; beginning of an item or a footnote definition. Indent
|
||||
;; like parent.
|
||||
|
@ -21602,9 +21602,9 @@ ELEMENT."
|
|||
(org--get-expected-indentation
|
||||
last (eq (org-element-type last) 'item)))
|
||||
(goto-char start)
|
||||
(org-get-indentation)))
|
||||
(current-indentation)))
|
||||
;; In any other case, indent like the current line.
|
||||
(t (org-get-indentation)))))))))
|
||||
(t (current-indentation)))))))))
|
||||
|
||||
(defun org--align-node-property ()
|
||||
"Align node property at point.
|
||||
|
@ -21740,7 +21740,7 @@ assumed to be significant there."
|
|||
(not
|
||||
(or org-src-preserve-indentation
|
||||
(org-element-property :preserve-indent element)))))
|
||||
(let ((offset (- ind (org-get-indentation))))
|
||||
(let ((offset (- ind (current-indentation))))
|
||||
(unless (zerop offset)
|
||||
(indent-rigidly (org-element-property :begin element)
|
||||
(org-element-property :end element)
|
||||
|
@ -21796,7 +21796,7 @@ assumed to be significant there."
|
|||
;; might break the list as a whole. On the other
|
||||
;; hand, when at a plain list, indent it as a whole.
|
||||
(cond ((eq type 'plain-list)
|
||||
(let ((offset (- ind (org-get-indentation))))
|
||||
(let ((offset (- ind (current-indentation))))
|
||||
(unless (zerop offset)
|
||||
(indent-rigidly (org-element-property :begin element)
|
||||
(org-element-property :end element)
|
||||
|
@ -22233,7 +22233,7 @@ region only contains such lines."
|
|||
(catch 'zerop
|
||||
(while (< (point) end)
|
||||
(unless (looking-at-p "[ \t]*$")
|
||||
(let ((ind (org-get-indentation)))
|
||||
(let ((ind (current-indentation)))
|
||||
(setq min-ind (min min-ind ind))
|
||||
(when (zerop ind) (throw 'zerop t))))
|
||||
(forward-line)))))
|
||||
|
|
|
@ -3281,7 +3281,7 @@ storing and resolving footnotes. It is created automatically."
|
|||
(beginning-of-line)
|
||||
;; Extract arguments from keyword's value.
|
||||
(let* ((value (org-element-property :value element))
|
||||
(ind (org-get-indentation))
|
||||
(ind (current-indentation))
|
||||
location
|
||||
(file
|
||||
(and (string-match
|
||||
|
|
Loading…
Reference in New Issue