Artificial intelligent assistant

outline-mode にてある heading が sibling の中で末の要素であることを確認するには? outline-mode heading sibling (defun last-sibling-heading-p () ......)

outline-mode heading sibling


1. outline-mode
2. Emacsoutline-mode heading sibling





2



(defun last-sibling-heading-p ()
(save-excursion
(let ((start (point))
prev)
(ignore-errors (outline-forward-same-level 1))
(setq prev (point))
(ignore-errors (outline-forward-same-level 1))
(and (= prev (point))
(>= start (point))))))

;; M-x foosibling
(defun foo ()
(interactive)
(message (if (last-sibling-heading-p) "last" "butlast")))






* A
** a
** b
** c
* B
* C


c"last"

emacs-lisp

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy cfa4f9aad5496ca7622ac30900a3d558