Skip to content

Commit

Permalink
Merge pull request #208 from ilupin/help-echo
Browse files Browse the repository at this point in the history
Customize help-echo messages for neotree nodes
  • Loading branch information
aborn authored Dec 29, 2016
2 parents 0fb23de + df77687 commit f4c13c3
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions neotree.el
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,15 @@ the mode-line format."
:type '(choice (const text)
(const button)))

(defcustom neo-help-echo-style 'default
"The message NeoTree displays when the mouse moves onto nodes.
`default' means the node name is displayed if it has a
width (including the indent) larger than `neo-window-width', and
`none' means NeoTree doesn't display any messages."
:group 'neotree
:type '(choice (const default)
(const none)))

(defcustom neo-click-changes-root nil
"*If non-nil, clicking on a directory will change the current root to the directory."
:type 'boolean
Expand Down Expand Up @@ -1277,6 +1286,15 @@ PATH is value."
'neo-root-dir-face)))
(neo-buffer--newline-and-begin))

(defun neo-buffer--help-echo-message (node-name)
(cond
((eq neo-help-echo-style 'default)
(if (<= (+ (current-column) (string-width node-name))
neo-window-width)
nil
node-name))
(t nil)))

(defun neo-buffer--insert-dir-entry (node depth expanded)
(let ((node-short-name (neo-path--file-short-name node)))
(insert-char ?\s (* (- depth 1) 2)) ; indent
Expand All @@ -1288,7 +1306,8 @@ PATH is value."
'follow-link t
'face neo-dir-link-face
'neo-full-path node
'keymap neotree-dir-button-keymap)
'keymap neotree-dir-button-keymap
'help-echo (neo-buffer--help-echo-message node-short-name))
(neo-buffer--node-list-set nil node)
(neo-buffer--newline-and-begin)))

Expand All @@ -1306,7 +1325,8 @@ PATH is value."
(cdr vc)
neo-file-link-face)
'neo-full-path node
'keymap neotree-file-button-keymap)
'keymap neotree-file-button-keymap
'help-echo (neo-buffer--help-echo-message node-short-name))
(neo-buffer--node-list-set nil node)
(neo-buffer--newline-and-begin)))

Expand Down

0 comments on commit f4c13c3

Please sign in to comment.