aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Paul Wallington2004-10-23 10:11:17 +0000
committerJohn Paul Wallington2004-10-23 10:11:17 +0000
commit33a584e6d6d2f7fc2b1ea35bced5ea625d043a39 (patch)
treef06583ffa6cd2fab4ed06936d8e8b8f89a34189d
parentd0ee2ed32e696fa020bc1eb16f42d3c09e6f8bbd (diff)
downloademacs-33a584e6d6d2f7fc2b1ea35bced5ea625d043a39.tar.gz
emacs-33a584e6d6d2f7fc2b1ea35bced5ea625d043a39.zip
(ibuffer-jump-to-buffer): Read buffer name in interactive spec rather
than use `interactive-p' in body of function.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/ibuf-ext.el92
2 files changed, 51 insertions, 47 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index a57b30a6eea..ee96dcb1516 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12004-10-23 John Paul Wallington <jpw@gnu.org>
2
3 * ibuf-ext.el (ibuffer-jump-to-buffer): Read buffer name in
4 interactive spec rather than use `interactive-p' in body of
5 function.
6
12004-10-22 Kenichi Handa <handa@m17n.org> 72004-10-22 Kenichi Handa <handa@m17n.org>
2 8
3 * international/mule.el (translate-region): Implement it in Lisp 9 * international/mule.el (translate-region): Implement it in Lisp
diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el
index 5d24964362a..1c77e409ae4 100644
--- a/lisp/ibuf-ext.el
+++ b/lisp/ibuf-ext.el
@@ -1237,53 +1237,51 @@ hidden group filter, open it.
1237If `ibuffer-jump-offer-only-visible-buffers' is non-nil, only offer 1237If `ibuffer-jump-offer-only-visible-buffers' is non-nil, only offer
1238visible buffers in the completion list. Calling the command with 1238visible buffers in the completion list. Calling the command with
1239a prefix argument reverses the meaning of that variable." 1239a prefix argument reverses the meaning of that variable."
1240 (interactive (list nil)) 1240 (interactive (list
1241 (let ((only-visible ibuffer-jump-offer-only-visible-buffers)) 1241 (let ((only-visible ibuffer-jump-offer-only-visible-buffers))
1242 (when current-prefix-arg 1242 (when current-prefix-arg
1243 (setq only-visible (not only-visible))) 1243 (setq only-visible (not only-visible)))
1244 (if only-visible 1244 (if only-visible
1245 (let ((table (mapcar #'(lambda (x) 1245 (let ((table (mapcar #'(lambda (x)
1246 (buffer-name (car x))) 1246 (buffer-name (car x)))
1247 (ibuffer-current-state-list)))) 1247 (ibuffer-current-state-list))))
1248 (when (null table) 1248 (when (null table)
1249 (error "No buffers!")) 1249 (error "No buffers!"))
1250 (when (interactive-p) 1250 (completing-read "Jump to buffer: "
1251 (setq name (completing-read "Jump to buffer: " 1251 table nil t))
1252 table nil t)))) 1252 (read-buffer "Jump to buffer: " nil t)))))
1253 (when (interactive-p) 1253 (when (not (string= "" name))
1254 (setq name (read-buffer "Jump to buffer: " nil t)))) 1254 (let (buf-point)
1255 (when (not (string= "" name)) 1255 ;; Blindly search for our buffer: it is very likely that it is
1256 (let (buf-point) 1256 ;; not in a hidden filter group.
1257 ;; Blindly search for our buffer: it is very likely that it is 1257 (ibuffer-map-lines #'(lambda (buf marks)
1258 ;; not in a hidden filter group. 1258 (when (string= (buffer-name buf) name)
1259 (ibuffer-map-lines #'(lambda (buf marks) 1259 (setq buf-point (point))
1260 (when (string= (buffer-name buf) name) 1260 nil))
1261 (setq buf-point (point)) 1261 t nil)
1262 nil)) 1262 (when (and
1263 t nil) 1263 (null buf-point)
1264 (when (and 1264 (not (null ibuffer-hidden-filter-groups)))
1265 (null buf-point) 1265 ;; We did not find our buffer. It must be in a hidden filter
1266 (not (null ibuffer-hidden-filter-groups))) 1266 ;; group, so go through all hidden filter groups to find it.
1267 ;; We did not find our buffer. It must be in a hidden filter 1267 (catch 'found
1268 ;; group, so go through all hidden filter groups to find it. 1268 (dolist (group ibuffer-hidden-filter-groups)
1269 (catch 'found 1269 (ibuffer-jump-to-filter-group group)
1270 (dolist (group ibuffer-hidden-filter-groups) 1270 (ibuffer-toggle-filter-group)
1271 (ibuffer-jump-to-filter-group group) 1271 (ibuffer-map-lines #'(lambda (buf marks)
1272 (ibuffer-toggle-filter-group) 1272 (when (string= (buffer-name buf) name)
1273 (ibuffer-map-lines #'(lambda (buf marks) 1273 (setq buf-point (point))
1274 (when (string= (buffer-name buf) name) 1274 nil))
1275 (setq buf-point (point)) 1275 t group)
1276 nil)) 1276 (if buf-point
1277 t group) 1277 (throw 'found nil)
1278 (if buf-point 1278 (ibuffer-toggle-filter-group)))))
1279 (throw 'found nil) 1279 (if (null buf-point)
1280 (ibuffer-toggle-filter-group))))) 1280 ;; Still not found even though we expanded all hidden filter
1281 (if (null buf-point) 1281 ;; groups: that must be because it's hidden by predicate:
1282 ;; Still not found even though we expanded all hidden filter 1282 ;; we won't bother trying to display it.
1283 ;; groups: that must be because it's hidden by predicate: 1283 (error "No buffer with name %s" name)
1284 ;; we won't bother trying to display it. 1284 (goto-char buf-point)))))
1285 (error "No buffer with name %s" name)
1286 (goto-char buf-point))))))
1287 1285
1288;;;###autoload 1286;;;###autoload
1289(defun ibuffer-diff-with-file () 1287(defun ibuffer-diff-with-file ()