-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnav.elc
202 lines (193 loc) · 23.5 KB
/
nav.elc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
;ELC
;;; Compiled by [email protected] on Mon May 7 00:08:15 2012
;;; from file /Users/issactrotts/repos/emacs-nav/nav.el
;;; in Emacs version 23.3.1
;;; with all optimizations.
;;; This file uses dynamic docstrings, first added in Emacs 19.29.
;;; This file does not contain utf-8 non-ASCII characters,
;;; and so can be loaded in Emacs versions earlier than 23.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(byte-code "\300\301!\204 \302\303\304\217\210\305\306\307\310\311\312%\207" [featurep full-ack err (byte-code "\300\301!\207" [require ack] 2) ((error (message "Could not load ack."))) custom-declare-group nav nil "A lightweight filesystem navigator." :group applications] 6)
#@150 *If true, Nav will filter out files and directories such as
hidden files, backups and .elc files. The result depends on
`nav-boring-file-regexps'.
(custom-declare-variable 'nav-filtered-p 't '(#$ . -801) :type 'boolean :group 'nav)
#@87 *If non-nil, Nav will change its width to this when it opens files in
other windows.
(custom-declare-variable 'nav-width '25 '(#$ . -1041) :type 'integer :group 'nav)
#@72 *Nav ignores filenames that match any regular expression in this list.
(custom-declare-variable 'nav-boring-file-regexps '(list "^[.][^.].*$" "^[.]$" "~$" "[.]elc$" "[.]pyc$" "[.]o$" "[.]bak$" "^_MTN$" "^blib$" "^CVS$" "^RCS$" "^SCCS$" "^_darcs$" "^_sgbak$" "^autom4te.cache$" "^cover_db$" "^_build$") '(#$ . -1215) :type '(repeat string) :group 'nav)
(require 'dired)
#@33 Face name used for directories.
(defvar nav-directory-face 'dired-directory (#$ . 1590))
#@76 Regexes and associated faces used by Nav to fontify files and
directories.
(defvar nav-font-lock-keywords '(("^.*/$" . nav-directory-face)) (#$ . 1685))
#@57 Creates and returns a mode map with nav's key bindings.
(defalias 'nav-make-mode-map #[nil "\301 \302\303\304#\210\302\305\306#\210\302\307\310#\210\302\311\312#\210\302\313\314#\210\302\315\316#\210\302\317\320#\210\302\321\322#\210\302\323\324#\210\302\325\326#\210\302\327\330#\210\302\331\332#\210\302\333\334#\210\302\335\336#\210\302\337\340#\210\302\341\342#\210\302\343\344#\210\302\345\346#\210\302\347\350#\210\302\351\352#\210\302\353\354#\210\302\355\356#\210\302\357\360#\210\302\361\360#\210\302\362\363#\210\302\364\363#\210\302\365\366#\210\302\367\370#\210\302\371\372#\210)\207" [keymap make-sparse-keymap define-key "a" ack "c" nav-copy-file-or-dir "C" nav-customize "d" nav-delete-file-or-dir-on-this-line "e" nav-invoke-dired "f" nav-find-files "g" grep-find "h" nav-jump-to-home "j" nav-jump-to-dir "m" nav-move-file-or-dir "n" nav-make-new-directory "o" nav-open-file-under-cursor "p" nav-pop-dir "P" nav-print-current-dir "q" nav-unsplit-window-horizontally "r" nav-refresh "s" nav-shell "u" nav-go-up-one-dir "w" nav-shrink-wrap "!" nav-shell-command "." nav-toggle-hidden-files "?" nav-help-screen "-" nav-shrink-a-bit "_" "+" nav-expand-a-bit "=" " " nav-jump-to-name [(control 120) (control 102)] nav-find-file-other-window [(control 120) 98] nav-switch-to-buffer-other-window] 4 (#$ . 1844)])
#@198 First, compute a new value for the delta to make sure we don't
make the window too small, according to the following equation:
window-width - delta' = max(window-min-width, window-width - delta)
(defalias 'nav-shrink-window-horizontally #[(delta) "\302 \302 Z]Z\303 !\210\304 )\207" [window-min-width delta window-width shrink-window-horizontally nav-remember-current-width-during-this-session] 4 (#$ . 3204)])
(defalias 'nav-enlarge-window-horizontally #[(delta) "\301!\210\302 \207" [delta enlarge-window-horizontally nav-remember-current-width-during-this-session] 2])
(defalias 'nav-remember-current-width-during-this-session #[nil "\300\301\302 \"\207" [customize-set-variable nav-width window-width] 3])
#@57 Decreases the width of the nav window by one character.
(defalias 'nav-shrink-a-bit #[nil "\300\301!\207" [nav-shrink-window-horizontally 1] 2 (#$ . 3926) nil])
#@57 Increases the width of the nav window by one character.
(defalias 'nav-expand-a-bit #[nil "\300\301!\207" [nav-enlarge-window-horizontally 1] 2 (#$ . 4093) nil])
#@28 Exits the nav help screen.
(defalias 'nav-quit-help #[nil "\300p!\207" [kill-buffer] 2 (#$ . 4261) nil])
#@27 Displays the help screen.
(defalias 'nav-help-screen #[nil "\300\301!\210\302c\210\303\304!\210\305\306!\210\307\304!\207" [switch-to-buffer-other-window "*nav-help*" "Nav Key Bindings\n================\n\nEnter/Return: Go to directory under cursor, or open file under\n cursor in other window.\n\nTab: Move forward through filenames.\nShift-Tab: Move backward through filenames.\n\nSpace: Press spacebar, then any other letter to jump to filename\n that starts with that letter.\n\na Recursively grep for a Perl regex using Ack (http://betterthangrep.com/).\nc Copy file or directory under cursor.\nC Customize Nav settings and bookmarks.\nd Delete file or directory under cursor (asks to confirm first).\ne Edit current directory in dired.\nf Recursively find files whose titles match a Perl regex (using Ack).\ng Grep recursively from current directory using grep-find\nh Jump to home (~).\nj Jump to another directory.\nm Move or rename file or directory.\nn Make a new directory.\no Open file under cursor in the nav window.\np Pop directory stack to go back to the previous directory.\nP Print full path of current displayed directory.\nq Quit nav.\nr Refresh.\ns Start a shell in an emacs window in the current directory.\nu Go up to parent directory.\nw Shrink-wrap Nav's window to fit the longest filename in the current directory.\n Hit C-x + to roughly undo this by balancing windows.\n! Run shell command.\n. Toggle display of hidden files.\n? Show this help screen.\n- Narrow Nav window by one character.\n+ Widen Nav window by one character.\n" nav-goto-line 1 view-mode -1 toggle-read-only] 2 (#$ . 4372) nil])
#@23 Mode map for nav mode
(defvar nav-mode-map (nav-make-mode-map) (#$ . 6049))
(byte-code "\301B\302\301!\204 \303\301\304\"\210\304\207" [current-load-list nav-dir-stack default-boundp set-default nil] 3)
#@62 Hash table from dir paths to most recent cursor pos in them.
(defvar nav-map-dir-to-line-number (make-hash-table :test 'equal) (#$ . 6261))
(byte-code "\301B\302\301!\204 \303\301\304\"\210\304\207" [current-load-list nav-button-face default-boundp set-default nil] 3)
#@121 Line where cursor starts in directories that have not yet been
visited. A value of 1 would start the cursor off on ../.
(defconst nav-default-line-num 2 (#$ . 6540))
#@85 Name of the buffer used for the command line shell spawned by
nav on the 's' key.
(defconst nav-shell-buffer-name "*nav-shell*" (#$ . 6712))
#@56 Name of the buffer where nav shows directory contents.
(defconst nav-buffer-name "*nav*" (#$ . 6861))
#@50 Name of the buffer where nav shows find results.
(defconst nav-buffer-name-for-find-results "*nav-find*" (#$ . 6969))
(defalias 'nav-join #[(sep string-list) "\302\303 #\207" [string-list sep mapconcat identity] 4])
(defalias 'nav-toggle-hidden-files #[nil "?\301 \207" [nav-filtered-p nav-refresh] 1 nil nil])
(defalias 'nav-filename-matches-some-regexp #[(filename regexps) "\305 \305\211\203 @\306\n\f\"\203 \307A\211\204\n *)\207" [matches-p regexps rx --dolist-tail-- filename nil string-match t] 4])
(defalias 'nav-filter #[(condp lst) "\301\302\303\304\"\"\207" [lst delq nil mapcar #[(x) " !\205 \207" [condp x] 2]] 5])
(defalias 'nav-filter-out-boring-filenames #[(filenames boring-regexps) "\301\302\"\207" [filenames nav-filter #[(filename) "\302 \"?\207" [filename boring-regexps nav-filename-matches-some-regexp] 3]] 3])
(defalias 'nav-get-line-for-cur-dir #[nil "\301\302 \"\207" [nav-map-dir-to-line-number gethash nav-get-working-dir] 3])
#@64 Changes to a different directory and pushes it onto the stack.
(defalias 'nav-cd #[(dirname) "\302\303!!\304 \210\305!\210\306 )\207" [dirname default-directory file-name-as-directory file-truename nav-save-cursor-line nav-show-dir nav-restore-cursor-line] 3 (#$ . 7951)])
#@33 Updates line number hash table.
(defalias 'nav-save-cursor-line #[nil "\302`!\303\304 #)\207" [line-num nav-map-dir-to-line-number nav-line-number-at-pos puthash nav-get-working-dir] 4 (#$ . 8235)])
#@32 Jumps point to the given line.
(defalias 'nav-goto-line #[(line) "eb\210Sy\207" [line] 1 (#$ . 8443)])
#@69 Remembers what line we were on last time we visited this directory.
(defalias 'nav-restore-cursor-line #[nil "\302 \206 \303 !)\207" [nav-default-line-num line-num nav-get-line-for-cur-dir nav-goto-line] 2 (#$ . 8553)])
#@37 Opens a file or directory from Nav.
(defalias 'nav-open-file #[(filename) "\301!\203\n \302!\207\303!\207" [filename file-directory-p nav-push-dir find-file] 2 (#$ . 8782) "FFilename:"])
#@37 Opens a file or directory from Nav.
(defalias 'nav-open-file-other-window #[(filename) "\303!\203\n \304!\207 P\305\n!)\207" [filename default-directory path file-directory-p nav-push-dir nav-find-file-other-window] 2 (#$ . 8978) "FFilename:"])
#@53 Opens the file FILENAME in the window to the right.
(defalias 'nav-find-file-other-window #[(filename) "\301!\210\302 \210\303!\207" [filename message nav-must-windmove-right find-file] 2 (#$ . 9233) "FFilename:"])
(defalias 'nav-switch-to-buffer-other-window #[(buffer-name) "\301 \210\302!\207" [buffer-name nav-must-windmove-right switch-to-buffer] 2 nil "bSwitch to buffer:"])
#@182 Moves point to the window to the right of the current one.
If there is no such window, it first splits the current window
and then moves to the new window just formed on the right.
(defalias 'nav-must-windmove-right #[nil "\300\301\302\217\207" [err (windmove-right) ((error (byte-code "\300 \210\301 \207" [split-window-horizontally windmove-right] 1)))] 3 (#$ . 9624)])
#@34 Finds the file under the cursor.
(defalias 'nav-open-file-under-cursor #[nil "\301 \302!)\207" [filename nav-get-cur-line-str nav-open-file] 2 (#$ . 10002) nil])
#@40 Returns the currently selected window.
(defalias 'nav-get-current-window #[nil "\300p!\207" [get-buffer-window] 2 (#$ . 10172)])
#@53 Returns the width of the currently selected window.
(defalias 'nav-get-current-window-width #[nil "\300\301 !\207" [window-width nav-get-current-window] 2 (#$ . 10307)])
#@20 Points Nav to ../.
(defalias 'nav-go-up-one-dir #[nil "\300\301!\207" [nav-push-dir ".."] 2 (#$ . 10483) nil])
(defalias 'nav-get-shrink-wrap-width #[nil "\305\306 \307\310#\211G\311\312\"\313\314\n\"T\315 \316\245\f^-\207" [lines num-lines line-lengths desired-width max-width split-string buffer-string "\n" t mapcar length apply max frame-width 2] 5])
#@147 Updates the width of the Nav window to fit the longest filename in the
current directory. Updates the global variable nav-width as a side effect.
(defalias 'nav-shrink-wrap #[nil "\300\301 !\207" [nav-set-window-width nav-get-shrink-wrap-width] 2 (#$ . 10852) nil])
(defalias 'nav-push-dir #[(dirname) "\303!\211 \230?\205 \303 !\nB\304!)\207" [dirname default-directory nav-dir-stack file-truename nav-cd] 3])
#@95 Goes to the previous directory in Nav's history.
This works like a web browser's back button.
(defalias 'nav-pop-dir #[nil "\302 \203# \203 \303\304\305!!\232\204 \306!\204# \211A@\202 \206( \305\307!)\207" [dir nav-dir-stack nil file-name-as-directory file-truename "." file-exists-p nav-cd] 4 (#$ . 11274) nil])
(defalias 'nav-get-cur-line-str #[nil "\300\301 \302 \"\207" [buffer-substring-no-properties point-at-bol point-at-eol] 3])
(defalias 'nav-non-boring-directory-files #[(dir) "\303\304! \205 \n\"\207" [dir nav-filtered-p nav-boring-file-regexps nav-filter-out-boring-filenames directory-files] 3])
(defalias 'nav-dir-suffix #[(dir) "\301\302\303\304!#\207" [dir replace-regexp-in-string ".*/" "" directory-file-name] 5])
(defalias 'nav-line-number-at-pos #[(p) "\304 \305\nW\203 \nf\306=\203 T\nT\211\202 +\207" [line-num p i --dotimes-limit-- 1 0 10] 3])
(defalias 'nav-replace-buffer-contents #[(new-contents) "\303`!\304\305 \210\nc\210\306 \210\307 !*\207" [inhibit-read-only saved-line-number new-contents nav-line-number-at-pos t erase-buffer nav-make-filenames-clickable nav-goto-line] 2])
(defalias 'nav-select-window #[(window) "\203 \301!\207\302\303!\207" [window select-window message "Attempted to select nil window"] 2])
#@52 Opens a file or directory in response to a button.
(defalias 'nav-button-action-to-open-file #[(button) "\305!\306 !\307\n!\210\310 \311U\203 \312 \210\313\314!!\210\205/ \315 \316\n!\210\317!\210\316\f!)*\207" [button buffer window-with-nav nav-width other-window overlay-buffer get-buffer-window nav-select-window count-windows 1 split-window-horizontally nav-open-file-other-window button-label nav-get-current-window select-window nav-set-window-width] 3 (#$ . 12560)])
(defalias 'nav-button-action-to-open-dir #[(button) "\302!\303 !\210\304\305!!)\207" [button buffer overlay-buffer pop-to-buffer nav-push-dir button-label] 3])
(defalias 'nav-make-filenames-clickable #[nil "\300\301\302\217\207" [err (byte-code "\212\306\307!\210\310\307d\"\311 W\205C \312 \313 \314\n\"\315\f!\203'