forked from mirrors/org-mode
Fix `org-hide-block-toggle-maybe'
* lisp/org.el (org-hide-block-toggle-maybe): Never throw an error. Improve docstring. (org-hide-block-toggle): Improve docstring.
This commit is contained in:
parent
9ba9f916e8
commit
2afd5fbb09
14
lisp/org.el
14
lisp/org.el
|
@ -7322,20 +7322,16 @@ Optional arguments START and END can be used to limit the range."
|
||||||
(setq org-hide-block-overlays nil))
|
(setq org-hide-block-overlays nil))
|
||||||
|
|
||||||
(defun org-hide-block-toggle-maybe ()
|
(defun org-hide-block-toggle-maybe ()
|
||||||
"Toggle visibility of block at point."
|
"Toggle visibility of block at point.
|
||||||
|
Do not throw an error. Return t when toggling is successful."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((case-fold-search t))
|
(ignore-errors (org-hide-block-toggle) t))
|
||||||
(if (save-excursion
|
|
||||||
(beginning-of-line 1)
|
|
||||||
(looking-at org-block-regexp))
|
|
||||||
(progn (org-hide-block-toggle)
|
|
||||||
t) ;; to signal that we took action
|
|
||||||
nil))) ;; to signal that we did not
|
|
||||||
|
|
||||||
(defun org-hide-block-toggle (&optional force)
|
(defun org-hide-block-toggle (&optional force)
|
||||||
"Toggle the visibility of the current block.
|
"Toggle the visibility of the current block.
|
||||||
When optional argument FORCE is `off', make block visible. If it
|
When optional argument FORCE is `off', make block visible. If it
|
||||||
is non-nil, hide it unconditionally."
|
is non-nil, hide it unconditionally. Throw an error when not at
|
||||||
|
a block."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((element (org-element-at-point)))
|
(let ((element (org-element-at-point)))
|
||||||
(unless (memq (org-element-type element)
|
(unless (memq (org-element-type element)
|
||||||
|
|
Loading…
Reference in New Issue