diff options
| author | Stefan Monnier | 2008-04-22 15:36:53 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2008-04-22 15:36:53 +0000 |
| commit | 494858be8a27ef0f6f06ac046edecb9677197843 (patch) | |
| tree | 8f557319b9326a7dcc791dec833b327dbdc03db6 | |
| parent | b0a5a021e3d4552808f3feb5b4273aa113d39df2 (diff) | |
| download | emacs-494858be8a27ef0f6f06ac046edecb9677197843.tar.gz emacs-494858be8a27ef0f6f06ac046edecb9677197843.zip | |
(Info-complete-menu-item): Save point.
| -rw-r--r-- | lisp/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/info.el | 87 |
2 files changed, 48 insertions, 43 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2d3cd250286..983e8db713c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2008-04-22 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * info.el (Info-complete-menu-item): Save point. | ||
| 4 | |||
| 1 | 2008-04-22 Juanma Barranquero <lekktu@gmail.com> | 5 | 2008-04-22 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 6 | ||
| 3 | * minibuffer.el (minibuffer-complete-and-exit): Fix last change. | 7 | * minibuffer.el (minibuffer-complete-and-exit): Fix last change. |
diff --git a/lisp/info.el b/lisp/info.el index 7d305c976ea..259c999d6aa 100644 --- a/lisp/info.el +++ b/lisp/info.el | |||
| @@ -2263,49 +2263,50 @@ Because of ambiguities, this should be concatenated with something like | |||
| 2263 | ;; Note that `Info-complete-menu-buffer' could be current already, | 2263 | ;; Note that `Info-complete-menu-buffer' could be current already, |
| 2264 | ;; so we want to save point. | 2264 | ;; so we want to save point. |
| 2265 | (with-current-buffer Info-complete-menu-buffer | 2265 | (with-current-buffer Info-complete-menu-buffer |
| 2266 | (let ((completion-ignore-case t) | 2266 | (save-excursion |
| 2267 | (case-fold-search t) | 2267 | (let ((completion-ignore-case t) |
| 2268 | (orignode Info-current-node) | 2268 | (case-fold-search t) |
| 2269 | nextnode) | 2269 | (orignode Info-current-node) |
| 2270 | (goto-char (point-min)) | 2270 | nextnode) |
| 2271 | (search-forward "\n* Menu:") | 2271 | (goto-char (point-min)) |
| 2272 | (if (not (memq action '(nil t))) | 2272 | (search-forward "\n* Menu:") |
| 2273 | (re-search-forward | 2273 | (if (not (memq action '(nil t))) |
| 2274 | (concat "\n\\* +" (regexp-quote string) ":") nil t) | 2274 | (re-search-forward |
| 2275 | (let ((pattern (concat "\n\\* +\\(" | 2275 | (concat "\n\\* +" (regexp-quote string) ":") nil t) |
| 2276 | (regexp-quote string) | 2276 | (let ((pattern (concat "\n\\* +\\(" |
| 2277 | Info-menu-entry-name-re "\\):" Info-node-spec-re)) | 2277 | (regexp-quote string) |
| 2278 | completions | 2278 | Info-menu-entry-name-re "\\):" Info-node-spec-re)) |
| 2279 | (complete-nodes Info-complete-nodes)) | 2279 | completions |
| 2280 | ;; Check the cache. | 2280 | (complete-nodes Info-complete-nodes)) |
| 2281 | (if (and (equal (nth 0 Info-complete-cache) Info-current-file) | 2281 | ;; Check the cache. |
| 2282 | (equal (nth 1 Info-complete-cache) Info-current-node) | 2282 | (if (and (equal (nth 0 Info-complete-cache) Info-current-file) |
| 2283 | (equal (nth 2 Info-complete-cache) Info-complete-next-re) | 2283 | (equal (nth 1 Info-complete-cache) Info-current-node) |
| 2284 | (equal (nth 5 Info-complete-cache) Info-complete-nodes) | 2284 | (equal (nth 2 Info-complete-cache) Info-complete-next-re) |
| 2285 | (let ((prev (nth 3 Info-complete-cache))) | 2285 | (equal (nth 5 Info-complete-cache) Info-complete-nodes) |
| 2286 | (eq t (compare-strings string 0 (length prev) | 2286 | (let ((prev (nth 3 Info-complete-cache))) |
| 2287 | prev 0 nil t)))) | 2287 | (eq t (compare-strings string 0 (length prev) |
| 2288 | ;; We can reuse the previous list. | 2288 | prev 0 nil t)))) |
| 2289 | (setq completions (nth 4 Info-complete-cache)) | 2289 | ;; We can reuse the previous list. |
| 2290 | ;; The cache can't be used. | 2290 | (setq completions (nth 4 Info-complete-cache)) |
| 2291 | (while | 2291 | ;; The cache can't be used. |
| 2292 | (progn | 2292 | (while |
| 2293 | (while (re-search-forward pattern nil t) | 2293 | (progn |
| 2294 | (push (match-string-no-properties 1) | 2294 | (while (re-search-forward pattern nil t) |
| 2295 | completions)) | 2295 | (push (match-string-no-properties 1) |
| 2296 | ;; Check subsequent nodes if applicable. | 2296 | completions)) |
| 2297 | (or (and Info-complete-next-re | 2297 | ;; Check subsequent nodes if applicable. |
| 2298 | (setq nextnode (Info-extract-pointer "next" t)) | 2298 | (or (and Info-complete-next-re |
| 2299 | (string-match Info-complete-next-re nextnode)) | 2299 | (setq nextnode (Info-extract-pointer "next" t)) |
| 2300 | (and complete-nodes | 2300 | (string-match Info-complete-next-re nextnode)) |
| 2301 | (setq complete-nodes (cdr complete-nodes) | 2301 | (and complete-nodes |
| 2302 | nextnode (car complete-nodes))))) | 2302 | (setq complete-nodes (cdr complete-nodes) |
| 2303 | (Info-goto-node nextnode)) | 2303 | nextnode (car complete-nodes))))) |
| 2304 | ;; Go back to the start node (for the next completion). | 2304 | (Info-goto-node nextnode)) |
| 2305 | (unless (equal Info-current-node orignode) | 2305 | ;; Go back to the start node (for the next completion). |
| 2306 | (Info-goto-node orignode)) | 2306 | (unless (equal Info-current-node orignode) |
| 2307 | ;; Update the cache. | 2307 | (Info-goto-node orignode)) |
| 2308 | (set (make-local-variable 'Info-complete-cache) | 2308 | ;; Update the cache. |
| 2309 | (set (make-local-variable 'Info-complete-cache) | ||
| 2309 | (list Info-current-file Info-current-node | 2310 | (list Info-current-file Info-current-node |
| 2310 | Info-complete-next-re string completions | 2311 | Info-complete-next-re string completions |
| 2311 | Info-complete-nodes))) | 2312 | Info-complete-nodes))) |