pkg update and first config fix
org-brain not working, add org-roam
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(require 'cl-lib)
|
||||
(require 'subr-x))
|
||||
|
||||
(defface ivy-cursor
|
||||
@@ -97,15 +98,51 @@ Then attach the overlay to the character before point."
|
||||
(declare-function ivy-state-current "ivy")
|
||||
(declare-function ivy-state-window "ivy")
|
||||
|
||||
(defun ivy-overlay--current-column ()
|
||||
"Return `current-column', ignoring `ivy-overlay-at'.
|
||||
Temporarily make `ivy-overlay-at' invisible so that the
|
||||
`string-width' of its `display' property is not included in the
|
||||
`current-column' calculation by Emacs >= 29.
|
||||
See URL `https://bugs.gnu.org/53795'."
|
||||
(if (overlayp ivy-overlay-at)
|
||||
(cl-letf (((overlay-get ivy-overlay-at 'invisible) t))
|
||||
(1+ (current-column)))
|
||||
(current-column)))
|
||||
|
||||
(defun ivy-overlay-impossible-p (_str)
|
||||
(or
|
||||
(and (eq major-mode 'org-mode)
|
||||
(plist-get (text-properties-at (point)) 'src-block))
|
||||
;; If this breaks, an alternative is to call the canonical function
|
||||
;; `org-in-src-block-p', which is slower. Neither approach works
|
||||
;; in Org versions that shipped with Emacs < 26, however.
|
||||
(get-text-property (point) 'src-block))
|
||||
(<= (window-height) (+ ivy-height 2))
|
||||
(= (point) (point-min))
|
||||
(< (- (+ (window-width) (window-hscroll)) (current-column))
|
||||
(bobp)
|
||||
(< (- (+ (window-width) (window-hscroll))
|
||||
(ivy-overlay--current-column))
|
||||
30)))
|
||||
|
||||
(defun ivy-overlay--org-indent ()
|
||||
"Return `ivy-overlay-at' indentation due to `org-indent-mode'.
|
||||
That is, the additional number of columns needed under the mode."
|
||||
;; Emacs 28 includes the following fix for `https://bugs.gnu.org/49695':
|
||||
;;
|
||||
;; "Fix display of line/wrap-prefix when there's a display property at BOL"
|
||||
;; 662f91a795 2021-07-22 21:23:48 +0300
|
||||
;; `https://git.sv.gnu.org/cgit/emacs.git/commit/?id=662f91a795'
|
||||
;;
|
||||
;; This increasingly misindents `ivy-overlay-at' with each additional Org
|
||||
;; level. See also `https://github.com/abo-abo/swiper/commit/ee7f7f8c79'.
|
||||
;; FIXME: Is there a better way to work around this?
|
||||
(if (and (eq major-mode 'org-mode)
|
||||
(bound-and-true-p org-indent-mode)
|
||||
(< emacs-major-version 28))
|
||||
(let ((level (org-current-level)))
|
||||
(if (org-at-heading-p)
|
||||
(1- level)
|
||||
(* org-indent-indentation-per-level (or level 1))))
|
||||
0))
|
||||
|
||||
(defun ivy-display-function-overlay (str)
|
||||
"Called from the minibuffer, display STR in an overlay in Ivy window.
|
||||
Hide the minibuffer contents and cursor."
|
||||
@@ -134,17 +171,11 @@ Hide the minibuffer contents and cursor."
|
||||
(list "\n"
|
||||
(ivy-left-pad
|
||||
(string-remove-prefix "\n" str)
|
||||
(+
|
||||
(if (and (eq major-mode 'org-mode)
|
||||
(bound-and-true-p org-indent-mode))
|
||||
(if (org-at-heading-p)
|
||||
(1- (org-current-level))
|
||||
(* org-indent-indentation-per-level (or (org-current-level) 1)))
|
||||
0)
|
||||
(save-excursion
|
||||
(when ivy-completion-beg
|
||||
(goto-char ivy-completion-beg))
|
||||
(current-column)))))))))
|
||||
(+ (ivy-overlay--org-indent)
|
||||
(save-excursion
|
||||
(when ivy-completion-beg
|
||||
(goto-char ivy-completion-beg))
|
||||
(ivy-overlay--current-column)))))))))
|
||||
(let ((cursor-offset (1+ (length ivy-text))))
|
||||
(add-face-text-property cursor-offset (1+ cursor-offset)
|
||||
'ivy-cursor t overlay-str))
|
||||
|
||||
Reference in New Issue
Block a user