chiark / gitweb /
Found on mariner (already did .bashrc and .emacs)
[ian-dotfiles.git] / home / emacs / ian.el
1 ; This is my real emacs start-up file (for chiark).
2
3 (make-variable-buffer-local 'indent-line-function)
4 ; Un-disable narrow and eval-expression
5 (put 'narrow-to-region 'disabled nil)
6 (put 'eval-expression 'disabled nil)
7 (standard-display-european t)
8 ;
9 ; Make sure we don't disturb links or change ownership, use numbers
10 (setq backup-by-copying-when-mismatch t)
11 (setq backup-by-copying-when-linked t)
12 ;(setq version-control t
13 ;      kept-new-versions 4
14 ;      kept-old-versions 4
15 ;      trim-versions-without-asking t)
16 ;
17 ; Various one-liners
18 (setq require-final-newline "ask")
19 (if (string= window-system 'x) (load-library "ian-x"))
20 (load-library "ian-aliases")
21 ; (load-library "auto-pgp")
22 ; (load-library "debian-changelog-mode")
23 ; (if (string= (getenv "TERM") "bbcb32") (setq term-file-prefix nil))
24 ; (setq explicit-shell-file-name "/usr/local/bin/tcsh")
25 (setq inhibit-local-variables t)
26 (setq enable-local-variables 'ask-me)
27 (setq enable-recursive-minibuffers t)
28 (setq compile-command "make")
29 (setq compilation-context-lines 0)
30 (setq compilation-skip-threshold 0)
31 (setq compilation-scroll-output 'first-error)
32 (global-set-key "\18\\" 'previous-error)
33 (setq diff-switches "-u")
34 (display-time)
35 (setq next-line-add-newlines t)
36 ;
37 (set-variable 'search-repeat-char 28)
38 (if (string-match "^19\." emacs-version)
39     (progn
40       (setq file-name-handler-alist     ; Disable nasty auto-loading of ange-ftp
41             (delq (rassq 'ange-ftp-completion-hook-function file-name-handler-alist)
42                   file-name-handler-alist))
43       (require 'find-alternate-18style)
44       (defun unset-down-mouse-23 ()
45         (local-set-key [mouse-2] 'mouse-yank-at-click)
46         (local-unset-key [down-mouse-2])
47         (local-unset-key [down-mouse-3])
48         (local-unset-key [C-down-mouse-3]))
49       (add-hook 'vm-mode-hook 'unset-down-mouse-23)
50       (add-hook 'vm-mail-mode-hook 'unset-down-mouse-23)
51       (add-hook 'text-mode-hook 'unset-down-mouse-23)
52       (add-hook 'Info-mode-hook
53                 (function (lambda ()
54                             (local-set-key " " 'scroll-up)
55                             (local-set-key "\7f" 'scroll-down))))
56       (add-hook 'sh-mode-hook
57                 (function (lambda ()
58                             (local-set-key "<" 'self-insert-command))))
59       (define-key isearch-mode-map "\1c" 'isearch-repeat-forward)
60       (define-key isearch-mode-map "\1d" 'isearch-quote-char)))
61 ;
62 (menu-bar-mode -1)
63 (tool-bar-mode -1)
64 (defun terminal-keybindings ()
65   "This function should be called by the term-setup-hook mechanism"
66   (interactive)
67   ; Set my own keybindings
68   ;
69   ; Set keybindings generally (including I-search on C-\)
70 ;  (global-set-key "    " 'self-insert-command)
71   (global-set-key "\1c" 'isearch-forward)
72   (global-set-key "\r" 'newline-and-indent)
73   (global-set-key "\ f" 'set-mark-command)
74   (global-set-key "\1d" 'quoted-insert)
75   ;
76   ; Set keybindings on esc-map
77   (global-set-key "\e#" 'query-replace-regexp)
78   (global-set-key "\e+" 'toggle-truncate-lines)
79   (global-set-key "\eg" 'goto-line)
80   (global-set-key "\es" 'isearch-forward-regexp)
81   (global-set-key "\e\e" 'eval-expression)
82   ;
83   ; Set keybindings on ^X-map.
84   (global-set-key "\18m" 'vm-mail)
85   (global-set-key "\18\1c" 'save-buffer)
86   (global-set-key "\18\1d" 'toggle-read-only)
87   (global-set-key "\18#" 'recover-file)
88   (global-set-key "\18\12" 'bury-buffer)
89   (global-set-key "\18\v" 'quicker-compile)
90   (global-set-key "\18\18" 'exchange-point-and-mark)
91   (global-set-key "\18\1a" 'load-ange-ftp)
92   (global-set-key "\184\16" 'scroll-other-window)
93   (global-set-key "\184m" 'vm-mail-other-window)
94   (global-set-key "\189" 'vm-visit-folder)
95   (global-set-key "\188" 'rmail-input)
96   (global-set-key "\18p" 'cite-region)
97   (global-set-key "\18F" 'mail-formletter)
98   ;
99   ; Set keybindings for Sun numeric pad.
100   (setq esc-bracket-map (make-keymap))
101   (define-key esc-bracket-map "D" 'backward-char)
102   (define-key esc-bracket-map "C" 'forward-char)
103   (define-key esc-bracket-map "A" 'previous-line)
104   (define-key esc-bracket-map "B" 'next-line)
105   (define-key esc-map "[" esc-bracket-map)
106   (global-set-key "\e[214z" 'beginning-of-buffer)
107   (global-set-key "\e[220z" 'end-of-buffer)
108   (global-set-key "\e[216z" 'scroll-down)
109   (global-set-key "\e[222z" 'scroll-up)
110   (global-set-key "\e[192z" 'save-buffer)
111   (global-set-key "\e[194z" 'save-some-buffers)
112   (global-set-key "\e[195z" 'undo)
113   (global-set-key "\e[193z" 'call-last-kbd-macro)
114   (global-set-key "\e[196z" 'switch-to-buffer-other-window)
115   (global-set-key "\e[197z" 'copy-region-as-kill)
116   (global-set-key "\e[198z" 'find-file)
117   (global-set-key "\e[199z" 'yank)
118   (global-set-key "\e[198z" 'find-alternate-file)
119   (global-set-key "\e[200z" 'find-file)
120   (global-set-key "\e[201z" 'kill-region)
121   (global-set-key "\e[-1z" 'info)
122   ;
123   ; Set keybindings for Chiarks' x11emacs
124   (global-set-key "\e[5~" 'scroll-down)
125   (global-set-key "\e[6~" 'scroll-up)
126   ;
127   ; Set keybindings for knackered vt100-like terminal emulators.
128   (global-set-key "\eOt" 'scroll-down)
129   (global-set-key "\eOu" 'scroll-up)
130   (global-set-key "\eOD" 'backward-char)
131   (global-set-key "\eOC" 'forward-char)
132   (global-set-key "\eOA" 'previous-line)
133   (global-set-key "\eOB" 'next-line))
134 (setq term-setup-hook 'terminal-keybindings)     ; remap keys in due course
135 ;
136 (setq frame-title-format
137       '(multiple-frames
138         (:eval 
139          (let*
140              ((buf (current-buffer))
141               (leaf (buffer-name buf))
142               (dir default-directory))
143            (if dir
144                (let*
145                    ((dir (abbreviate-file-name dir))
146                     (node (replace-regexp-in-string "\\..*" "" system-name)))
147                  (concat leaf "  " node ":" dir))
148              leaf)))
149         ("" invocation-name "@" system-name)))
150 ;(setq frame-title-format
151 ;      '(multiple-frames
152 ;       (:eval 
153 ;        (let*
154 ;            ((buf (current-buffer))
155 ;             (fn (buffer-file-name buf)))
156 ;          (if fn
157 ;              (let*
158 ;                  ((fn (abbreviate-file-name fn))
159 ;                   (dir (file-name-directory fn))
160 ;                   (leaf (file-name-nondirectory fn))
161 ;                   (node (replace-regexp-in-string "\\..*" "" system-name)))
162 ;                (concat leaf "  " node ":" dir))
163 ;            (buffer-name buf))))
164 ;       ("" invocation-name "@" system-name)))
165 ;
166 ; Autoload definitions
167 (autoload 'tar-mode "tar-mode")
168 (autoload 'uncompress-while-visiting "uncompress")
169 ; (autoload 'c++-mode "c++-mode" "Mode for editing C and C++ programs" t)
170 (autoload 'hide-ifdef-mode "hideif" "For editing code with #ifdefs" t)
171 (setq-default indent-tabs-mode nil)
172 (autoload 'dired-find-alternate-file "dired-alternate" "Find alternately" t)
173 (autoload 'dired-run-file "dired-alternate" "Run this file" t)
174 (autoload 'perl-mode "perl-mode" "Mode for Perl code" t)
175 ; (autoload 'rmail "rmail-fixed" "Patched mail reader" t)
176 (autoload 'quicker-compile "quicker-compile" "Patched Compile mode" t)
177
178 ;(autoload 'vm "vm" "Start VM on your primary inbox." t)
179 ;(autoload 'vm-visit-folder "vm" "Start VM on an arbitrary folder." t)
180 ;(autoload 'vm-visit-virtual-folder "vm" "Visit a VM virtual folder." t)
181 ;(autoload 'vm-mode "vm" "Run VM major mode on a buffer" t)
182 ;(autoload 'vm-mail "vm" "Send a mail message using VM." t)
183 ;(autoload 'vm-submit-bug-report "vm" "Send a bug report about VM." t)
184 ;
185 ;(require 'vm-autoload)
186 ;
187 ; (autoload 'info "info-fixed" "Patched info browser" t)
188 (setq shell-mode-hook
189       '(lambda ()
190          (make-variable-buffer-local 'scroll-step)
191          (setq scroll-step 1)))
192 ; (setq inferior-lisp-program "kcl")
193 (setq dired-mode-hook
194       '(lambda ()
195          (define-key dired-mode-map "F" 'dired-find-alternate-file)
196          (define-key dired-mode-map "X" 'dired-run-file)))
197 ;
198 ; Prevent loading of default init file and do some of the things it did
199 ; (setq inhibit-default-init t)
200 ;
201 ; Additional alist handling function
202 ;(defun alist-remove-elem (s s-list)
203 ;  "Delete the element of the alist S-LIST whose car is S"
204 ;  (if s-list (if (equal s (car (car s-list)))
205 ;                (cdr s-list)
206 ;              (cons (car s-list) (alist-remove-elem s (cdr s-list))))
207 ;    (nil)))
208 ;
209 ; Load C++ mode and edit Perl in perl mode
210 (setq auto-mode-alist
211       (append '(("\\.[ch]$" . c-mode)
212                 ("\\.[CH]$" . c++-mode)
213                 ("\\.cc$" . c++-mode)
214                 ("\\.hh$" . c++-mode)
215 ;                ("\\.tar$" . tar-mode)
216                 ("\\.pl$" . perl-mode)
217                 ("\\.ci$" . tex-mode)
218                 ("\\.Z$" . uncompress-while-visiting))
219               auto-mode-alist))
220 (setq interpreter-mode-alist
221       (append '(("sh" . fundamental-mode)
222                 ("bash" . fundamental-mode))
223               interpreter-mode-alist))
224 ;
225 ; Use auto-fill when editing text
226 (add-hook 'text-mode-hook '(lambda () (auto-fill-mode 1)))
227 ; (add-hook 'text-mode-hook '(lambda () (local-set-key "        " 'self-insert-command)))
228 ;
229 ; Set up newline to auto-indent & other stuff for perl, c++ and c modes.
230 (setq perl-mode-hook '(lambda () 
231                         (local-set-key ";" 'self-insert-command)))
232 (setq c++-mode-hook '(lambda ()
233                        (hide-ifdef-mode 1)
234                        (local-set-key ":" 'electric-c++-terminator)))
235 ; c++-electric-colon
236 (setq c-mode-hook '(lambda ()
237                      (hide-ifdef-mode 1)
238                      (c-set-offset 'substatement-open 0 nil)
239                      (local-set-key "(" 'self-insert-command)
240                      (local-set-key ")" 'self-insert-command)
241                      (local-set-key ";" 'self-insert-command)
242                      (local-set-key "{" 'self-insert-command)
243                      (local-set-key "\r" 'newline-and-indent)))
244 (setq c-hanging-comment-ender-p nil)
245 ;
246 (defun vm-mail-other-window ()
247   "Like `vm-mail' command, but display buffer in another window."
248   (interactive)
249   (switch-to-buffer-other-window (current-buffer))
250   (vm-mail))
251 ;
252 ; mail precedences
253 (setq mail-precedence-key-alist
254       '((?0  . "special-delivery")
255         (?1  . "air-mail")
256         (?2  . "first-class")
257         (?3  . "second-class")
258         (?5  . "third-class")
259         (?\  . nil)
260         (?6  . "bulk")
261         (?9  . "junk")))
262 ;
263 (defun mail-precedence-as-key ()
264   "Set precedence by looking up last command char in mail-precedence-key-alist"
265   (interactive)
266   (message "%s" (concat "Precedence ["
267                         (mapconcat '(lambda (c) (char-to-string (car c)))
268                                    mail-precedence-key-alist "")
269                         "] ?"))
270   (let* ((key (read-char))
271          (prec (assoc key mail-precedence-key-alist)))
272     (if prec (mail-precedence (cdr prec))
273       (error "mail-precedence-as-key `%s' not found" key))))
274 ;
275 (defun mail-precedence-as-key-send-and-exit (arg)
276   "Set precedence by looking up last command char in mail-precedence-key-alist,
277 then call send-and-exit."
278   (interactive "P")
279   (mail-precedence-as-key)
280   (execute-kbd-macro "\ 3\ 3"))
281 ;
282 (defun mail-precedence (prec)
283   (save-excursion
284     (mail-position-on-field "Precedence")
285     (let ((p (point)))
286       (beginning-of-line)
287       (delete-region (point) p)
288       (if prec
289           (insert "Precedence: " prec)
290         (delete-char 1)))))
291 ;
292 (defun mail-mode-setup-keys ()
293   (local-set-key "\ 3\10" 'mail-precedence-as-key)
294   (local-set-key "\ 3p" 'mail-precedence-as-key-send-and-exit))
295 (add-hook 'mail-mode-hook 'mail-mode-setup-keys)
296 (add-hook 'vm-mail-mode-hook 'mail-mode-setup-keys)
297 ;
298 (defun vm-mail-other-window ()
299   "Like `vm-mail' command, but display buffer in another window."
300   (interactive)
301   (switch-to-buffer-other-window (current-buffer))
302   (vm-mail))
303 ;
304 (defun mail-formletter ()
305   "Run VM-mail with ,Formletter"
306   (interactive)
307   (vm-mail)
308   (rename-buffer (generate-new-buffer-name "form letter") t)
309   (delete-region (point-min) (point-max))
310   (insert-file (concat vm-folder-directory ",Formletter")))
311 ;
312 ; This function bound to C-x C-z
313 (defun load-ange-ftp ()
314   "Load ange-ftp using require, if it isn't loaded already"
315   (interactive)
316   (message "Loading ange-ftp...")
317   (require 'ange-ftp) ; -extended
318   (message "Loading ange-ftp...done"))
319 ;
320 ; This function bound to M-+
321 (defun toggle-truncate-lines ()
322   "Toggle truncation or folding of long lines"
323   (interactive)
324   (set-variable 'truncate-lines (not truncate-lines))
325   (redraw-display))
326 ;
327 ; RMAIL stuff
328 ;(setq rmail-file-name "~/mail/RMAIL"
329 ;      mail-archive-file-name "~/mail/Outbound"
330 ;      rmail-primary-inbox-list '("~/mbox" "~/mail/Outbound" "~/mail/Record"
331 ;                                 "~/mail/Import" "/var/spool/mail/ian")
332 ;      rmail-delete-after-output t
333 ;      rmail-last-rmail-file ""
334 ;      rmail-ignored-headers (concat
335 ;                             "^Content-Identifier:\\|^X400-[^O][A-Za-z-]+:\\|"
336 ;                             rmail-ignored-headers))
337 ;
338 (defun make-regexps-ignore-non-address (list)
339   (apply 'append (mapcar
340                   '(lambda (item)
341                      (let ((item (mapconcat
342                                   '(lambda (ch)
343                                      (let ((s (char-to-string ch)))
344                                        (if (string-match "[][.*+?^$\\]" s)
345                                            (concat "\\" s)
346                                          s)))
347                                   item "")))
348                        (list
349                         (concat "<" item ">")
350                         (concat "^" item " *\\((.*)\\)?$"))))
351                   list)))
352 ;
353 ;
354 (setq mail-signature nil)
355 ;
356 ; BBDB
357 (setq bbdb-north-american-phone-numbers-p nil
358       bbdb/mail-auto-create-p t
359       bbdb-auto-revert-p t
360       bbdb-notice-auto-save-file-p t
361       bbdb-message-caching-enabled t)      
362 ;
363 ; VM stuff
364 (load-file "~/private/private.el")
365 (if (file-exists-p "~/private/private2.el")
366   (load-file "~/private/private2.el"))
367 (setq vm-included-text-attribution-format "%F writes (\"%s\"):\n"
368       vm-reply-subject-prefix "Re: "
369       vm-folder-directory "~/mail/"
370       vm-delete-after-saving t
371       vm-delete-empty-folders t
372       vm-mutable-windows t
373       vm-auto-get-new-mail nil
374       vm-auto-next-message nil
375       vm-jump-to-new-messages nil
376       vm-jump-to-unread-messages nil
377       vm-auto-displayed-mime-content-types '("text" "multipart")
378       vm-mime-digest-discard-header-regexp "only-drop-this-header"
379       vm-preview-lines nil
380       vm-included-text-prefix "> "
381       vm-confirm-quit 1
382       vm-auto-center-summary t
383       vm-confirm-new-folders t
384       vm-circular-folders nil
385       vm-visit-when-saving 0
386       vm-move-after-deleting t
387       vm-keep-sent-messages t
388       vm-follow-summary-cursor t
389       vm-frame-per-composition nil
390       vm-frame-per-edit nil
391       vm-frame-per-summary nil
392       vm-frame-per-folder nil
393       vm-tale-is-an-idiot t
394       vm-primary-inbox (concat vm-folder-directory "INBOX")
395       vm-sinbin-inbox (concat vm-folder-directory "SINBOX")
396       vm-uninteresting-senders "ian"
397       vm-reply-ignored-addresses
398       (make-regexps-ignore-non-address
399        '("ian@chiark.chu.cam.ac.uk" "ian" "iwj10@cus.cam.ac.uk"
400          "ian@chiark.greenend.org.uk"
401          "ijackson@nyx.cs.du.edu" "ijackson@gnu.ai.mit.edu"))
402       vm-primary-inbox (concat vm-folder-directory "INBOX")
403
404       vm-uninteresting-senders "ian"
405       vm-reply-ignored-addresses
406       (make-regexps-ignore-non-address
407        '("ijackson@chiark.chu.cam.ac.uk" "ijackson"
408          "iwj10@thor.cam.ac.uk" "iwj10@hermes.cam.ac.uk" "iwj10@cl.cam.ac.uk"
409          "iwj10@cam.ac.uk" "Ian.Jackson@cl.cam.ac.uk"))
410       mail-archive-file-name "~/mail/Outbound"
411
412
413       vm-spool-files (list
414                       "~/mbox"
415                       "~/mail/Outbound"
416                       "~/mail/Record"
417                       "~/mail/Import"
418                       "~/mail/inbox"
419                       "/var/mail/iwj"
420 ;                      "imap-ssl:mail.citrix.com:993:inbox:login:ianj:*"
421 ;                      (concat "imap-ssl:mail.citrix.com:993:inbox:cram-md5:ianj:*" ijackson-pop-password)
422                       "/u/ijackson/mail/INBOX.CRASH"
423                       "~/News/r")
424       vm-startup-with-summary t
425
426       vm-startup-with-summary nil
427       vm-summary-format "%3n %a %2d %3m  %-19.19F  %s\n"
428       mail-archive-file-name "~/mail/Outbound"
429       vm-mime-8bit-text-transfer-encoding '8bit)
430 ;
431 (add-hook 'vm-mode-hook
432           '(lambda ()
433              (local-set-key "Q" 'vm-quit)
434              (local-set-key "q" "###Q")))
435 ;(add-hook 'mail-mode-hook
436 ;          '(lambda ()
437 ;             (if (and (boundp 'folder-buffer)
438 ;                      folder-buffer
439 ;                      (string= (buffer-file-name folder-buffer)
440 ;                               (file-truename vm-sysadmin-inbox)))
441 ;                 (progn
442 ;                   (make-local-variable 'vm-mail-header-from)
443 ;                   (setq vm-mail-header-from
444 ;                         "sysadmin@chiark.greenend.org.uk (Ian Jackson)")
445 ;                   (make-local-variable 'mail-archive-file-name)
446 ;                   (setq mail-archive-file-name
447 ;                         "~/mail/SOutbound")))))
448 ;
449 ;;(defun vmi ()
450 ;  (interactive)
451 ;  (vm "/u/ijackson/mail/INBOX"))
452 ;;
453 ;(defun vms ()
454 ;  (interactive)
455 ;  (vm vm-sinbin-inbox))
456 ;
457 (defun make-session ()
458   "Makes this emacs hard to kill by requiring ^X^Cy to kill it
459 instead of just ^X^C."
460   (interactive)
461   (global-unset-key "\18\ 3")
462   (global-set-key "\18\ 3y" 'save-buffers-kill-emacs))
463 ;
464 ; Fix problems with M-| setting window title of emacs' parent xterm
465 ;(defun envdelete-term-termcap-windowid (list)
466 ;  (let ((l list))
467 ;    (mapcar '(lambda (x)
468 ;               (if x (delq x l)))
469 ;            (mapcar '(lambda (x)
470 ;                       (if (or (string-match "^TERM=" x)
471 ;                               (string-match "^TERMCAP=" x)
472 ;                               (string-match "^WINDOWID=" x))
473 ;                           x
474 ;                         nil))
475 ;                    l))
476 ;    l))
477 ;(setq process-environment
478 ;      (envdelete-term-termcap-windowid process-environment))
479 ;
480 (defun add-insertion-keys (table)
481   "Adds keybindings according to TABLE.  Each element of
482 TABLE should be a four-element list.
483
484 BINDING should be the key to bind; FUNCTION will be the name of the
485 function defined to do the insertion; DESCRIPTION will be inserted
486 into \"Inserts ... .\", and used as the descriptive string for the
487 generated function; STRING is the string which will actually be
488 inserted into the buffer when the keystroke is pressed."
489   (while table
490     (let* ((head (car table))
491            (key (car head))
492            (func (nth 1 head))
493            (desc (nth 2 head))
494            (string (nth 3 head)))
495       (defalias func
496         (list
497          'lambda () 
498          (concat "Inserts " desc ".")
499          '(interactive)
500          (list 'insert string)))
501       (funcall 'local-set-key key func))
502     (setq table (cdr table))))
503
504 (defun ian-sgml-setup ()
505   (interactive)
506   (add-insertion-keys
507    '(("\ 3\r" sgml-insert-new-para "new paragraph markup" "\n<p>\n")
508      ("\ 3\14" sgml-insert-tt-emph "tt emph markup" "<tt/")
509      ("\ 3\10" sgml-insert-prgn-emph "prgn emph markup" "<prgn/")
510      ("\ 3\ 5" sgml-insert-em-emph "em emfh markup" "<em/")
511      ("\ 3\16" sgml-insert-var-empfh "var emph markup" "<var/"))))
512 (setq sgml-local-catalogs '("/jura:/usr/lib/debiandoc-sgml/sgml/catalog"))
513   
514 (add-hook 'sgml-mode-hook 'ian-sgml-setup)
515 ;
516 (defvar cite-string "> " "String to insert when citing")
517 ;
518 (defun cite-region (start end)
519   "Quote each line in the region with an angle-bracket and space.
520
521 The citation string is taken from cite-string."
522   (interactive "r")
523   (save-excursion
524     (save-restriction
525       (narrow-to-region start end)
526       (goto-char (point-min))
527       (insert cite-string)
528       (while
529           (and
530            (= (forward-line) 0)
531            (> (point-max) (point)))
532         (insert cite-string)))))
533 ;
534 (blink-cursor-mode nil)
535 (setq c-basic-offset 4)
536 (setq indent-tabs-mode 4)
537 ;
538 (require 'tramp)
539 (setq tramp-default-proxies-alist
540       (append '(("names\\.colo\\.xensource\\.com"
541                  "root" "/ssh:names.colo.xensource.com:")
542                 ("colo-dns1\\.colo\\.xensource\\.com" "root"
543                  "/ssh:ianj@colo-dns1.colo.xensource.com:"))
544               tramp-default-proxies-alist))
545 ; /sudo:root@names.colo.xensource.com:/etc/bind/xen.org.zone
546 ; /sudo:root@colo-dns1.colo.xensource.com:/etc/bind/xensource.com.zone
547
548
549
550 (defun hack-dir-local-variables ()
551   "Read per-directory local variables for the current buffer.
552 Store the directory-local variables in `dir-local-variables-alist'
553 and `file-local-variables-alist', without applying them."
554   (when (and enable-local-variables
555              (buffer-file-name))
556     ;; Find the variables file.
557     (let ((variables-file (dir-locals-find-file (buffer-file-name)))
558           (class nil)
559           (dir-name nil))
560       (cond
561        ((stringp variables-file)
562         (setq dir-name (file-name-directory (buffer-file-name)))
563         (setq class (dir-locals-read-from-file variables-file)))
564        ((consp variables-file)
565         (setq dir-name (nth 0 variables-file))
566         (setq class (nth 1 variables-file))))
567       (when class
568         (let ((variables
569                (dir-locals-collect-variables
570                 (dir-locals-get-class-variables class) dir-name nil)))
571           (when variables
572             (dolist (elt variables)
573               (unless (memq (car elt) '(eval mode))
574                 (setq dir-local-variables-alist
575                       (assq-delete-all (car elt) dir-local-variables-alist)))
576               (push elt dir-local-variables-alist))
577             (hack-local-variables-filter variables dir-name)))))))
578
579 (delete ".git/" completion-ignored-extensions)
580
581 ; End of this file.