summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2011-08-21 21:31:58 +0200
committerNicolas Goaziou <n.goaziou@gmail.com>2011-08-21 21:39:56 +0200
commit405ebb43dfaff5ad1177837215039b62946201fb (patch)
treef545ca13e6947b9095454642c7d214b47e27f3b9
parent5303994d9a59add555ef918fade9001b4bee8326 (diff)
downloadorg-mode-405ebb43dfaff5ad1177837215039b62946201fb.tar.gz
org-list: remove dependency on `org-back-over-empty-lines'
* lisp/org-list.el (org-list-separating-blank-lines-number): the behaviour of `org-back-over-empty-lines' depends on the associated value of `headline' in `org-blank-before-new-entry', which is out of context in a list.
-rw-r--r--lisp/org-list.el23
1 files changed, 15 insertions, 8 deletions
diff --git a/lisp/org-list.el b/lisp/org-list.el
index 8f34802..c54c966 100644
--- a/lisp/org-list.el
+++ b/lisp/org-list.el
@@ -94,7 +94,6 @@
(declare-function org-at-heading-p "org" (&optional ignored))
(declare-function org-before-first-heading-p "org" ())
-(declare-function org-back-over-empty-lines "org" ())
(declare-function org-back-to-heading "org" (&optional invisible-ok))
(declare-function org-combine-plists "org" (&rest plists))
(declare-function org-count "org" (cl-item cl-seq))
@@ -1167,7 +1166,16 @@ some heuristics to guess the result."
(let ((item (point))
(insert-blank-p
(cdr (assq 'plain-list-item org-blank-before-new-entry)))
- usr-blank)
+ usr-blank
+ (count-blanks
+ (function
+ (lambda ()
+ ;; Count blank lines above beginning of line.
+ (save-excursion
+ (count-lines (goto-char (point-at-bol))
+ (progn (skip-chars-backward " \r\t\n")
+ (forward-line)
+ (point))))))))
(cond
;; Trivial cases where there should be none.
((or (and (not (eq org-list-ending-method 'indent))
@@ -1181,16 +1189,15 @@ some heuristics to guess the result."
(cond
;; Is there a next item?
(next-p (goto-char next-p)
- (org-back-over-empty-lines))
+ (funcall count-blanks))
;; Is there a previous item?
((org-list-get-prev-item item struct prevs)
- (org-back-over-empty-lines))
+ (funcall count-blanks))
;; User inserted blank lines, trust him.
((and (> pos (org-list-get-item-end-before-blank item struct))
- (> (save-excursion
- (goto-char pos)
- (skip-chars-backward " \t")
- (setq usr-blank (org-back-over-empty-lines))) 0))
+ (> (save-excursion (goto-char pos)
+ (setq usr-blank (funcall count-blanks)))
+ 0))
usr-blank)
;; Are there blank lines inside the list so far?
((save-excursion