[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r103309: More dired-x cleanup.
From: |
Glenn Morris |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r103309: More dired-x cleanup. |
Date: |
Wed, 16 Feb 2011 20:50:47 -0800 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 103309
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Wed 2011-02-16 20:50:47 -0800
message:
More dired-x cleanup.
* lisp/dired-x.el (dired-clean-up-after-deletion):
kill-buffer does not need save-excursion.
(dired-do-run-mail): Doc fix.
(dired-filename-at-point): Doc fix.
Use looking-at, and skip-chars rather than re search.
(skip-chars were used prior to CVS rev 1.47, and are ok to use again
since Emacs 22.1, because char-classes are supported.)
modified:
lisp/ChangeLog
lisp/dired-x.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2011-02-17 04:38:23 +0000
+++ b/lisp/ChangeLog 2011-02-17 04:50:47 +0000
@@ -1,5 +1,11 @@
2011-02-17 Glenn Morris <address@hidden>
+ * dired-x.el (dired-clean-up-after-deletion):
+ kill-buffer does not need save-excursion.
+ (dired-do-run-mail): Doc fix.
+ (dired-filename-at-point): Doc fix.
+ Use looking-at, and skip-chars rather than re search.
+
* dired-x.el (dired-filename-at-point): Fix 8-year old typo.
2011-02-16 Ken Manheimer <address@hidden>
=== modified file 'lisp/dired-x.el'
--- a/lisp/dired-x.el 2011-02-17 04:38:23 +0000
+++ b/lisp/dired-x.el 2011-02-17 04:50:47 +0000
@@ -319,7 +319,6 @@
`dired-info'
`dired-do-find-marked-files'"
(interactive)
-
;; These must be done in each new dired buffer.
(dired-hack-local-variables)
(dired-omit-startup))
@@ -341,17 +340,14 @@
(funcall (function y-or-n-p)
(format "Kill buffer of %s, too? "
(file-name-nondirectory fn)))
- (save-excursion ; you never know where kill-buffer leaves you
- (kill-buffer buf))))
+ (kill-buffer buf)))
(let ((buf-list (dired-buffers-for-dir (expand-file-name fn))))
(and buf-list
(y-or-n-p (format "Kill dired buffer%s of %s, too? "
(dired-plural-s (length buf-list))
(file-name-nondirectory fn)))
(dolist (buf buf-list)
- (save-excursion (kill-buffer buf))))))
- ;; Anything else?
- )
+ (kill-buffer buf))))))
;;; EXTENSION MARKING FUNCTIONS.
@@ -1404,7 +1400,7 @@
(rmail (dired-get-filename)))
(defun dired-do-run-mail ()
- "If `dired-bind-vm' is t, then function `dired-vm', otherwise `dired-rmail'."
+ "If `dired-bind-vm' is non-nil, call `dired-vm', else call `dired-rmail'."
(interactive)
(if dired-bind-vm
;; Read mail folder using vm.
@@ -1655,38 +1651,32 @@
;; Fixme: This should probably use `thing-at-point'. -- fx
(defun dired-filename-at-point ()
- "Get the filename closest to point, but do not change position.
-Has a preference for looking backward when not directly on a symbol.
-Not perfect - point must be in middle of or end of filename."
-
+ "Return the filename closest to point, expanded.
+Point should be in or after a filename."
(let ((filename-chars "-.[:alnum:]_/:$+@")
start end filename prefix)
-
(save-excursion
;; First see if just past a filename.
- (or (eobp)
+ (or (eobp) ; why?
(when (looking-at "[] \t\n[{}()]") ; whitespace or some parens
(skip-chars-backward " \n\t\r({[]})")
(or (bobp) (backward-char 1))))
- (if (string-match (concat "[" filename-chars "]")
- (char-to-string (following-char)))
+ (if (looking-at (format "[%s]" filename-chars))
(progn
- (if (re-search-backward (concat "[^" filename-chars "]") nil t)
- (forward-char)
- (goto-char (point-min)))
- (setq start (point))
- (setq prefix
+ (skip-chars-backward filename-chars)
+ (setq start (point)
+ prefix
+ ;; This is something to do with ange-ftp filenames.
+ ;; It convert address@hidden to /address@hidden
+ ;; But when does the former occur in dired buffers?
(and (string-match
"^\\w+@"
(buffer-substring start (line-end-position)))
"/"))
- (goto-char start)
(if (string-match "[/~]" (char-to-string (preceding-char)))
(setq start (1- start)))
- (re-search-forward (concat "\\=[" filename-chars "]*") nil t))
-
+ (skip-chars-forward filename-chars))
(error "No file found around point!"))
-
;; Return string.
(expand-file-name (concat prefix (buffer-substring start (point)))))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r103309: More dired-x cleanup.,
Glenn Morris <=