aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorJoakim Verona2011-08-23 11:09:33 +0200
committerJoakim Verona2011-08-23 11:09:33 +0200
commitf8012bc3ef48dd207da5b517fd22b4ac241e88bb (patch)
tree9341bdcbb0ff546126f1fb051c902ba6a5f55ed1 /lisp
parent07053c199965c6dafa4b2735e3b8d4f5290018a1 (diff)
parent425cc014ac9191debe8c01dc360685486bba0ff1 (diff)
downloademacs-f8012bc3ef48dd207da5b517fd22b4ac241e88bb.tar.gz
emacs-f8012bc3ef48dd207da5b517fd22b4ac241e88bb.zip
upstream
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog27
-rw-r--r--lisp/emacs-lisp/debug.el34
-rw-r--r--lisp/pcomplete.el18
-rw-r--r--lisp/progmodes/sh-script.el2
-rw-r--r--lisp/shell.el20
5 files changed, 75 insertions, 26 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 4c7306174d6..61ef1a21065 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,22 @@
12011-08-23 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * shell.el (shell-completion-vars): Set pcomplete-arg-quote-list.
4 * pcomplete.el (pcomplete-quote-argument): Fix thinko (bug#9161).
5
6 * pcomplete.el (pcomplete-parse-comint-arguments): Fix inf-loop.
7 Mark obsolete.
8 * shell.el (shell-parse-pcomplete-arguments): New function.
9 (shell-completion-vars): Use it instead (bug#9160).
10
112011-08-22 Stefan Monnier <monnier@iro.umontreal.ca>
12
13 * progmodes/sh-script.el (sh-maybe-here-document): Disable magic in
14 strings and comments (bug#9333).
15
16 * emacs-lisp/debug.el (debug-arglist): New function.
17 (debug-convert-byte-code): Use it. Handle lexical byte-codes.
18 (debug-on-entry-1): Handle interpreted closures (bug#9120).
19
12011-08-22 Juri Linkov <juri@jurta.org> 202011-08-22 Juri Linkov <juri@jurta.org>
2 21
3 * progmodes/compile.el (compilation-mode-font-lock-keywords): 22 * progmodes/compile.el (compilation-mode-font-lock-keywords):
@@ -45,8 +64,8 @@
45 (font-lock-default-fontify-region) 64 (font-lock-default-fontify-region)
46 (font-lock-default-unfontify-region): Add docstrings (Bug#8624). 65 (font-lock-default-unfontify-region): Add docstrings (Bug#8624).
47 66
48 * progmodes/compile.el (compilation-error-properties): Fix 67 * progmodes/compile.el (compilation-error-properties):
49 confusion between file struct and message struct (Bug#9319). 68 Fix confusion between file struct and message struct (Bug#9319).
50 (compilation-error-regexp-alist-alist): Fix 2011-05-09 change to 69 (compilation-error-regexp-alist-alist): Fix 2011-05-09 change to
51 `ant' regexp. 70 `ant' regexp.
52 71
@@ -140,8 +159,8 @@
140 binding variables (bug#9298). Also clean up some unused 159 binding variables (bug#9298). Also clean up some unused
141 autoloads. 160 autoloads.
142 161
143 * net/network-stream.el (network-stream-open-starttls): Support 162 * net/network-stream.el (network-stream-open-starttls):
144 using starttls.el without using gnutls-cli. 163 Support using starttls.el without using gnutls-cli.
145 164
1462011-08-17 Juri Linkov <juri@jurta.org> 1652011-08-17 Juri Linkov <juri@jurta.org>
147 166
diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el
index 157749500e7..8276030ccf8 100644
--- a/lisp/emacs-lisp/debug.el
+++ b/lisp/emacs-lisp/debug.el
@@ -778,6 +778,7 @@ Redefining FUNCTION also cancels it."
778 (not (debugger-special-form-p symbol)))) 778 (not (debugger-special-form-p symbol))))
779 t nil nil (symbol-name fn))) 779 t nil nil (symbol-name fn)))
780 (list (if (equal val "") fn (intern val))))) 780 (list (if (equal val "") fn (intern val)))))
781 ;; FIXME: Use advice.el.
781 (when (debugger-special-form-p function) 782 (when (debugger-special-form-p function)
782 (error "Function %s is a special form" function)) 783 (error "Function %s is a special form" function))
783 (if (or (symbolp (symbol-function function)) 784 (if (or (symbolp (symbol-function function))
@@ -835,24 +836,30 @@ To specify a nil argument interactively, exit with an empty minibuffer."
835 (message "Cancelling debug-on-entry for all functions") 836 (message "Cancelling debug-on-entry for all functions")
836 (mapcar 'cancel-debug-on-entry debug-function-list))) 837 (mapcar 'cancel-debug-on-entry debug-function-list)))
837 838
839(defun debug-arglist (definition)
840 ;; FIXME: copied from ad-arglist.
841 "Return the argument list of DEFINITION."
842 (require 'help-fns)
843 (help-function-arglist definition 'preserve-names))
844
838(defun debug-convert-byte-code (function) 845(defun debug-convert-byte-code (function)
839 (let* ((defn (symbol-function function)) 846 (let* ((defn (symbol-function function))
840 (macro (eq (car-safe defn) 'macro))) 847 (macro (eq (car-safe defn) 'macro)))
841 (when macro (setq defn (cdr defn))) 848 (when macro (setq defn (cdr defn)))
842 (unless (consp defn) 849 (when (byte-code-function-p defn)
843 ;; Assume a compiled code object. 850 (let* ((args (debug-arglist defn))
844 (let* ((contents (append defn nil))
845 (body 851 (body
846 (list (list 'byte-code (nth 1 contents) 852 `((,(if (memq '&rest args) #'apply #'funcall)
847 (nth 2 contents) (nth 3 contents))))) 853 ,defn
848 (if (nthcdr 5 contents) 854 ,@(remq '&rest (remq '&optional args))))))
849 (setq body (cons (list 'interactive (nth 5 contents)) body))) 855 (if (> (length defn) 5)
850 (if (nth 4 contents) 856 (push `(interactive ,(aref defn 5)) body))
857 (if (aref defn 4)
851 ;; Use `documentation' here, to get the actual string, 858 ;; Use `documentation' here, to get the actual string,
852 ;; in case the compiled function has a reference 859 ;; in case the compiled function has a reference
853 ;; to the .elc file. 860 ;; to the .elc file.
854 (setq body (cons (documentation function) body))) 861 (setq body (cons (documentation function) body)))
855 (setq defn (cons 'lambda (cons (car contents) body)))) 862 (setq defn `(closure (t) ,args ,@body)))
856 (when macro (setq defn (cons 'macro defn))) 863 (when macro (setq defn (cons 'macro defn)))
857 (fset function defn)))) 864 (fset function defn))))
858 865
@@ -861,11 +868,12 @@ To specify a nil argument interactively, exit with an empty minibuffer."
861 (tail defn)) 868 (tail defn))
862 (when (eq (car-safe tail) 'macro) 869 (when (eq (car-safe tail) 'macro)
863 (setq tail (cdr tail))) 870 (setq tail (cdr tail)))
864 (if (not (eq (car-safe tail) 'lambda)) 871 (if (not (memq (car-safe tail) '(closure lambda)))
865 ;; Only signal an error when we try to set debug-on-entry. 872 ;; Only signal an error when we try to set debug-on-entry.
866 ;; When we try to clear debug-on-entry, we are now done. 873 ;; When we try to clear debug-on-entry, we are now done.
867 (when flag 874 (when flag
868 (error "%s is not a user-defined Lisp function" function)) 875 (error "%s is not a user-defined Lisp function" function))
876 (if (eq (car tail) 'closure) (setq tail (cdr tail)))
869 (setq tail (cdr tail)) 877 (setq tail (cdr tail))
870 ;; Skip the docstring. 878 ;; Skip the docstring.
871 (when (and (stringp (cadr tail)) (cddr tail)) 879 (when (and (stringp (cadr tail)) (cddr tail))
@@ -875,9 +883,9 @@ To specify a nil argument interactively, exit with an empty minibuffer."
875 (setq tail (cdr tail))) 883 (setq tail (cdr tail)))
876 (unless (eq flag (equal (cadr tail) '(implement-debug-on-entry))) 884 (unless (eq flag (equal (cadr tail) '(implement-debug-on-entry)))
877 ;; Add/remove debug statement as needed. 885 ;; Add/remove debug statement as needed.
878 (if flag 886 (setcdr tail (if flag
879 (setcdr tail (cons '(implement-debug-on-entry) (cdr tail))) 887 (cons '(implement-debug-on-entry) (cdr tail))
880 (setcdr tail (cddr tail))))) 888 (cddr tail)))))
881 defn)) 889 defn))
882 890
883(defun debugger-list-functions () 891(defun debugger-list-functions ()
diff --git a/lisp/pcomplete.el b/lisp/pcomplete.el
index 46a82e3720d..bdf2dadd16c 100644
--- a/lisp/pcomplete.el
+++ b/lisp/pcomplete.el
@@ -811,15 +811,19 @@ this is `comint-dynamic-complete-functions'."
811 (while (< (point) end) 811 (while (< (point) end)
812 (skip-chars-forward " \t\n") 812 (skip-chars-forward " \t\n")
813 (push (point) begins) 813 (push (point) begins)
814 (let ((skip t)) 814 (while
815 (while skip 815 (progn
816 (skip-chars-forward "^ \t\n") 816 (skip-chars-forward "^ \t\n\\")
817 (if (eq (char-before) ?\\) 817 (when (eq (char-after) ?\\)
818 (skip-chars-forward " \t\n") 818 (forward-char 1)
819 (setq skip nil)))) 819 (unless (eolp)
820 (forward-char 1)
821 t))))
820 (push (buffer-substring-no-properties (car begins) (point)) 822 (push (buffer-substring-no-properties (car begins) (point))
821 args)) 823 args))
822 (cons (nreverse args) (nreverse begins))))) 824 (cons (nreverse args) (nreverse begins)))))
825(make-obsolete 'pcomplete-parse-comint-arguments
826 'comint-parse-pcomplete-arguments "24.1")
823 827
824(defun pcomplete-parse-arguments (&optional expand-p) 828(defun pcomplete-parse-arguments (&optional expand-p)
825 "Parse the command line arguments. Most completions need this info." 829 "Parse the command line arguments. Most completions need this info."
@@ -879,7 +883,7 @@ Magic characters are those in `pcomplete-arg-quote-list'."
879 (or (run-hook-with-args-until-success 883 (or (run-hook-with-args-until-success
880 'pcomplete-quote-arg-hook filename index) 884 'pcomplete-quote-arg-hook filename index)
881 (when (memq c pcomplete-arg-quote-list) 885 (when (memq c pcomplete-arg-quote-list)
882 (string "\\" c)) 886 (string ?\\ c))
883 (char-to-string c)) 887 (char-to-string c))
884 (setq index (1+ index)))) 888 (setq index (1+ index))))
885 filename 889 filename
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 31a4fbaef4d..7b949134c6c 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -460,6 +460,7 @@ This is buffer-local in every such buffer.")
460 (define-key map "\C-c+" 'sh-add) 460 (define-key map "\C-c+" 'sh-add)
461 (define-key map "\C-\M-x" 'sh-execute-region) 461 (define-key map "\C-\M-x" 'sh-execute-region)
462 (define-key map "\C-c\C-x" 'executable-interpret) 462 (define-key map "\C-c\C-x" 'executable-interpret)
463 ;; FIXME: Use post-self-insert-hook.
463 (define-key map "<" 'sh-maybe-here-document) 464 (define-key map "<" 'sh-maybe-here-document)
464 (define-key map "(" 'skeleton-pair-insert-maybe) 465 (define-key map "(" 'skeleton-pair-insert-maybe)
465 (define-key map "{" 'skeleton-pair-insert-maybe) 466 (define-key map "{" 'skeleton-pair-insert-maybe)
@@ -3659,6 +3660,7 @@ The document is bounded by `sh-here-document-word'."
3659 (save-excursion 3660 (save-excursion
3660 (backward-char 2) 3661 (backward-char 2)
3661 (sh-quoted-p)) 3662 (sh-quoted-p))
3663 (nth 8 (syntax-ppss))
3662 (let ((tabs (if (string-match "\\`-" sh-here-document-word) 3664 (let ((tabs (if (string-match "\\`-" sh-here-document-word)
3663 (make-string (/ (current-indentation) tab-width) ?\t) 3665 (make-string (/ (current-indentation) tab-width) ?\t)
3664 "")) 3666 ""))
diff --git a/lisp/shell.el b/lisp/shell.el
index de811543ba0..01d1a688f0e 100644
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -383,6 +383,21 @@ to `dirtrack-mode'."
383 :group 'shell 383 :group 'shell
384 :type '(choice (const nil) regexp)) 384 :type '(choice (const nil) regexp))
385 385
386(defun shell-parse-pcomplete-arguments ()
387 "Parse whitespace separated arguments in the current region."
388 (let ((begin (save-excursion (shell-backward-command 1) (point)))
389 (end (point))
390 begins args)
391 (save-excursion
392 (goto-char begin)
393 (while (< (point) end)
394 (skip-chars-forward " \t\n")
395 (push (point) begins)
396 (looking-at "\\(?:[^\s\t\n\\]\\|'[^']*'\\|\"\\(?:[^\"\\]\\|\\\\.\\)*\"\\|\\\\.\\)*\\(?:\\\\\\|'[^']*\\|\"\\(?:[^\"\\]\\|\\\\.\\)*\\)?")
397 (goto-char (match-end 0))
398 (push (buffer-substring-no-properties (car begins) (point))
399 args))
400 (cons (nreverse args) (nreverse begins)))))
386 401
387(defun shell-completion-vars () 402(defun shell-completion-vars ()
388 "Setup completion vars for `shell-mode' and `read-shell-command'." 403 "Setup completion vars for `shell-mode' and `read-shell-command'."
@@ -396,8 +411,9 @@ to `dirtrack-mode'."
396 (set (make-local-variable 'comint-dynamic-complete-functions) 411 (set (make-local-variable 'comint-dynamic-complete-functions)
397 shell-dynamic-complete-functions) 412 shell-dynamic-complete-functions)
398 (set (make-local-variable 'pcomplete-parse-arguments-function) 413 (set (make-local-variable 'pcomplete-parse-arguments-function)
399 ;; FIXME: This function should be moved to shell.el. 414 #'shell-parse-pcomplete-arguments)
400 #'pcomplete-parse-comint-arguments) 415 (set (make-local-variable 'pcomplete-arg-quote-list)
416 (append "\\ \t\n\r\"'`$|&;(){}[]<>#" nil))
401 (set (make-local-variable 'pcomplete-termination-string) 417 (set (make-local-variable 'pcomplete-termination-string)
402 (cond ((not comint-completion-addsuffix) "") 418 (cond ((not comint-completion-addsuffix) "")
403 ((stringp comint-completion-addsuffix) 419 ((stringp comint-completion-addsuffix)