diff options
| author | Andreas Schwab | 2008-06-29 08:10:56 +0000 |
|---|---|---|
| committer | Andreas Schwab | 2008-06-29 08:10:56 +0000 |
| commit | 2cd119e329ebe1a50caeea3163021ead3ebbe7b0 (patch) | |
| tree | e4c157193a848101841a0fab399fb1560fe924bd | |
| parent | 2cefb8a7ffd8ce823c651fa11c275bba91880d45 (diff) | |
| download | emacs-2cd119e329ebe1a50caeea3163021ead3ebbe7b0.tar.gz emacs-2cd119e329ebe1a50caeea3163021ead3ebbe7b0.zip | |
(find-dired-filter): Preserve point.
| -rw-r--r-- | lisp/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/find-dired.el | 83 |
2 files changed, 46 insertions, 41 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3d35061a06d..0d6fcd65e59 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2008-06-29 Andreas Schwab <schwab@suse.de> | ||
| 2 | |||
| 3 | * find-dired.el (find-dired-filter): Preserve point. | ||
| 4 | |||
| 1 | 2008-06-28 Juanma Barranquero <lekktu@gmail.com> | 5 | 2008-06-28 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 6 | ||
| 3 | * net/sasl.el (sasl-client-set-property, sasl-make-mechanism) | 7 | * net/sasl.el (sasl-client-set-property, sasl-make-mechanism) |
diff --git a/lisp/find-dired.el b/lisp/find-dired.el index 0537b6a5f84..0e4ba8f7436 100644 --- a/lisp/find-dired.el +++ b/lisp/find-dired.el | |||
| @@ -240,48 +240,49 @@ Thus ARG can also contain additional grep options." | |||
| 240 | (inhibit-read-only t)) | 240 | (inhibit-read-only t)) |
| 241 | (if (buffer-name buf) | 241 | (if (buffer-name buf) |
| 242 | (with-current-buffer buf | 242 | (with-current-buffer buf |
| 243 | (save-restriction | 243 | (save-excursion |
| 244 | (widen) | 244 | (save-restriction |
| 245 | (let ((buffer-read-only nil) | 245 | (widen) |
| 246 | (beg (point-max)) | 246 | (let ((buffer-read-only nil) |
| 247 | (l-opt (and (consp find-ls-option) | 247 | (beg (point-max)) |
| 248 | (string-match "l" (cdr find-ls-option)))) | 248 | (l-opt (and (consp find-ls-option) |
| 249 | (ls-regexp (concat "^ +[^ \t\r\n]+\\( +[^ \t\r\n]+\\) +" | 249 | (string-match "l" (cdr find-ls-option)))) |
| 250 | "[^ \t\r\n]+ +[^ \t\r\n]+\\( +[0-9]+\\)"))) | 250 | (ls-regexp (concat "^ +[^ \t\r\n]+\\( +[^ \t\r\n]+\\) +" |
| 251 | (goto-char beg) | 251 | "[^ \t\r\n]+ +[^ \t\r\n]+\\( +[0-9]+\\)"))) |
| 252 | (insert string) | ||
| 253 | (goto-char beg) | ||
| 254 | (or (looking-at "^") | ||
| 255 | (forward-line 1)) | ||
| 256 | (while (looking-at "^") | ||
| 257 | (insert " ") | ||
| 258 | (forward-line 1)) | ||
| 259 | ;; Convert ` ./FILE' to ` FILE' | ||
| 260 | ;; This would lose if the current chunk of output | ||
| 261 | ;; starts or ends within the ` ./', so back up a bit: | ||
| 262 | (goto-char (- beg 3)) ; no error if < 0 | ||
| 263 | (while (search-forward " ./" nil t) | ||
| 264 | (delete-region (point) (- (point) 2))) | ||
| 265 | ;; Pad the number of links and file size. This is a | ||
| 266 | ;; quick and dirty way of getting the columns to line up | ||
| 267 | ;; most of the time, but it's not foolproof. | ||
| 268 | (when l-opt | ||
| 269 | (goto-char beg) | 252 | (goto-char beg) |
| 270 | (goto-char (line-beginning-position)) | 253 | (insert string) |
| 271 | (while (re-search-forward ls-regexp nil t) | 254 | (goto-char beg) |
| 272 | (replace-match (format "%4s" (match-string 1)) | 255 | (or (looking-at "^") |
| 273 | nil nil nil 1) | 256 | (forward-line 1)) |
| 274 | (replace-match (format "%9s" (match-string 2)) | 257 | (while (looking-at "^") |
| 275 | nil nil nil 2) | 258 | (insert " ") |
| 276 | (forward-line 1))) | 259 | (forward-line 1)) |
| 277 | ;; Find all the complete lines in the unprocessed | 260 | ;; Convert ` ./FILE' to ` FILE' |
| 278 | ;; output and process it to add text properties. | 261 | ;; This would lose if the current chunk of output |
| 279 | (goto-char (point-max)) | 262 | ;; starts or ends within the ` ./', so back up a bit: |
| 280 | (if (search-backward "\n" (process-mark proc) t) | 263 | (goto-char (- beg 3)) ; no error if < 0 |
| 281 | (progn | 264 | (while (search-forward " ./" nil t) |
| 282 | (dired-insert-set-properties (process-mark proc) | 265 | (delete-region (point) (- (point) 2))) |
| 283 | (1+ (point))) | 266 | ;; Pad the number of links and file size. This is a |
| 284 | (move-marker (process-mark proc) (1+ (point)))))))) | 267 | ;; quick and dirty way of getting the columns to line up |
| 268 | ;; most of the time, but it's not foolproof. | ||
| 269 | (when l-opt | ||
| 270 | (goto-char beg) | ||
| 271 | (goto-char (line-beginning-position)) | ||
| 272 | (while (re-search-forward ls-regexp nil t) | ||
| 273 | (replace-match (format "%4s" (match-string 1)) | ||
| 274 | nil nil nil 1) | ||
| 275 | (replace-match (format "%9s" (match-string 2)) | ||
| 276 | nil nil nil 2) | ||
| 277 | (forward-line 1))) | ||
| 278 | ;; Find all the complete lines in the unprocessed | ||
| 279 | ;; output and process it to add text properties. | ||
| 280 | (goto-char (point-max)) | ||
| 281 | (if (search-backward "\n" (process-mark proc) t) | ||
| 282 | (progn | ||
| 283 | (dired-insert-set-properties (process-mark proc) | ||
| 284 | (1+ (point))) | ||
| 285 | (move-marker (process-mark proc) (1+ (point))))))))) | ||
| 285 | ;; The buffer has been killed. | 286 | ;; The buffer has been killed. |
| 286 | (delete-process proc)))) | 287 | (delete-process proc)))) |
| 287 | 288 | ||