diff options
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 45 | ||||
| -rw-r--r-- | lisp/autorevert.el | 14 | ||||
| -rw-r--r-- | lisp/emacs-lisp/advice.el | 141 | ||||
| -rw-r--r-- | lisp/gnus/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/gnus/gnus-registry.el | 5 | ||||
| -rw-r--r-- | lisp/help-fns.el | 75 | ||||
| -rw-r--r-- | lisp/loadup.el | 2 | ||||
| -rw-r--r-- | lisp/minibuffer.el | 86 | ||||
| -rw-r--r-- | lisp/net/tramp-sh.el | 23 | ||||
| -rw-r--r-- | lisp/net/tramp-smb.el | 2 | ||||
| -rw-r--r-- | lisp/progmodes/gud.el | 82 |
11 files changed, 237 insertions, 242 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5f04d5a2f11..9b162f94a6d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,50 @@ | |||
| 1 | 2011-04-15 Juanma Barranquero <lekktu@gmail.com> | ||
| 2 | |||
| 3 | * loadup.el: Use `string-to-number', not `string-to-int'. | ||
| 4 | |||
| 5 | 2011-04-15 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 6 | |||
| 7 | * progmodes/gud.el (gud-gdb): Use completion-at-point instead of | ||
| 8 | gud-gdb-complete-command. | ||
| 9 | (gud-gdb-completions): New function, from gud-gdb-complete-command. | ||
| 10 | (gud-gdb-completion-at-point): New function. | ||
| 11 | (gud-gdb-completions): Remove. | ||
| 12 | |||
| 13 | 2011-04-14 Michael Albinus <michael.albinus@gmx.de> | ||
| 14 | |||
| 15 | * net/tramp-sh.el (tramp-sh-handle-file-attributes): Handle the case | ||
| 16 | when the scripts fail. Use `tramp-do-file-attributes-with-ls' then. | ||
| 17 | (tramp-do-copy-or-rename-file-out-of-band): Do not check any longer | ||
| 18 | whether `executable-find' is bound. | ||
| 19 | |||
| 20 | * net/tramp-smb.el (tramp-smb-handle-copy-file): Fix docstring. | ||
| 21 | |||
| 22 | 2011-04-14 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 23 | |||
| 24 | * minibuffer.el (completion-in-region-mode-predicate) | ||
| 25 | (completion-in-region-mode--predicate): New vars. | ||
| 26 | (completion-in-region, completion-in-region--postch) | ||
| 27 | (completion-in-region-mode): Use them. | ||
| 28 | (completion--capf-wrapper): Also return the hook function. | ||
| 29 | (completion-at-point, completion-help-at-point): | ||
| 30 | Adjust and provide a predicate. | ||
| 31 | |||
| 32 | Preserve arg names for advice of subr and lexical functions (bug#8457). | ||
| 33 | * help-fns.el (help-function-arglist): Consolidate the subr and | ||
| 34 | new-byte-code cases. Add argument `preserve-names' to extract names | ||
| 35 | from the docstring when needed. | ||
| 36 | * emacs-lisp/advice.el (ad-define-subr-args, ad-undefine-subr-args) | ||
| 37 | (ad-subr-args-defined-p, ad-get-subr-args, ad-subr-arglist): Remove. | ||
| 38 | (ad-arglist): Use help-function-arglist's new arg. | ||
| 39 | (ad-definition-type): Use cond. | ||
| 40 | |||
| 1 | 2011-04-13 Juanma Barranquero <lekktu@gmail.com> | 41 | 2011-04-13 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 42 | ||
| 43 | * autorevert.el (auto-revert-handler): | ||
| 44 | Bind `remote-file-name-inhibit-cache', not `tramp-cache-inhibit-cache', | ||
| 45 | which was removed in 2010-10-02T13:21:43Z!michael.albinus@gmx.de. | ||
| 46 | Don't quote lambda. | ||
| 47 | |||
| 3 | * image-mode.el (image-transform-set-scale): | 48 | * image-mode.el (image-transform-set-scale): |
| 4 | Fix change in 2011-04-09T20:28:01Z!cyd@stupidchicken.com. | 49 | Fix change in 2011-04-09T20:28:01Z!cyd@stupidchicken.com. |
| 5 | 50 | ||
diff --git a/lisp/autorevert.el b/lisp/autorevert.el index 2bc7310d7e5..c67b6663bd0 100644 --- a/lisp/autorevert.el +++ b/lisp/autorevert.el | |||
| @@ -434,9 +434,9 @@ This is an internal function used by Auto-Revert Mode." | |||
| 434 | (file-readable-p buffer-file-name) | 434 | (file-readable-p buffer-file-name) |
| 435 | (if auto-revert-tail-mode | 435 | (if auto-revert-tail-mode |
| 436 | ;; Tramp caches the file attributes. Setting | 436 | ;; Tramp caches the file attributes. Setting |
| 437 | ;; `tramp-cache-inhibit' forces Tramp to | 437 | ;; `remote-file-name-inhibit-cache' forces Tramp |
| 438 | ;; reread the values. | 438 | ;; to reread the values. |
| 439 | (let ((tramp-cache-inhibit-cache t)) | 439 | (let ((remote-file-name-inhibit-cache t)) |
| 440 | (/= auto-revert-tail-pos | 440 | (/= auto-revert-tail-pos |
| 441 | (setq size | 441 | (setq size |
| 442 | (nth 7 (file-attributes | 442 | (nth 7 (file-attributes |
| @@ -460,10 +460,10 @@ This is an internal function used by Auto-Revert Mode." | |||
| 460 | (when buffer-file-name | 460 | (when buffer-file-name |
| 461 | (setq eob (eobp)) | 461 | (setq eob (eobp)) |
| 462 | (walk-windows | 462 | (walk-windows |
| 463 | #'(lambda (window) | 463 | (lambda (window) |
| 464 | (and (eq (window-buffer window) buffer) | 464 | (and (eq (window-buffer window) buffer) |
| 465 | (= (window-point window) (point-max)) | 465 | (= (window-point window) (point-max)) |
| 466 | (push window eoblist))) | 466 | (push window eoblist))) |
| 467 | 'no-mini t)) | 467 | 'no-mini t)) |
| 468 | (if auto-revert-tail-mode | 468 | (if auto-revert-tail-mode |
| 469 | (auto-revert-tail-handler size) | 469 | (auto-revert-tail-handler size) |
diff --git a/lisp/emacs-lisp/advice.el b/lisp/emacs-lisp/advice.el index 39ea97aa98e..5934975e36a 100644 --- a/lisp/emacs-lisp/advice.el +++ b/lisp/emacs-lisp/advice.el | |||
| @@ -503,36 +503,6 @@ | |||
| 503 | ;; exact structure of the original argument list as long as the new argument | 503 | ;; exact structure of the original argument list as long as the new argument |
| 504 | ;; list takes a compatible number/magnitude of actual arguments. | 504 | ;; list takes a compatible number/magnitude of actual arguments. |
| 505 | 505 | ||
| 506 | ;; @@@ Definition of subr argument lists: | ||
| 507 | ;; ====================================== | ||
| 508 | ;; When advice constructs the advised definition of a function it has to | ||
| 509 | ;; know the argument list of the original function. For functions and macros | ||
| 510 | ;; the argument list can be determined from the actual definition, however, | ||
| 511 | ;; for subrs there is no such direct access available. In Lemacs and for some | ||
| 512 | ;; subrs in Emacs-19 the argument list of a subr can be determined from | ||
| 513 | ;; its documentation string, in a v18 Emacs even that is not possible. If | ||
| 514 | ;; advice cannot at all determine the argument list of a subr it uses | ||
| 515 | ;; `(&rest ad-subr-args)' which will always work but is inefficient because | ||
| 516 | ;; it conses up arguments. The macro `ad-define-subr-args' can be used by | ||
| 517 | ;; the advice programmer to explicitly tell advice about the argument list | ||
| 518 | ;; of a certain subr, for example, | ||
| 519 | ;; | ||
| 520 | ;; (ad-define-subr-args 'fset '(sym newdef)) | ||
| 521 | ;; | ||
| 522 | ;; is used by advice itself to tell a v18 Emacs about the arguments of `fset'. | ||
| 523 | ;; The following can be used to undo such a definition: | ||
| 524 | ;; | ||
| 525 | ;; (ad-undefine-subr-args 'fset) | ||
| 526 | ;; | ||
| 527 | ;; The argument list definition is stored on the property list of the subr | ||
| 528 | ;; name symbol. When an argument list could be determined from the | ||
| 529 | ;; documentation string it will be cached under that property. The general | ||
| 530 | ;; mechanism for looking up the argument list of a subr is the following: | ||
| 531 | ;; 1) look for a definition stored on the property list | ||
| 532 | ;; 2) if that failed try to infer it from the documentation string and | ||
| 533 | ;; if successful cache it on the property list | ||
| 534 | ;; 3) otherwise use `(&rest ad-subr-args)' | ||
| 535 | |||
| 536 | ;; @@ Activation and deactivation: | 506 | ;; @@ Activation and deactivation: |
| 537 | ;; =============================== | 507 | ;; =============================== |
| 538 | ;; The definition of an advised function does not change until all its advice | 508 | ;; The definition of an advised function does not change until all its advice |
| @@ -1654,41 +1624,6 @@ | |||
| 1654 | ;; (fii 3 2) | 1624 | ;; (fii 3 2) |
| 1655 | ;; 5 | 1625 | ;; 5 |
| 1656 | ;; | 1626 | ;; |
| 1657 | ;; @@ Specifying argument lists of subrs: | ||
| 1658 | ;; ====================================== | ||
| 1659 | ;; The argument lists of subrs cannot be determined directly from Lisp. | ||
| 1660 | ;; This means that Advice has to use `(&rest ad-subr-args)' as the | ||
| 1661 | ;; argument list of the advised subr which is not very efficient. In Lemacs | ||
| 1662 | ;; subr argument lists can be determined from their documentation string, in | ||
| 1663 | ;; Emacs-19 this is the case for some but not all subrs. To accommodate | ||
| 1664 | ;; for the cases where the argument lists cannot be determined (e.g., in a | ||
| 1665 | ;; v18 Emacs) Advice comes with a specification mechanism that allows the | ||
| 1666 | ;; advice programmer to tell advice what the argument list of a certain subr | ||
| 1667 | ;; really is. | ||
| 1668 | ;; | ||
| 1669 | ;; In a v18 Emacs the following will return the &rest idiom: | ||
| 1670 | ;; | ||
| 1671 | ;; (ad-arglist (symbol-function 'car)) | ||
| 1672 | ;; (&rest ad-subr-args) | ||
| 1673 | ;; | ||
| 1674 | ;; To tell advice what the argument list of `car' really is we | ||
| 1675 | ;; can do the following: | ||
| 1676 | ;; | ||
| 1677 | ;; (ad-define-subr-args 'car '(list)) | ||
| 1678 | ;; ((list)) | ||
| 1679 | ;; | ||
| 1680 | ;; Now `ad-arglist' will return the proper argument list (this method is | ||
| 1681 | ;; actually used by advice itself for the advised definition of `fset'): | ||
| 1682 | ;; | ||
| 1683 | ;; (ad-arglist (symbol-function 'car)) | ||
| 1684 | ;; (list) | ||
| 1685 | ;; | ||
| 1686 | ;; The defined argument list will be stored on the property list of the | ||
| 1687 | ;; subr name symbol. When advice looks for a subr argument list it first | ||
| 1688 | ;; checks for a definition on the property list, if that fails it tries | ||
| 1689 | ;; to infer it from the documentation string and caches it on the property | ||
| 1690 | ;; list if it was successful, otherwise `(&rest ad-subr-args)' will be used. | ||
| 1691 | ;; | ||
| 1692 | ;; @@ Advising interactive subrs: | 1627 | ;; @@ Advising interactive subrs: |
| 1693 | ;; ============================== | 1628 | ;; ============================== |
| 1694 | ;; For the most part there is no difference between advising functions and | 1629 | ;; For the most part there is no difference between advising functions and |
| @@ -2536,52 +2471,11 @@ See Info node `(elisp)Computed Advice' for detailed documentation." | |||
| 2536 | If DEFINITION could be from a subr then its NAME should be | 2471 | If DEFINITION could be from a subr then its NAME should be |
| 2537 | supplied to make subr arglist lookup more efficient." | 2472 | supplied to make subr arglist lookup more efficient." |
| 2538 | (require 'help-fns) | 2473 | (require 'help-fns) |
| 2539 | (cond | 2474 | (help-function-arglist |
| 2540 | ((or (ad-macro-p definition) (ad-advice-p definition)) | 2475 | (if (or (ad-macro-p definition) (ad-advice-p definition)) |
| 2541 | (help-function-arglist (cdr definition))) | 2476 | (cdr definition) |
| 2542 | (t (help-function-arglist definition)))) | 2477 | definition) |
| 2543 | 2478 | 'preserve-names)) | |
| 2544 | ;; Store subr-args as `((arg1 arg2 ...))' so I can distinguish | ||
| 2545 | ;; a defined empty arglist `(nil)' from an undefined arglist: | ||
| 2546 | (defmacro ad-define-subr-args (subr arglist) | ||
| 2547 | `(put ,subr 'ad-subr-arglist (list ,arglist))) | ||
| 2548 | (defmacro ad-undefine-subr-args (subr) | ||
| 2549 | `(put ,subr 'ad-subr-arglist nil)) | ||
| 2550 | (defmacro ad-subr-args-defined-p (subr) | ||
| 2551 | `(get ,subr 'ad-subr-arglist)) | ||
| 2552 | (defmacro ad-get-subr-args (subr) | ||
| 2553 | `(car (get ,subr 'ad-subr-arglist))) | ||
| 2554 | |||
| 2555 | (defun ad-subr-arglist (subr-name) | ||
| 2556 | "Retrieve arglist of the subr with SUBR-NAME. | ||
| 2557 | Either use the one stored under the `ad-subr-arglist' property, | ||
| 2558 | or try to retrieve it from the docstring and cache it under | ||
| 2559 | that property, or otherwise use `(&rest ad-subr-args)'." | ||
| 2560 | (if (ad-subr-args-defined-p subr-name) | ||
| 2561 | (ad-get-subr-args subr-name) | ||
| 2562 | ;; says jwz: Should use this for Lemacs 19.8 and above: | ||
| 2563 | ;;((fboundp 'subr-min-args) | ||
| 2564 | ;; ...) | ||
| 2565 | ;; says hans: I guess what Jamie means is that I should use the values | ||
| 2566 | ;; of `subr-min-args' and `subr-max-args' to construct the subr arglist | ||
| 2567 | ;; without having to look it up via parsing the docstring, e.g., | ||
| 2568 | ;; values 1 and 2 would suggest `(arg1 &optional arg2)' as an | ||
| 2569 | ;; argument list. However, that won't work because there is no | ||
| 2570 | ;; way to distinguish a subr with args `(a &optional b &rest c)' from | ||
| 2571 | ;; one with args `(a &rest c)' using that mechanism. Also, the argument | ||
| 2572 | ;; names from the docstring are more meaningful. Hence, I'll stick with | ||
| 2573 | ;; the old way of doing things. | ||
| 2574 | (let ((doc (or (ad-real-documentation subr-name t) ""))) | ||
| 2575 | (if (not (string-match "\n\n\\((.+)\\)\\'" doc)) | ||
| 2576 | ;; Signalling an error leads to bugs during bootstrapping because | ||
| 2577 | ;; the DOC file is not yet built (which is an error, BTW). | ||
| 2578 | ;; (error "The usage info is missing from the subr %s" subr-name) | ||
| 2579 | '(&rest ad-subr-args) | ||
| 2580 | (ad-define-subr-args | ||
| 2581 | subr-name | ||
| 2582 | (cdr (car (read-from-string | ||
| 2583 | (downcase (match-string 1 doc)))))) | ||
| 2584 | (ad-get-subr-args subr-name))))) | ||
| 2585 | 2479 | ||
| 2586 | (defun ad-docstring (definition) | 2480 | (defun ad-docstring (definition) |
| 2587 | "Return the unexpanded docstring of DEFINITION." | 2481 | "Return the unexpanded docstring of DEFINITION." |
| @@ -2629,17 +2523,16 @@ definition (see the code for `documentation')." | |||
| 2629 | 2523 | ||
| 2630 | (defun ad-definition-type (definition) | 2524 | (defun ad-definition-type (definition) |
| 2631 | "Return symbol that describes the type of DEFINITION." | 2525 | "Return symbol that describes the type of DEFINITION." |
| 2632 | (if (ad-macro-p definition) | 2526 | (cond |
| 2633 | 'macro | 2527 | ((ad-macro-p definition) 'macro) |
| 2634 | (if (ad-subr-p definition) | 2528 | ((ad-subr-p definition) |
| 2635 | (if (ad-special-form-p definition) | 2529 | (if (ad-special-form-p definition) |
| 2636 | 'special-form | 2530 | 'special-form |
| 2637 | 'subr) | 2531 | 'subr)) |
| 2638 | (if (or (ad-lambda-p definition) | 2532 | ((or (ad-lambda-p definition) |
| 2639 | (ad-compiled-p definition)) | 2533 | (ad-compiled-p definition)) |
| 2640 | 'function | 2534 | 'function) |
| 2641 | (if (ad-advice-p definition) | 2535 | ((ad-advice-p definition) 'advice))) |
| 2642 | 'advice))))) | ||
| 2643 | 2536 | ||
| 2644 | (defun ad-has-proper-definition (function) | 2537 | (defun ad-has-proper-definition (function) |
| 2645 | "True if FUNCTION is a symbol with a proper definition. | 2538 | "True if FUNCTION is a symbol with a proper definition. |
| @@ -3921,10 +3814,6 @@ undone on exit of this macro." | |||
| 3921 | ;; Use the advice mechanism to advise `documentation' to make it | 3814 | ;; Use the advice mechanism to advise `documentation' to make it |
| 3922 | ;; generate proper documentation strings for advised definitions: | 3815 | ;; generate proper documentation strings for advised definitions: |
| 3923 | 3816 | ||
| 3924 | ;; This makes sure we get the right arglist for `documentation' | ||
| 3925 | ;; during bootstrapping. | ||
| 3926 | (ad-define-subr-args 'documentation '(function &optional raw)) | ||
| 3927 | |||
| 3928 | ;; @@ Starting, stopping and recovering from the advice package magic: | 3817 | ;; @@ Starting, stopping and recovering from the advice package magic: |
| 3929 | ;; =================================================================== | 3818 | ;; =================================================================== |
| 3930 | 3819 | ||
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index fdc50eab274..cc5156610be 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2011-04-14 Teodor Zlatanov <tzz@lifelogs.com> | ||
| 2 | |||
| 3 | * gnus-registry.el: Updated gnus-registry docs. | ||
| 4 | |||
| 1 | 2011-04-12 Teodor Zlatanov <tzz@lifelogs.com> | 5 | 2011-04-12 Teodor Zlatanov <tzz@lifelogs.com> |
| 2 | 6 | ||
| 3 | * gnus-registry.el (gnus-registry--split-fancy-with-parent-internal): | 7 | * gnus-registry.el (gnus-registry--split-fancy-with-parent-internal): |
diff --git a/lisp/gnus/gnus-registry.el b/lisp/gnus/gnus-registry.el index 680a3b294a2..9f95ce756ab 100644 --- a/lisp/gnus/gnus-registry.el +++ b/lisp/gnus/gnus-registry.el | |||
| @@ -33,9 +33,10 @@ | |||
| 33 | ;; you, submit a bug report and I'll be glad to fix it. It needs | 33 | ;; you, submit a bug report and I'll be glad to fix it. It needs |
| 34 | ;; documentation in the manual (also on my to-do list). | 34 | ;; documentation in the manual (also on my to-do list). |
| 35 | 35 | ||
| 36 | ;; Put this in your startup file (~/.gnus.el for instance) | 36 | ;; Put this in your startup file (~/.gnus.el for instance) or use Customize: |
| 37 | 37 | ||
| 38 | ;; (setq gnus-registry-max-entries 2500) | 38 | ;; (setq gnus-registry-max-entries 2500 |
| 39 | ;; gnus-registry-track-extra '(sender subject)) | ||
| 39 | 40 | ||
| 40 | ;; (gnus-registry-initialize) | 41 | ;; (gnus-registry-initialize) |
| 41 | 42 | ||
diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 206a9af3a90..97ce7ca44ef 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el | |||
| @@ -99,46 +99,55 @@ ARGLIST can also be t or a string of the form \"(FUN ARG1 ARG2 ...)\"." | |||
| 99 | (format "%S" (help-make-usage 'fn arglist)))))) | 99 | (format "%S" (help-make-usage 'fn arglist)))))) |
| 100 | 100 | ||
| 101 | ;; FIXME: Move to subr.el? | 101 | ;; FIXME: Move to subr.el? |
| 102 | (defun help-function-arglist (def) | 102 | (defun help-function-arglist (def &optional preserve-names) |
| 103 | "Return a formal argument list for the function DEF. | ||
| 104 | IF PRESERVE-NAMES is non-nil, return a formal arglist that uses | ||
| 105 | the same names as used in the original source code, when possible." | ||
| 103 | ;; Handle symbols aliased to other symbols. | 106 | ;; Handle symbols aliased to other symbols. |
| 104 | (if (and (symbolp def) (fboundp def)) (setq def (indirect-function def))) | 107 | (if (and (symbolp def) (fboundp def)) (setq def (indirect-function def))) |
| 105 | ;; If definition is a macro, find the function inside it. | 108 | ;; If definition is a macro, find the function inside it. |
| 106 | (if (eq (car-safe def) 'macro) (setq def (cdr def))) | 109 | (if (eq (car-safe def) 'macro) (setq def (cdr def))) |
| 107 | (cond | 110 | (cond |
| 108 | ((and (byte-code-function-p def) (integerp (aref def 0))) | 111 | ((and (byte-code-function-p def) (listp (aref def 0))) (aref def 0)) |
| 109 | (let* ((args-desc (aref def 0)) | ||
| 110 | (max (lsh args-desc -8)) | ||
| 111 | (min (logand args-desc 127)) | ||
| 112 | (rest (logand args-desc 128)) | ||
| 113 | (arglist ())) | ||
| 114 | (dotimes (i min) | ||
| 115 | (push (intern (concat "arg" (number-to-string (1+ i)))) arglist)) | ||
| 116 | (when (> max min) | ||
| 117 | (push '&optional arglist) | ||
| 118 | (dotimes (i (- max min)) | ||
| 119 | (push (intern (concat "arg" (number-to-string (+ 1 i min)))) | ||
| 120 | arglist))) | ||
| 121 | (unless (zerop rest) (push '&rest arglist) (push 'rest arglist)) | ||
| 122 | (nreverse arglist))) | ||
| 123 | ((byte-code-function-p def) (aref def 0)) | ||
| 124 | ((eq (car-safe def) 'lambda) (nth 1 def)) | 112 | ((eq (car-safe def) 'lambda) (nth 1 def)) |
| 125 | ((eq (car-safe def) 'closure) (nth 2 def)) | 113 | ((eq (car-safe def) 'closure) (nth 2 def)) |
| 126 | ((subrp def) | 114 | ((or (and (byte-code-function-p def) (integerp (aref def 0))) |
| 127 | (let ((arity (subr-arity def)) | 115 | (subrp def)) |
| 128 | (arglist ())) | 116 | (or (when preserve-names |
| 129 | (dotimes (i (car arity)) | 117 | (let* ((doc (condition-case nil (documentation def) (error nil))) |
| 130 | (push (intern (concat "arg" (number-to-string (1+ i)))) arglist)) | 118 | (docargs (if doc (car (help-split-fundoc doc nil)))) |
| 131 | (cond | 119 | (arglist (if docargs |
| 132 | ((not (numberp (cdr arglist))) | 120 | (cdar (read-from-string (downcase docargs))))) |
| 133 | (push '&rest arglist) | 121 | (valid t)) |
| 134 | (push 'rest arglist)) | 122 | ;; Check validity. |
| 135 | ((< (car arity) (cdr arity)) | 123 | (dolist (arg arglist) |
| 136 | (push '&optional arglist) | 124 | (unless (and (symbolp arg) |
| 137 | (dotimes (i (- (cdr arity) (car arity))) | 125 | (let ((name (symbol-name arg))) |
| 138 | (push (intern (concat "arg" (number-to-string | 126 | (if (eq (aref name 0) ?&) |
| 139 | (+ 1 i (car arity))))) | 127 | (memq arg '(&rest &optional)) |
| 140 | arglist)))) | 128 | (not (string-match "\\." name))))) |
| 141 | (nreverse arglist))) | 129 | (setq valid nil))) |
| 130 | (when valid arglist))) | ||
| 131 | (let* ((args-desc (if (not (subrp def)) | ||
| 132 | (aref def 0) | ||
| 133 | (let ((a (subr-arity def))) | ||
| 134 | (logior (car a) | ||
| 135 | (if (numberp (cdr a)) | ||
| 136 | (lsh (cdr a) 8) | ||
| 137 | (lsh 1 7)))))) | ||
| 138 | (max (lsh args-desc -8)) | ||
| 139 | (min (logand args-desc 127)) | ||
| 140 | (rest (logand args-desc 128)) | ||
| 141 | (arglist ())) | ||
| 142 | (dotimes (i min) | ||
| 143 | (push (intern (concat "arg" (number-to-string (1+ i)))) arglist)) | ||
| 144 | (when (> max min) | ||
| 145 | (push '&optional arglist) | ||
| 146 | (dotimes (i (- max min)) | ||
| 147 | (push (intern (concat "arg" (number-to-string (+ 1 i min)))) | ||
| 148 | arglist))) | ||
| 149 | (unless (zerop rest) (push '&rest arglist) (push 'rest arglist)) | ||
| 150 | (nreverse arglist)))) | ||
| 142 | ((and (eq (car-safe def) 'autoload) (not (eq (nth 4 def) 'keymap))) | 151 | ((and (eq (car-safe def) 'autoload) (not (eq (nth 4 def) 'keymap))) |
| 143 | "[Arg list not available until function definition is loaded.]") | 152 | "[Arg list not available until function definition is loaded.]") |
| 144 | (t t))) | 153 | (t t))) |
diff --git a/lisp/loadup.el b/lisp/loadup.el index 8a11a6e3e06..d348456ae32 100644 --- a/lisp/loadup.el +++ b/lisp/loadup.el | |||
| @@ -263,7 +263,7 @@ | |||
| 263 | (let* ((base (concat "emacs-" emacs-version ".")) | 263 | (let* ((base (concat "emacs-" emacs-version ".")) |
| 264 | (files (file-name-all-completions base default-directory)) | 264 | (files (file-name-all-completions base default-directory)) |
| 265 | (versions (mapcar (function (lambda (name) | 265 | (versions (mapcar (function (lambda (name) |
| 266 | (string-to-int (substring name (length base))))) | 266 | (string-to-number (substring name (length base))))) |
| 267 | files))) | 267 | files))) |
| 268 | ;; `emacs-version' is a constant, so we shouldn't change it with `setq'. | 268 | ;; `emacs-version' is a constant, so we shouldn't change it with `setq'. |
| 269 | (defconst emacs-version | 269 | (defconst emacs-version |
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index d6e11b5a7c5..0d26d6bdcf6 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el | |||
| @@ -58,6 +58,10 @@ | |||
| 58 | 58 | ||
| 59 | ;;; Todo: | 59 | ;;; Todo: |
| 60 | 60 | ||
| 61 | ;; - completion-insert-complete-hook (called after inserting a complete | ||
| 62 | ;; completion), typically used for "complete-abbrev" where it would expand | ||
| 63 | ;; the abbrev. Tho we'd probably want to provide it from the | ||
| 64 | ;; completion-table. | ||
| 61 | ;; - extend `boundaries' to provide various other meta-data about the | 65 | ;; - extend `boundaries' to provide various other meta-data about the |
| 62 | ;; output of `all-completions': | 66 | ;; output of `all-completions': |
| 63 | ;; - preferred sorting order when displayed in *Completions*. | 67 | ;; - preferred sorting order when displayed in *Completions*. |
| @@ -1254,12 +1258,22 @@ and PREDICATE, either by calling NEXT-FUN or by doing it themselves.") | |||
| 1254 | 1258 | ||
| 1255 | (defvar completion-in-region--data nil) | 1259 | (defvar completion-in-region--data nil) |
| 1256 | 1260 | ||
| 1261 | (defvar completion-in-region-mode-predicate nil | ||
| 1262 | "Predicate to tell `completion-in-region-mode' when to exit. | ||
| 1263 | It is called with no argument and should return nil when | ||
| 1264 | `completion-in-region-mode' should exit (and hence pop down | ||
| 1265 | the *Completions* buffer).") | ||
| 1266 | |||
| 1267 | (defvar completion-in-region-mode--predicate nil | ||
| 1268 | "Copy of the value of `completion-in-region-mode-predicate'. | ||
| 1269 | This holds the value `completion-in-region-mode-predicate' had when | ||
| 1270 | we entered `completion-in-region-mode'.") | ||
| 1271 | |||
| 1257 | (defun completion-in-region (start end collection &optional predicate) | 1272 | (defun completion-in-region (start end collection &optional predicate) |
| 1258 | "Complete the text between START and END using COLLECTION. | 1273 | "Complete the text between START and END using COLLECTION. |
| 1259 | Return nil if there is no valid completion, else t. | 1274 | Return nil if there is no valid completion, else t. |
| 1260 | Point needs to be somewhere between START and END." | 1275 | Point needs to be somewhere between START and END." |
| 1261 | (assert (<= start (point)) (<= (point) end)) | 1276 | (assert (<= start (point)) (<= (point) end)) |
| 1262 | ;; FIXME: undisplay the *Completions* buffer once the completion is done. | ||
| 1263 | (with-wrapper-hook | 1277 | (with-wrapper-hook |
| 1264 | ;; FIXME: Maybe we should use this hook to provide a "display | 1278 | ;; FIXME: Maybe we should use this hook to provide a "display |
| 1265 | ;; completions" operation as well. | 1279 | ;; completions" operation as well. |
| @@ -1268,9 +1282,10 @@ Point needs to be somewhere between START and END." | |||
| 1268 | (minibuffer-completion-predicate predicate) | 1282 | (minibuffer-completion-predicate predicate) |
| 1269 | (ol (make-overlay start end nil nil t))) | 1283 | (ol (make-overlay start end nil nil t))) |
| 1270 | (overlay-put ol 'field 'completion) | 1284 | (overlay-put ol 'field 'completion) |
| 1271 | (completion-in-region-mode 1) | 1285 | (when completion-in-region-mode-predicate |
| 1272 | (setq completion-in-region--data | 1286 | (completion-in-region-mode 1) |
| 1273 | (list (current-buffer) start end collection)) | 1287 | (setq completion-in-region--data |
| 1288 | (list (current-buffer) start end collection))) | ||
| 1274 | (unwind-protect | 1289 | (unwind-protect |
| 1275 | (call-interactively 'minibuffer-complete) | 1290 | (call-interactively 'minibuffer-complete) |
| 1276 | (delete-overlay ol))))) | 1291 | (delete-overlay ol))))) |
| @@ -1299,13 +1314,8 @@ Point needs to be somewhere between START and END." | |||
| 1299 | (save-excursion | 1314 | (save-excursion |
| 1300 | (goto-char (nth 2 completion-in-region--data)) | 1315 | (goto-char (nth 2 completion-in-region--data)) |
| 1301 | (line-end-position))) | 1316 | (line-end-position))) |
| 1302 | (let ((comp-data (run-hook-wrapped | 1317 | (when completion-in-region-mode--predicate |
| 1303 | 'completion-at-point-functions | 1318 | (funcall completion-in-region-mode--predicate)))) |
| 1304 | ;; Only use the known-safe functions. | ||
| 1305 | #'completion--capf-wrapper 'safe))) | ||
| 1306 | (eq (car comp-data) | ||
| 1307 | ;; We're still in the same completion field. | ||
| 1308 | (nth 1 completion-in-region--data))))) | ||
| 1309 | (completion-in-region-mode -1))) | 1319 | (completion-in-region-mode -1))) |
| 1310 | 1320 | ||
| 1311 | ;; (defalias 'completion-in-region--prech 'completion-in-region--postch) | 1321 | ;; (defalias 'completion-in-region--prech 'completion-in-region--postch) |
| @@ -1320,9 +1330,12 @@ Point needs to be somewhere between START and END." | |||
| 1320 | (delq (assq 'completion-in-region-mode minor-mode-overriding-map-alist) | 1330 | (delq (assq 'completion-in-region-mode minor-mode-overriding-map-alist) |
| 1321 | minor-mode-overriding-map-alist)) | 1331 | minor-mode-overriding-map-alist)) |
| 1322 | (if (null completion-in-region-mode) | 1332 | (if (null completion-in-region-mode) |
| 1323 | (unless (equal "*Completions*" (buffer-name (window-buffer))) | 1333 | (unless (or (equal "*Completions*" (buffer-name (window-buffer))) |
| 1334 | (null completion-in-region-mode--predicate)) | ||
| 1324 | (minibuffer-hide-completions)) | 1335 | (minibuffer-hide-completions)) |
| 1325 | ;; (add-hook 'pre-command-hook #'completion-in-region--prech) | 1336 | ;; (add-hook 'pre-command-hook #'completion-in-region--prech) |
| 1337 | (set (make-local-variable 'completion-in-region-mode--predicate) | ||
| 1338 | completion-in-region-mode-predicate) | ||
| 1326 | (add-hook 'post-command-hook #'completion-in-region--postch) | 1339 | (add-hook 'post-command-hook #'completion-in-region--postch) |
| 1327 | (push `(completion-in-region-mode . ,completion-in-region-mode-map) | 1340 | (push `(completion-in-region-mode . ,completion-in-region-mode-map) |
| 1328 | minor-mode-overriding-map-alist))) | 1341 | minor-mode-overriding-map-alist))) |
| @@ -1366,7 +1379,7 @@ Currently supported properties are: | |||
| 1366 | (message | 1379 | (message |
| 1367 | "Completion function %S uses a deprecated calling convention" fun) | 1380 | "Completion function %S uses a deprecated calling convention" fun) |
| 1368 | (push fun completion--capf-misbehave-funs)))) | 1381 | (push fun completion--capf-misbehave-funs)))) |
| 1369 | res))) | 1382 | (if res (cons fun res))))) |
| 1370 | 1383 | ||
| 1371 | (defun completion-at-point () | 1384 | (defun completion-at-point () |
| 1372 | "Perform completion on the text around point. | 1385 | "Perform completion on the text around point. |
| @@ -1374,18 +1387,20 @@ The completion method is determined by `completion-at-point-functions'." | |||
| 1374 | (interactive) | 1387 | (interactive) |
| 1375 | (let ((res (run-hook-wrapped 'completion-at-point-functions | 1388 | (let ((res (run-hook-wrapped 'completion-at-point-functions |
| 1376 | #'completion--capf-wrapper 'all))) | 1389 | #'completion--capf-wrapper 'all))) |
| 1377 | (cond | 1390 | (pcase res |
| 1378 | ((functionp res) (funcall res)) | 1391 | (`(,_ . ,(and (pred functionp) f)) (funcall f)) |
| 1379 | ((consp res) | 1392 | (`(,hookfun . (,start ,end ,collection . ,plist)) |
| 1380 | (let* ((plist (nthcdr 3 res)) | 1393 | (let* ((completion-annotate-function |
| 1381 | (start (nth 0 res)) | ||
| 1382 | (end (nth 1 res)) | ||
| 1383 | (completion-annotate-function | ||
| 1384 | (or (plist-get plist :annotation-function) | 1394 | (or (plist-get plist :annotation-function) |
| 1385 | completion-annotate-function))) | 1395 | completion-annotate-function)) |
| 1386 | (completion-in-region start end (nth 2 res) | 1396 | (completion-in-region-mode-predicate |
| 1397 | (lambda () | ||
| 1398 | ;; We're still in the same completion field. | ||
| 1399 | (eq (car (funcall hookfun)) start)))) | ||
| 1400 | (completion-in-region start end collection | ||
| 1387 | (plist-get plist :predicate)))) | 1401 | (plist-get plist :predicate)))) |
| 1388 | (res)))) ;Maybe completion already happened and the function returned t. | 1402 | ;; Maybe completion already happened and the function returned t. |
| 1403 | (_ (cdr res))))) | ||
| 1389 | 1404 | ||
| 1390 | (defun completion-help-at-point () | 1405 | (defun completion-help-at-point () |
| 1391 | "Display the completions on the text around point. | 1406 | "Display the completions on the text around point. |
| @@ -1394,29 +1409,36 @@ The completion method is determined by `completion-at-point-functions'." | |||
| 1394 | (let ((res (run-hook-wrapped 'completion-at-point-functions | 1409 | (let ((res (run-hook-wrapped 'completion-at-point-functions |
| 1395 | ;; Ignore misbehaving functions. | 1410 | ;; Ignore misbehaving functions. |
| 1396 | #'completion--capf-wrapper 'optimist))) | 1411 | #'completion--capf-wrapper 'optimist))) |
| 1397 | (cond | 1412 | (pcase res |
| 1398 | ((functionp res) | 1413 | (`(,_ . ,(and (pred functionp) f)) |
| 1399 | (message "Don't know how to show completions for %S" res)) | 1414 | (message "Don't know how to show completions for %S" f)) |
| 1400 | ((consp res) | 1415 | (`(,hookfun . (,start ,end ,collection . ,plist)) |
| 1401 | (let* ((plist (nthcdr 3 res)) | 1416 | (let* ((minibuffer-completion-table collection) |
| 1402 | (minibuffer-completion-table (nth 2 res)) | ||
| 1403 | (minibuffer-completion-predicate (plist-get plist :predicate)) | 1417 | (minibuffer-completion-predicate (plist-get plist :predicate)) |
| 1404 | (completion-annotate-function | 1418 | (completion-annotate-function |
| 1405 | (or (plist-get plist :annotation-function) | 1419 | (or (plist-get plist :annotation-function) |
| 1406 | completion-annotate-function)) | 1420 | completion-annotate-function)) |
| 1407 | (ol (make-overlay (nth 0 res) (nth 1 res) nil nil t))) | 1421 | (completion-in-region-mode-predicate |
| 1422 | (lambda () | ||
| 1423 | ;; We're still in the same completion field. | ||
| 1424 | (eq (car (funcall hookfun)) start))) | ||
| 1425 | (ol (make-overlay start end nil nil t))) | ||
| 1408 | ;; FIXME: We should somehow (ab)use completion-in-region-function or | 1426 | ;; FIXME: We should somehow (ab)use completion-in-region-function or |
| 1409 | ;; introduce a corresponding hook (plus another for word-completion, | 1427 | ;; introduce a corresponding hook (plus another for word-completion, |
| 1410 | ;; and another for force-completion, maybe?). | 1428 | ;; and another for force-completion, maybe?). |
| 1411 | (overlay-put ol 'field 'completion) | 1429 | (overlay-put ol 'field 'completion) |
| 1430 | (completion-in-region-mode 1) | ||
| 1431 | (setq completion-in-region--data | ||
| 1432 | (list (current-buffer) start end collection)) | ||
| 1412 | (unwind-protect | 1433 | (unwind-protect |
| 1413 | (call-interactively 'minibuffer-completion-help) | 1434 | (call-interactively 'minibuffer-completion-help) |
| 1414 | (delete-overlay ol)))) | 1435 | (delete-overlay ol)))) |
| 1415 | (res | 1436 | (`(,hookfun . ,_) |
| 1416 | ;; The hook function already performed completion :-( | 1437 | ;; The hook function already performed completion :-( |
| 1417 | ;; Not much we can do at this point. | 1438 | ;; Not much we can do at this point. |
| 1439 | (message "%s already performed completion!" hookfun) | ||
| 1418 | nil) | 1440 | nil) |
| 1419 | (t (message "Nothing to complete at point"))))) | 1441 | (_ (message "Nothing to complete at point"))))) |
| 1420 | 1442 | ||
| 1421 | ;;; Key bindings. | 1443 | ;;; Key bindings. |
| 1422 | 1444 | ||
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index ec5c46b2897..cb4aca12edb 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el | |||
| @@ -1145,13 +1145,15 @@ target of the symlink differ." | |||
| 1145 | (save-excursion | 1145 | (save-excursion |
| 1146 | (tramp-convert-file-attributes | 1146 | (tramp-convert-file-attributes |
| 1147 | v | 1147 | v |
| 1148 | (cond | 1148 | (or |
| 1149 | ((tramp-get-remote-stat v) | 1149 | (cond |
| 1150 | (tramp-do-file-attributes-with-stat v localname id-format)) | 1150 | ((tramp-get-remote-stat v) |
| 1151 | ((tramp-get-remote-perl v) | 1151 | (tramp-do-file-attributes-with-stat v localname id-format)) |
| 1152 | (tramp-do-file-attributes-with-perl v localname id-format)) | 1152 | ((tramp-get-remote-perl v) |
| 1153 | (t | 1153 | (tramp-do-file-attributes-with-perl v localname id-format)) |
| 1154 | (tramp-do-file-attributes-with-ls v localname id-format))))))))) | 1154 | (t nil)) |
| 1155 | ;; The scripts could fail, for example with huge file size. | ||
| 1156 | (tramp-do-file-attributes-with-ls v localname id-format)))))))) | ||
| 1155 | 1157 | ||
| 1156 | (defun tramp-do-file-attributes-with-ls (vec localname &optional id-format) | 1158 | (defun tramp-do-file-attributes-with-ls (vec localname &optional id-format) |
| 1157 | "Implement `file-attributes' for Tramp files using the ls(1) command." | 1159 | "Implement `file-attributes' for Tramp files using the ls(1) command." |
| @@ -2296,10 +2298,9 @@ The method used must be an out-of-band method." | |||
| 2296 | (tramp-get-method-parameter method 'tramp-copy-env)))) | 2298 | (tramp-get-method-parameter method 'tramp-copy-env)))) |
| 2297 | 2299 | ||
| 2298 | ;; Check for program. | 2300 | ;; Check for program. |
| 2299 | (when (and (fboundp 'executable-find) | 2301 | (unless (let ((default-directory |
| 2300 | (not (let ((default-directory | 2302 | (tramp-compat-temporary-file-directory))) |
| 2301 | (tramp-compat-temporary-file-directory))) | 2303 | (executable-find copy-program)) |
| 2302 | (executable-find copy-program)))) | ||
| 2303 | (tramp-error | 2304 | (tramp-error |
| 2304 | v 'file-error "Cannot find copy program: %s" copy-program)) | 2305 | v 'file-error "Cannot find copy program: %s" copy-program)) |
| 2305 | 2306 | ||
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index 7e1b0f5b8e9..36477f7b439 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el | |||
| @@ -339,7 +339,7 @@ pass to the OPERATION." | |||
| 339 | preserve-uid-gid preserve-selinux-context) | 339 | preserve-uid-gid preserve-selinux-context) |
| 340 | "Like `copy-file' for Tramp files. | 340 | "Like `copy-file' for Tramp files. |
| 341 | KEEP-DATE is not handled in case NEWNAME resides on an SMB server. | 341 | KEEP-DATE is not handled in case NEWNAME resides on an SMB server. |
| 342 | PRESERVE-UID-GID is completely ignored." | 342 | PRESERVE-UID-GID and PRESERVE-SELINUX-CONTEXT are completely ignored." |
| 343 | (setq filename (expand-file-name filename) | 343 | (setq filename (expand-file-name filename) |
| 344 | newname (expand-file-name newname)) | 344 | newname (expand-file-name newname)) |
| 345 | (with-progress-reporter | 345 | (with-progress-reporter |
diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el index 47cbdf19ed2..e81f4ca949b 100644 --- a/lisp/progmodes/gud.el +++ b/lisp/progmodes/gud.el | |||
| @@ -767,7 +767,9 @@ directory and source-file directory for your debugger." | |||
| 767 | (gud-def gud-until "until %l" "\C-u" "Continue to current line.") | 767 | (gud-def gud-until "until %l" "\C-u" "Continue to current line.") |
| 768 | (gud-def gud-run "run" nil "Run the program.") | 768 | (gud-def gud-run "run" nil "Run the program.") |
| 769 | 769 | ||
| 770 | (local-set-key "\C-i" 'gud-gdb-complete-command) | 770 | (add-hook 'completion-at-point-functions #'gud-gdb-completion-at-point |
| 771 | nil 'local) | ||
| 772 | (local-set-key "\C-i" 'completion-at-point) | ||
| 771 | (setq comint-prompt-regexp "^(.*gdb[+]?) *") | 773 | (setq comint-prompt-regexp "^(.*gdb[+]?) *") |
| 772 | (setq paragraph-start comint-prompt-regexp) | 774 | (setq paragraph-start comint-prompt-regexp) |
| 773 | (setq gdb-first-prompt t) | 775 | (setq gdb-first-prompt t) |
| @@ -791,26 +793,28 @@ directory and source-file directory for your debugger." | |||
| 791 | ;; The completion list is constructed by the process filter. | 793 | ;; The completion list is constructed by the process filter. |
| 792 | (defvar gud-gdb-fetched-lines) | 794 | (defvar gud-gdb-fetched-lines) |
| 793 | 795 | ||
| 794 | (defun gud-gdb-complete-command (&optional command a b) | 796 | (defun gud-gdb-completions (context command) |
| 795 | "Perform completion on the GDB command preceding point. | 797 | "Completion table for GDB commands. |
| 796 | This is implemented using the GDB `complete' command which isn't | 798 | COMMAND is the prefix for which we seek completion. |
| 797 | available with older versions of GDB." | 799 | CONTEXT is the text before COMMAND on the line." |
| 798 | (interactive) | 800 | (let* ((start (- (point) (field-beginning))) |
| 799 | (if command | 801 | (complete-list |
| 800 | ;; Used by gud-watch in mini-buffer. | 802 | (gud-gdb-run-command-fetch-lines (concat "complete " context command) |
| 801 | (setq command (concat "p " command)) | ||
| 802 | ;; Used in GUD buffer. | ||
| 803 | (let ((end (point))) | ||
| 804 | (setq command (buffer-substring (comint-line-beginning-position) end)))) | ||
| 805 | (let* ((command-word | ||
| 806 | ;; Find the word break. This match will always succeed. | ||
| 807 | (and (string-match "\\(\\`\\| \\)\\([^ ]*\\)\\'" command) | ||
| 808 | (substring command (match-beginning 2)))) | ||
| 809 | (complete-list | ||
| 810 | (gud-gdb-run-command-fetch-lines (concat "complete " command) | ||
| 811 | (current-buffer) | 803 | (current-buffer) |
| 812 | ;; From string-match above. | 804 | ;; From string-match above. |
| 813 | (match-beginning 2)))) | 805 | (length context)))) |
| 806 | ;; `gud-gdb-run-command-fetch-lines' has some nasty side-effects on the | ||
| 807 | ;; buffer (via `gud-delete-prompt-marker'): it removes the prompt and then | ||
| 808 | ;; re-adds it later, thus messing up markers and overlays along the way. | ||
| 809 | ;; This is a problem for completion-in-region which uses an overlay to | ||
| 810 | ;; create a field. | ||
| 811 | ;; So we restore completion-in-region's field if needed. | ||
| 812 | ;; FIXME: change gud-gdb-run-command-fetch-lines so it doesn't modify the | ||
| 813 | ;; buffer at all. | ||
| 814 | (when (/= start (- (point) (field-beginning))) | ||
| 815 | (dolist (ol (overlays-at (1- (point)))) | ||
| 816 | (when (eq (overlay-get ol 'field) 'completion) | ||
| 817 | (move-overlay ol (- (point) start) (overlay-end ol))))) | ||
| 814 | ;; Protect against old versions of GDB. | 818 | ;; Protect against old versions of GDB. |
| 815 | (and complete-list | 819 | (and complete-list |
| 816 | (string-match "^Undefined command: \"complete\"" (car complete-list)) | 820 | (string-match "^Undefined command: \"complete\"" (car complete-list)) |
| @@ -836,8 +840,27 @@ available with older versions of GDB." | |||
| 836 | pos (match-end 0))) | 840 | pos (match-end 0))) |
| 837 | (and (= (mod count 2) 1) | 841 | (and (= (mod count 2) 1) |
| 838 | (setq complete-list (list (concat str "'")))))) | 842 | (setq complete-list (list (concat str "'")))))) |
| 839 | ;; Let comint handle the rest. | 843 | complete-list)) |
| 840 | (comint-dynamic-simple-complete command-word complete-list))) | 844 | |
| 845 | (defun gud-gdb-completion-at-point () | ||
| 846 | "Return the data to complete the GDB command before point." | ||
| 847 | (let ((end (point)) | ||
| 848 | (start | ||
| 849 | (save-excursion | ||
| 850 | (skip-chars-backward "^ " (comint-line-beginning-position)) | ||
| 851 | (point)))) | ||
| 852 | (list start end | ||
| 853 | (completion-table-dynamic | ||
| 854 | (apply-partially #'gud-gdb-completions | ||
| 855 | (buffer-substring (comint-line-beginning-position) | ||
| 856 | start)))))) | ||
| 857 | |||
| 858 | ;; (defun gud-gdb-complete-command () | ||
| 859 | ;; "Perform completion on the GDB command preceding point. | ||
| 860 | ;; This is implemented using the GDB `complete' command which isn't | ||
| 861 | ;; available with older versions of GDB." | ||
| 862 | ;; (interactive) | ||
| 863 | ;; (apply #'completion-in-region (gud-gdb-completion-at-point))) | ||
| 841 | 864 | ||
| 842 | ;; The completion process filter is installed temporarily to slurp the | 865 | ;; The completion process filter is installed temporarily to slurp the |
| 843 | ;; output of GDB up to the next prompt and build the completion list. | 866 | ;; output of GDB up to the next prompt and build the completion list. |
| @@ -3061,6 +3084,7 @@ class of the file (using s to separate nested class ids)." | |||
| 3061 | ;; syntactic information chain and collect any 'inclass | 3084 | ;; syntactic information chain and collect any 'inclass |
| 3062 | ;; symbols until 'topmost-intro is reached to find out if | 3085 | ;; symbols until 'topmost-intro is reached to find out if |
| 3063 | ;; point is within a nested class | 3086 | ;; point is within a nested class |
| 3087 | ;; FIXME: Yuck!!! cc-mode should provide a function instead. | ||
| 3064 | (if (and fbuffer (equal (symbol-file 'java-mode) "cc-mode")) | 3088 | (if (and fbuffer (equal (symbol-file 'java-mode) "cc-mode")) |
| 3065 | (with-current-buffer fbuffer | 3089 | (with-current-buffer fbuffer |
| 3066 | (let ((nclass) (syntax)) | 3090 | (let ((nclass) (syntax)) |
| @@ -3457,14 +3481,14 @@ This function must return nil if it doesn't handle EVENT." | |||
| 3457 | so they have been disabled.")) | 3481 | so they have been disabled.")) |
| 3458 | (unless (null cmd) ; CMD can be nil if unknown debugger | 3482 | (unless (null cmd) ; CMD can be nil if unknown debugger |
| 3459 | (if (eq gud-minor-mode 'gdbmi) | 3483 | (if (eq gud-minor-mode 'gdbmi) |
| 3460 | (if gdb-macro-info | 3484 | (if gdb-macro-info |
| 3461 | (gdb-input | 3485 | (gdb-input |
| 3462 | (list (concat | 3486 | (list (concat |
| 3463 | "server macro expand " expr "\n") | 3487 | "server macro expand " expr "\n") |
| 3464 | `(lambda () (gdb-tooltip-print-1 ,expr)))) | 3488 | `(lambda () (gdb-tooltip-print-1 ,expr)))) |
| 3465 | (gdb-input | 3489 | (gdb-input |
| 3466 | (list (concat cmd "\n") | 3490 | (list (concat cmd "\n") |
| 3467 | `(lambda () (gdb-tooltip-print ,expr))))) | 3491 | `(lambda () (gdb-tooltip-print ,expr))))) |
| 3468 | (setq gud-tooltip-original-filter (process-filter process)) | 3492 | (setq gud-tooltip-original-filter (process-filter process)) |
| 3469 | (set-process-filter process 'gud-tooltip-process-output) | 3493 | (set-process-filter process 'gud-tooltip-process-output) |
| 3470 | (gud-basic-call cmd)) | 3494 | (gud-basic-call cmd)) |