summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2018-05-09 01:26:31 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2018-05-09 01:26:31 +0200
commit0dda9bf1c1c7b1750a762b39ce97e1ed393bd65d (patch)
tree3775c1e70a62b3d799a3283499de17d1837c4da1
parent0c03971b09b1354367822b1117f8c73dbf13bc9d (diff)
downloadorg-mode-0dda9bf1c1c7b1750a762b39ce97e1ed393bd65d.tar.gz
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.
-rw-r--r--lisp/ob-core.el8
-rw-r--r--lisp/ob-exp.el3
-rw-r--r--lisp/org-agenda.el4
-rw-r--r--lisp/org-capture.el6
-rw-r--r--lisp/org-clock.el2
-rw-r--r--lisp/org-compat.el2
-rw-r--r--lisp/org-element.el2
-rw-r--r--lisp/org-feed.el2
-rw-r--r--lisp/org-indent.el2
-rw-r--r--lisp/org-list.el25
-rw-r--r--lisp/org-macs.el11
-rw-r--r--lisp/org-src.el3
-rw-r--r--lisp/org.el20
-rw-r--r--lisp/ox.el2
14 files changed, 39 insertions, 53 deletions
diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index aa4c371..7e8c6db 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -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
diff --git a/lisp/ob-exp.el b/lisp/ob-exp.el
index 1ff7832..0b7a1da 100644
--- a/lisp/ob-exp.el
+++ b/lisp/ob-exp.el
@@ -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
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 62ce25d..e1745f9 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -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))
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 09e230a..3f53fee 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -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 ?\ ))
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index d727fa1..04e31f8 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -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
diff --git a/lisp/org-compat.el b/lisp/org-compat.el
index dcdab7c..d2008db 100644
--- a/lisp/org-compat.el
+++ b/lisp/org-compat.el
@@ -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."
diff --git a/lisp/org-element.el b/lisp/org-element.el
index 3bd3a6f..8f28ab4 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -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))
diff --git a/lisp/org-feed.el b/lisp/org-feed.el
index 480e68a..0028d75 100644
--- a/lisp/org-feed.el
+++ b/lisp/org-feed.el
@@ -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
diff --git a/lisp/org-indent.el b/lisp/org-indent.el
index 38c5f07..ceb6c4b 100644
--- a/lisp/org-indent.el
+++ b/lisp/org-indent.el
@@ -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.
diff --git a/lisp/org-list.el b/lisp/org-list.el
index 37d245a..e7b2b58 100644
--- a/lisp/org-list.el
+++ b/lisp/org-list.el
@@ -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)
diff --git a/lisp/org-macs.el b/lisp/org-macs.el
index 611401c..a148b56 100644
--- a/lisp/org-macs.el
+++ b/lisp/org-macs.el
@@ -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
diff --git a/lisp/org-src.el b/lisp/org-src.el
index a69a416..cff8a49 100644
--- a/lisp/org-src.el
+++ b/lisp/org-src.el
@@ -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)
diff --git a/lisp/org.el b/lisp/org.el
index 815c713..518f9dc 100644
--- a/lisp/org.el
+++ b/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)))))
diff --git a/lisp/ox.el b/lisp/ox.el
index 4becf38..90fca86 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -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