소스 검색

Tiny refactoring

* lisp/org.el (org-current-level): Tiny refactoring.
Nicolas Goaziou 10 년 전
부모
커밋
6dcaafff3e
1개의 변경된 파일2개의 추가작업 그리고 4개의 파일을 삭제
  1. 2 4
      lisp/org.el

+ 2 - 4
lisp/org.el

@@ -8084,10 +8084,8 @@ in the region."
 (defun org-current-level ()
   "Return the level of the current entry, or nil if before the first headline.
 The level is the number of stars at the beginning of the headline."
-  (save-excursion
-    (org-with-limited-levels
-     (if (ignore-errors (org-back-to-heading t))
-	 (funcall outline-level)))))
+  (let ((level (org-with-limited-levels (org-outline-level))))
+    (and (> level 0) level)))
 
 (defun org-get-previous-line-level ()
   "Return the outline depth of the last headline before the current line.