update packages
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
|
||||
;; Author: Adam Porter <adam@alphapapa.net>
|
||||
;; Url: http://github.com/alphapapa/org-sticky-header
|
||||
;; Package-Version: 20191117.549
|
||||
;; Package-Commit: 1053ebdeb3bd14fc8d4538643532efb86d18b73c
|
||||
;; Version: 1.1-pre
|
||||
;; Package-Version: 20201223.143
|
||||
;; Package-Commit: 79136b8c54c48547ba8a07a72a9790cb8e23ecbd
|
||||
;; Version: 1.1
|
||||
;; Package-Requires: ((emacs "24.4") (org "8.3.5"))
|
||||
;; Keywords: hypermedia, outlines, Org
|
||||
|
||||
@@ -92,9 +92,9 @@ When this is on, and the top line of the buffer is a heading,
|
||||
you'll see the heading shown twice: once in the header and once
|
||||
in the buffer. But since the header can look different than the
|
||||
heading (i.e. it can show the full path), it shouldn't
|
||||
necessarily disappear. If you use full-path display, you probably
|
||||
want this on, but if you only display the current heading, you
|
||||
might prefer to turn it off. "
|
||||
necessarily disappear. If you use full-path display, you
|
||||
probably want this on, but if you only display the current
|
||||
heading, you might prefer to turn it off."
|
||||
:type 'boolean)
|
||||
|
||||
(defcustom org-sticky-header-prefix 'org-sticky-header--indent-prefix
|
||||
@@ -106,11 +106,11 @@ functions will be run with point on a heading."
|
||||
(function :tag "Custom function which returns a string")
|
||||
(const :tag "None" nil)))
|
||||
|
||||
(defcustom org-sticky-header-outline-path-separator "/"
|
||||
(defcustom org-sticky-header-outline-path-separator " ❯ "
|
||||
"String displayed between elements of outline paths."
|
||||
:type 'string)
|
||||
|
||||
(defcustom org-sticky-header-outline-path-reversed-separator "\\"
|
||||
(defcustom org-sticky-header-outline-path-reversed-separator " ❮ "
|
||||
"String displayed between elements of reversed outline paths."
|
||||
:type 'string)
|
||||
|
||||
@@ -122,6 +122,14 @@ headings in the buffer when `org-sticky-header-always-show-header'
|
||||
is enabled."
|
||||
:type 'string)
|
||||
|
||||
(defcustom org-sticky-header-show-keyword t
|
||||
"Show to-do keyword before heading text."
|
||||
:type 'boolean)
|
||||
|
||||
(defcustom org-sticky-header-show-priority t
|
||||
"Show priority before heading text."
|
||||
:type 'boolean)
|
||||
|
||||
;;;; Functions
|
||||
|
||||
(defun org-sticky-header-goto-heading (event)
|
||||
@@ -136,38 +144,64 @@ is enabled."
|
||||
"Return string of Org heading or outline path for display in header line."
|
||||
(org-with-wide-buffer
|
||||
(goto-char (window-start))
|
||||
(unless (org-before-first-heading-p)
|
||||
;; No non-header lines above top displayed header
|
||||
(when (or org-sticky-header-always-show-header
|
||||
(not (org-at-heading-p)))
|
||||
;; Header should be shown
|
||||
(when (fboundp 'org-inlinetask-in-task-p)
|
||||
;; Skip inline tasks
|
||||
(while (and (org-back-to-heading)
|
||||
(org-inlinetask-in-task-p))
|
||||
(forward-line -1)))
|
||||
(cond
|
||||
;; FIXME: Convert cond back to pcase, but one compatible with Emacs 24
|
||||
((null org-sticky-header-full-path)
|
||||
(concat (org-sticky-header--get-prefix)
|
||||
(org-get-heading t t)))
|
||||
((eq org-sticky-header-full-path 'full)
|
||||
(concat (org-sticky-header--get-prefix)
|
||||
(org-format-outline-path (org-get-outline-path t)
|
||||
(window-width)
|
||||
nil org-sticky-header-outline-path-separator)))
|
||||
((eq org-sticky-header-full-path 'reversed)
|
||||
(let ((s (concat (org-sticky-header--get-prefix)
|
||||
(mapconcat 'identity
|
||||
(nreverse (org-split-string (org-format-outline-path (org-get-outline-path t)
|
||||
1000 nil "")
|
||||
""))
|
||||
org-sticky-header-outline-path-reversed-separator))))
|
||||
(if (> (length s) (window-width))
|
||||
(concat (substring s 0 (- (window-width) 2))
|
||||
"..")
|
||||
s)))
|
||||
(t nil))))))
|
||||
(if (org-before-first-heading-p)
|
||||
""
|
||||
(progn
|
||||
;; No non-header lines above top displayed header
|
||||
(when (or org-sticky-header-always-show-header
|
||||
(not (org-at-heading-p)))
|
||||
;; Header should be shown
|
||||
(when (fboundp 'org-inlinetask-in-task-p)
|
||||
;; Skip inline tasks
|
||||
(while (and (org-back-to-heading)
|
||||
(org-inlinetask-in-task-p))
|
||||
(forward-line -1)))
|
||||
(cond
|
||||
;; TODO: Update minimum Emacs version and use `pcase'.
|
||||
((null org-sticky-header-full-path)
|
||||
(concat (org-sticky-header--get-prefix)
|
||||
(org-sticky-header--heading-string)))
|
||||
((eq org-sticky-header-full-path 'full)
|
||||
(concat (org-sticky-header--get-prefix)
|
||||
(mapconcat 'identity
|
||||
(nreverse
|
||||
(save-excursion
|
||||
(cl-loop collect (org-sticky-header--heading-string)
|
||||
while (org-up-heading-safe))))
|
||||
org-sticky-header-outline-path-separator)))
|
||||
((eq org-sticky-header-full-path 'reversed)
|
||||
(let ((s (concat
|
||||
(org-sticky-header--get-prefix)
|
||||
(mapconcat 'identity
|
||||
(save-excursion
|
||||
(cl-loop collect (org-sticky-header--heading-string)
|
||||
while (org-up-heading-safe)))
|
||||
org-sticky-header-outline-path-reversed-separator))))
|
||||
(if (> (string-width s) (window-width))
|
||||
(concat (substring s 0 (- (window-width) 2))
|
||||
"..")
|
||||
s)))
|
||||
(t "")))))))
|
||||
|
||||
(defun org-sticky-header--heading-string ()
|
||||
"Return string for heading at point.
|
||||
According to `org-sticky-header' options."
|
||||
;; TODO: Update minimum Emacs version and use `pcase-let*'.
|
||||
(let* ((components (org-heading-components))
|
||||
(level (nth 0 components))
|
||||
(keyword (nth 2 components))
|
||||
(priority (nth 3 components))
|
||||
(heading (org-link-display-format (nth 4 components)))
|
||||
(face (nth (1- level) org-level-faces)))
|
||||
(concat
|
||||
(when (and org-sticky-header-show-keyword keyword)
|
||||
(concat (propertize keyword 'face (org-get-todo-face keyword))
|
||||
" "))
|
||||
(when (and org-sticky-header-show-priority priority)
|
||||
(concat (propertize (concat "[#" (char-to-string priority) "]")
|
||||
'face 'org-priority)
|
||||
" "))
|
||||
(propertize heading 'face face))))
|
||||
|
||||
(defun org-sticky-header--get-prefix ()
|
||||
"Return prefix string depending on value of `org-sticky-header-prefix'."
|
||||
|
||||
Reference in New Issue
Block a user