mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-23 07:19:15 +00:00
(locate-mode): Locally set dired-move-to-filename-regexp,
dired-permission-flags-regexp, and dired-actual-switches. (locate-set-indentation): Function deleted. (locate-insert-header): Don't indent the header line. (locate-indentation-string): Variable deleted. (locate-do-setup): Rewrite the loop that adds indentation.
This commit is contained in:
parent
827dc60de5
commit
5c6a8dfe15
@ -27,22 +27,6 @@
|
|||||||
;; the result.
|
;; the result.
|
||||||
;;
|
;;
|
||||||
|
|
||||||
;; Installation:
|
|
||||||
;;
|
|
||||||
;; Place the following in your .emacs file:
|
|
||||||
;;
|
|
||||||
;; ;; redefines dired-get-filename as a switch function
|
|
||||||
;;
|
|
||||||
;; (require 'advice)
|
|
||||||
;; (defadvice dired-get-filename (around check-mode activate)
|
|
||||||
;; "Use an alternative function in Locate mode"
|
|
||||||
;; (cond ((eq major-mode 'locate-mode)
|
|
||||||
;; (setq ad-return-value (locate-get-filename)))
|
|
||||||
;; (t
|
|
||||||
;; ad-do-it)))
|
|
||||||
;;
|
|
||||||
;; DOS and WINDOWS Users:
|
|
||||||
;;
|
|
||||||
;;;;; Building a database of files ;;;;;;;;;
|
;;;;; Building a database of files ;;;;;;;;;
|
||||||
;;
|
;;
|
||||||
;; You can create a simple files database with a port of the Unix find command
|
;; You can create a simple files database with a port of the Unix find command
|
||||||
@ -236,11 +220,6 @@
|
|||||||
(defconst locate-filename-indentation 4
|
(defconst locate-filename-indentation 4
|
||||||
"The amount of indentation for each file.")
|
"The amount of indentation for each file.")
|
||||||
|
|
||||||
;; 32 is the ASCII code for SPACE character
|
|
||||||
(defconst locate-indentation-string
|
|
||||||
(make-string locate-filename-indentation 32)
|
|
||||||
"The indentation string for each file.")
|
|
||||||
|
|
||||||
(defun locate-get-file-positions ()
|
(defun locate-get-file-positions ()
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(end-of-line)
|
(end-of-line)
|
||||||
@ -285,6 +264,13 @@
|
|||||||
mode-name "Locate"
|
mode-name "Locate"
|
||||||
default-directory "/"
|
default-directory "/"
|
||||||
dired-subdir-alist (list (cons "/" (point-min-marker))))
|
dired-subdir-alist (list (cons "/" (point-min-marker))))
|
||||||
|
(make-local-variable 'dired-move-to-filename-regexp)
|
||||||
|
(setq dired-move-to-filename-regexp
|
||||||
|
(make-string locate-filename-indentation ?\ ))
|
||||||
|
(make-local-variable 'dired-actual-switches)
|
||||||
|
(setq dired-actual-switches "")
|
||||||
|
(make-local-variable 'dired-permission-flags-regexp)
|
||||||
|
(setq dired-permission-flags-regexp "^\\( \\)")
|
||||||
(run-hooks 'locate-mode-hook))
|
(run-hooks 'locate-mode-hook))
|
||||||
|
|
||||||
(defun locate-do-setup ()
|
(defun locate-do-setup ()
|
||||||
@ -304,15 +290,10 @@
|
|||||||
|
|
||||||
(locate-insert-header search-string)
|
(locate-insert-header search-string)
|
||||||
|
|
||||||
(while (progn
|
(while (not (eobp))
|
||||||
(locate-set-indentation)
|
(insert-char ?\ locate-filename-indentation t)
|
||||||
(locate-set-properties)
|
(locate-set-properties)
|
||||||
(zerop (forward-line)))))))
|
(forward-line 1)))))
|
||||||
|
|
||||||
(defun locate-set-indentation ()
|
|
||||||
(save-excursion
|
|
||||||
(beginning-of-line)
|
|
||||||
(insert locate-indentation-string)))
|
|
||||||
|
|
||||||
(defun locate-set-properties ()
|
(defun locate-set-properties ()
|
||||||
(save-excursion
|
(save-excursion
|
||||||
@ -355,8 +336,7 @@
|
|||||||
locate-regexp-match
|
locate-regexp-match
|
||||||
(concat locate-regexp-match ": \n"))
|
(concat locate-regexp-match ": \n"))
|
||||||
|
|
||||||
(insert locate-indentation-string
|
(insert (apply 'format locate-format-string (reverse locate-format-args)))
|
||||||
(apply 'format locate-format-string (reverse locate-format-args)))
|
|
||||||
|
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
|
Loading…
Reference in New Issue
Block a user