mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-07-20 16:26:29 +00:00
org-element: Small optimization
* lisp/org-element.el (org-element--remove-indentation): Small optimization.
This commit is contained in:
parent
10169054eb
commit
206762bd34
|
@ -1660,22 +1660,22 @@ function doesn't call `untabify' on S."
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
;; Find maximum common indentation, if not specified.
|
;; Find maximum common indentation, if not specified.
|
||||||
(setq n (or n
|
(setq n (or n
|
||||||
(catch 'min-ind
|
(let ((min-ind (point-max)))
|
||||||
(let ((min-ind (point-max)))
|
(save-excursion
|
||||||
(save-excursion
|
(while (re-search-forward "^[ \t]*\\S-" nil t)
|
||||||
(while (re-search-forward "^[ \t]*\\S-" nil t)
|
(let ((ind (1- (current-column))))
|
||||||
(let ((ind (1- (current-column))))
|
(if (zerop ind) (throw 'exit s)
|
||||||
(if (zerop ind) (throw 'min-ind 0)
|
(setq min-ind (min min-ind ind))))))
|
||||||
(setq min-ind (min min-ind ind))))))
|
min-ind)))
|
||||||
min-ind))))
|
(if (zerop n) s
|
||||||
;; Remove exactly N indentation, but give up if not possible.
|
;; Remove exactly N indentation, but give up if not possible.
|
||||||
(while (not (eobp))
|
(while (not (eobp))
|
||||||
(let ((ind (progn (skip-chars-forward " \t") (current-column))))
|
(let ((ind (progn (skip-chars-forward " \t") (current-column))))
|
||||||
(cond ((eolp) (delete-region (line-beginning-position) (point)))
|
(cond ((eolp) (delete-region (line-beginning-position) (point)))
|
||||||
((< ind n) (throw 'exit s))
|
((< ind n) (throw 'exit s))
|
||||||
(t (org-indent-line-to (- ind n))))
|
(t (org-indent-line-to (- ind n))))
|
||||||
(forward-line)))
|
(forward-line)))
|
||||||
(buffer-string))))
|
(buffer-string)))))
|
||||||
|
|
||||||
(defun org-element-example-block-parser (limit affiliated)
|
(defun org-element-example-block-parser (limit affiliated)
|
||||||
"Parse an example block.
|
"Parse an example block.
|
||||||
|
|
Loading…
Reference in a new issue