diff options
| author | Paul Eggert | 2011-08-05 16:35:10 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-08-05 16:35:10 -0700 |
| commit | 458bfed397af18e460d01b888d1da095b6b95034 (patch) | |
| tree | 6f3933c2deab13b0df064d87e7b6fa25d835cfcb /lisp | |
| parent | 0e51f7172bd1ab8b9c1bb52598afb5017e19b9c3 (diff) | |
| parent | 4640dd881c07162a6120ccb3b117b748badf78c9 (diff) | |
| download | emacs-458bfed397af18e460d01b888d1da095b6b95034.tar.gz emacs-458bfed397af18e460d01b888d1da095b6b95034.zip | |
Merge from trunk.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 19 | ||||
| -rw-r--r-- | lisp/emacs-lisp/cl-loaddefs.el | 2 | ||||
| -rw-r--r-- | lisp/emacs-lisp/cl-macs.el | 38 | ||||
| -rw-r--r-- | lisp/help-fns.el | 11 | ||||
| -rw-r--r-- | lisp/progmodes/js.el | 10 | ||||
| -rw-r--r-- | lisp/window.el | 20 |
6 files changed, 74 insertions, 26 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6a6abdf7e42..7c1fa3a656b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,22 @@ | |||
| 1 | 2011-08-05 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * progmodes/js.el (js--regexp-literal): Accept regexps at the beginning | ||
| 4 | of statements and in a few more cases (bug#9183). | ||
| 5 | |||
| 6 | * emacs-lisp/cl-macs.el (cl--make-usage-var, cl--make-usage-args): | ||
| 7 | New functions. | ||
| 8 | (cl-transform-lambda): Use them (bug#9239). | ||
| 9 | |||
| 10 | 2011-08-05 Martin Rudalics <rudalics@gmx.at> | ||
| 11 | |||
| 12 | * window.el (display-buffer-same-window) | ||
| 13 | (display-buffer-same-frame, display-buffer-other-window) | ||
| 14 | (pop-to-buffer-same-window, pop-to-buffer-same-frame) | ||
| 15 | (pop-to-buffer-other-window) | ||
| 16 | (pop-to-buffer-same-frame-other-window) | ||
| 17 | (pop-to-buffer-other-frame): Make them defuns. | ||
| 18 | (switch-to-buffer): Don't set LABEL argument of pop-to-buffer. | ||
| 19 | |||
| 1 | 2011-08-03 Stefan Monnier <monnier@iro.umontreal.ca> | 20 | 2011-08-03 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 21 | ||
| 3 | * subr.el (make-composed-keymap): Move from C. Change calling | 22 | * subr.el (make-composed-keymap): Move from C. Change calling |
diff --git a/lisp/emacs-lisp/cl-loaddefs.el b/lisp/emacs-lisp/cl-loaddefs.el index 4b9985380c3..7beb4d4b4cc 100644 --- a/lisp/emacs-lisp/cl-loaddefs.el +++ b/lisp/emacs-lisp/cl-loaddefs.el | |||
| @@ -282,7 +282,7 @@ Not documented | |||
| 282 | ;;;;;; flet progv psetq do-all-symbols do-symbols dotimes dolist | 282 | ;;;;;; flet progv psetq do-all-symbols do-symbols dotimes dolist |
| 283 | ;;;;;; do* do loop return-from return block etypecase typecase ecase | 283 | ;;;;;; do* do loop return-from return block etypecase typecase ecase |
| 284 | ;;;;;; case load-time-value eval-when destructuring-bind function* | 284 | ;;;;;; case load-time-value eval-when destructuring-bind function* |
| 285 | ;;;;;; defmacro* defun* gentemp gensym) "cl-macs" "cl-macs.el" "21df83d6106cb0c3d037e75ad79359dc") | 285 | ;;;;;; defmacro* defun* gentemp gensym) "cl-macs" "cl-macs.el" "0907093f7720996444ededb4edfe8072") |
| 286 | ;;; Generated autoloads from cl-macs.el | 286 | ;;; Generated autoloads from cl-macs.el |
| 287 | 287 | ||
| 288 | (autoload 'gensym "cl-macs" "\ | 288 | (autoload 'gensym "cl-macs" "\ |
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 6d242eda3ab..fb19115287c 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el | |||
| @@ -238,6 +238,37 @@ It is a list of elements of the form either: | |||
| 238 | 238 | ||
| 239 | (declare-function help-add-fundoc-usage "help-fns" (docstring arglist)) | 239 | (declare-function help-add-fundoc-usage "help-fns" (docstring arglist)) |
| 240 | 240 | ||
| 241 | (defun cl--make-usage-var (x) | ||
| 242 | "X can be a var or a (destructuring) lambda-list." | ||
| 243 | (cond | ||
| 244 | ((symbolp x) (make-symbol (upcase (symbol-name x)))) | ||
| 245 | ((consp x) (cl--make-usage-args x)) | ||
| 246 | (t x))) | ||
| 247 | |||
| 248 | (defun cl--make-usage-args (arglist) | ||
| 249 | ;; `orig-args' can contain &cl-defs (an internal | ||
| 250 | ;; CL thingy I don't understand), so remove it. | ||
| 251 | (let ((x (memq '&cl-defs arglist))) | ||
| 252 | (when x (setq arglist (delq (car x) (remq (cadr x) arglist))))) | ||
| 253 | (let ((state nil)) | ||
| 254 | (mapcar (lambda (x) | ||
| 255 | (cond | ||
| 256 | ((symbolp x) | ||
| 257 | (if (eq ?\& (aref (symbol-name x) 0)) | ||
| 258 | (setq state x) | ||
| 259 | (make-symbol (upcase (symbol-name x))))) | ||
| 260 | ((not (consp x)) x) | ||
| 261 | ((memq state '(nil &rest)) (cl--make-usage-args x)) | ||
| 262 | (t ;(VAR INITFORM SVAR) or ((KEYWORD VAR) INITFORM SVAR). | ||
| 263 | (list* | ||
| 264 | (if (and (consp (car x)) (eq state '&key)) | ||
| 265 | (list (caar x) (cl--make-usage-var (nth 1 (car x)))) | ||
| 266 | (cl--make-usage-var (car x))) | ||
| 267 | (nth 1 x) ;INITFORM. | ||
| 268 | (cl--make-usage-args (nthcdr 2 x)) ;SVAR. | ||
| 269 | )))) | ||
| 270 | arglist))) | ||
| 271 | |||
| 241 | (defun cl-transform-lambda (form bind-block) | 272 | (defun cl-transform-lambda (form bind-block) |
| 242 | (let* ((args (car form)) (body (cdr form)) (orig-args args) | 273 | (let* ((args (car form)) (body (cdr form)) (orig-args args) |
| 243 | (bind-defs nil) (bind-enquote nil) | 274 | (bind-defs nil) (bind-enquote nil) |
| @@ -282,11 +313,8 @@ It is a list of elements of the form either: | |||
| 282 | (require 'help-fns) | 313 | (require 'help-fns) |
| 283 | (cons (help-add-fundoc-usage | 314 | (cons (help-add-fundoc-usage |
| 284 | (if (stringp (car hdr)) (pop hdr)) | 315 | (if (stringp (car hdr)) (pop hdr)) |
| 285 | ;; orig-args can contain &cl-defs (an internal | 316 | (format "(fn %S)" |
| 286 | ;; CL thingy I don't understand), so remove it. | 317 | (cl--make-usage-args orig-args))) |
| 287 | (let ((x (memq '&cl-defs orig-args))) | ||
| 288 | (if (null x) orig-args | ||
| 289 | (delq (car x) (remq (cadr x) orig-args))))) | ||
| 290 | hdr))) | 318 | hdr))) |
| 291 | (list (nconc (list 'let* bind-lets) | 319 | (list (nconc (list 'let* bind-lets) |
| 292 | (nreverse bind-forms) body))))))) | 320 | (nreverse bind-forms) body))))))) |
diff --git a/lisp/help-fns.el b/lisp/help-fns.el index b13e6a77d5d..5e034b14fde 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el | |||
| @@ -65,7 +65,9 @@ | |||
| 65 | 65 | ||
| 66 | (defun help-split-fundoc (docstring def) | 66 | (defun help-split-fundoc (docstring def) |
| 67 | "Split a function DOCSTRING into the actual doc and the usage info. | 67 | "Split a function DOCSTRING into the actual doc and the usage info. |
| 68 | Return (USAGE . DOC) or nil if there's no usage info. | 68 | Return (USAGE . DOC) or nil if there's no usage info, where USAGE info |
| 69 | is a string describing the argument list of DEF, such as | ||
| 70 | \"(apply FUNCTION &rest ARGUMENTS)\". | ||
| 69 | DEF is the function whose usage we're looking for in DOCSTRING." | 71 | DEF is the function whose usage we're looking for in DOCSTRING." |
| 70 | ;; Functions can get the calling sequence at the end of the doc string. | 72 | ;; Functions can get the calling sequence at the end of the doc string. |
| 71 | ;; In cases where `function' has been fset to a subr we can't search for | 73 | ;; In cases where `function' has been fset to a subr we can't search for |
| @@ -156,12 +158,7 @@ the same names as used in the original source code, when possible." | |||
| 156 | (defun help-make-usage (function arglist) | 158 | (defun help-make-usage (function arglist) |
| 157 | (cons (if (symbolp function) function 'anonymous) | 159 | (cons (if (symbolp function) function 'anonymous) |
| 158 | (mapcar (lambda (arg) | 160 | (mapcar (lambda (arg) |
| 159 | (if (not (symbolp arg)) | 161 | (if (not (symbolp arg)) arg |
| 160 | (if (and (consp arg) (symbolp (car arg))) | ||
| 161 | ;; CL style default values for optional args. | ||
| 162 | (cons (intern (upcase (symbol-name (car arg)))) | ||
| 163 | (cdr arg)) | ||
| 164 | arg) | ||
| 165 | (let ((name (symbol-name arg))) | 162 | (let ((name (symbol-name arg))) |
| 166 | (cond | 163 | (cond |
| 167 | ((string-match "\\`&" name) arg) | 164 | ((string-match "\\`&" name) arg) |
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 1bdcb4cfa89..4abbe3b895f 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el | |||
| @@ -1658,15 +1658,19 @@ This performs fontification according to `js--class-styles'." | |||
| 1658 | ;; below. | 1658 | ;; below. |
| 1659 | (eval-and-compile | 1659 | (eval-and-compile |
| 1660 | (defconst js--regexp-literal | 1660 | (defconst js--regexp-literal |
| 1661 | "[=(,:]\\(?:\\s-\\|\n\\)*\\(/\\)\\(?:\\\\.\\|[^/*\\]\\)\\(?:\\\\.\\|[^/\\]\\)*\\(/\\)" | 1661 | (concat |
| 1662 | ;; We want to match regular expressions only at the beginning of | ||
| 1663 | ;; expressions. | ||
| 1664 | ;; FIXME: Should we also allow /regexp/ after infix operators such as +, | ||
| 1665 | ;; /, -, *, >, ...? | ||
| 1666 | "\\(?:\\`\\|[=([{,:;]\\)\\(?:\\s-\\|\n\\)*" | ||
| 1667 | "\\(/\\)\\(?:\\\\.\\|[^/*\\]\\)\\(?:\\\\.\\|[^/\\]\\)*\\(/\\)") | ||
| 1662 | "Regexp matching a JavaScript regular expression literal. | 1668 | "Regexp matching a JavaScript regular expression literal. |
| 1663 | Match groups 1 and 2 are the characters forming the beginning and | 1669 | Match groups 1 and 2 are the characters forming the beginning and |
| 1664 | end of the literal.")) | 1670 | end of the literal.")) |
| 1665 | 1671 | ||
| 1666 | (defconst js-syntax-propertize-function | 1672 | (defconst js-syntax-propertize-function |
| 1667 | (syntax-propertize-rules | 1673 | (syntax-propertize-rules |
| 1668 | ;; We want to match regular expressions only at the beginning of | ||
| 1669 | ;; expressions. | ||
| 1670 | (js--regexp-literal (1 "\"") (2 "\"")))) | 1674 | (js--regexp-literal (1 "\"") (2 "\"")))) |
| 1671 | 1675 | ||
| 1672 | ;;; Indentation | 1676 | ;;; Indentation |
diff --git a/lisp/window.el b/lisp/window.el index 215dbab7849..7e666af6abf 100644 --- a/lisp/window.el +++ b/lisp/window.el | |||
| @@ -5796,7 +5796,7 @@ this list as arguments." | |||
| 5796 | ;; regardless of graphic-only restrictions. | 5796 | ;; regardless of graphic-only restrictions. |
| 5797 | (display-buffer-pop-up-frame buffer))))) | 5797 | (display-buffer-pop-up-frame buffer))))) |
| 5798 | 5798 | ||
| 5799 | (defsubst display-buffer-same-window (&optional buffer-or-name label) | 5799 | (defun display-buffer-same-window (&optional buffer-or-name label) |
| 5800 | "Display buffer specified by BUFFER-OR-NAME in the selected window. | 5800 | "Display buffer specified by BUFFER-OR-NAME in the selected window. |
| 5801 | Another window will be used only if the buffer can't be shown in | 5801 | Another window will be used only if the buffer can't be shown in |
| 5802 | the selected window, usually because it is dedicated to another | 5802 | the selected window, usually because it is dedicated to another |
| @@ -5805,7 +5805,7 @@ buffer. Optional argument BUFFER-OR-NAME and LABEL are as for | |||
| 5805 | (interactive "BDisplay buffer in same window:\nP") | 5805 | (interactive "BDisplay buffer in same window:\nP") |
| 5806 | (display-buffer buffer-or-name 'same-window label)) | 5806 | (display-buffer buffer-or-name 'same-window label)) |
| 5807 | 5807 | ||
| 5808 | (defsubst display-buffer-same-frame (&optional buffer-or-name label) | 5808 | (defun display-buffer-same-frame (&optional buffer-or-name label) |
| 5809 | "Display buffer specified by BUFFER-OR-NAME in a window on the same frame. | 5809 | "Display buffer specified by BUFFER-OR-NAME in a window on the same frame. |
| 5810 | Another frame will be used only if there is no other choice. | 5810 | Another frame will be used only if there is no other choice. |
| 5811 | Optional argument BUFFER-OR-NAME and LABEL are as for | 5811 | Optional argument BUFFER-OR-NAME and LABEL are as for |
| @@ -5813,7 +5813,7 @@ Optional argument BUFFER-OR-NAME and LABEL are as for | |||
| 5813 | (interactive "BDisplay buffer on same frame:\nP") | 5813 | (interactive "BDisplay buffer on same frame:\nP") |
| 5814 | (display-buffer buffer-or-name 'same-frame label)) | 5814 | (display-buffer buffer-or-name 'same-frame label)) |
| 5815 | 5815 | ||
| 5816 | (defsubst display-buffer-other-window (&optional buffer-or-name label) | 5816 | (defun display-buffer-other-window (&optional buffer-or-name label) |
| 5817 | "Display buffer specified by BUFFER-OR-NAME in another window. | 5817 | "Display buffer specified by BUFFER-OR-NAME in another window. |
| 5818 | The selected window will be used only if there is no other | 5818 | The selected window will be used only if there is no other |
| 5819 | choice. Windows on the selected frame are preferred to windows | 5819 | choice. Windows on the selected frame are preferred to windows |
| @@ -5887,7 +5887,7 @@ additional information." | |||
| 5887 | (select-frame-set-input-focus new-frame norecord)) | 5887 | (select-frame-set-input-focus new-frame norecord)) |
| 5888 | buffer)) | 5888 | buffer)) |
| 5889 | 5889 | ||
| 5890 | (defsubst pop-to-buffer-same-window (&optional buffer-or-name norecord label) | 5890 | (defun pop-to-buffer-same-window (&optional buffer-or-name norecord label) |
| 5891 | "Pop to buffer specified by BUFFER-OR-NAME in the selected window. | 5891 | "Pop to buffer specified by BUFFER-OR-NAME in the selected window. |
| 5892 | Another window will be used only if the buffer can't be shown in | 5892 | Another window will be used only if the buffer can't be shown in |
| 5893 | the selected window, usually because it is dedicated to another | 5893 | the selected window, usually because it is dedicated to another |
| @@ -5896,7 +5896,7 @@ as for `pop-to-buffer'." | |||
| 5896 | (interactive "BPop to buffer in selected window:\nP") | 5896 | (interactive "BPop to buffer in selected window:\nP") |
| 5897 | (pop-to-buffer buffer-or-name 'same-window norecord label)) | 5897 | (pop-to-buffer buffer-or-name 'same-window norecord label)) |
| 5898 | 5898 | ||
| 5899 | (defsubst pop-to-buffer-same-frame (&optional buffer-or-name norecord label) | 5899 | (defun pop-to-buffer-same-frame (&optional buffer-or-name norecord label) |
| 5900 | "Pop to buffer specified by BUFFER-OR-NAME in a window on the selected frame. | 5900 | "Pop to buffer specified by BUFFER-OR-NAME in a window on the selected frame. |
| 5901 | Another frame will be used only if there is no other choice. | 5901 | Another frame will be used only if there is no other choice. |
| 5902 | Optional arguments BUFFER-OR-NAME, NORECORD and LABEL are as for | 5902 | Optional arguments BUFFER-OR-NAME, NORECORD and LABEL are as for |
| @@ -5904,7 +5904,7 @@ Optional arguments BUFFER-OR-NAME, NORECORD and LABEL are as for | |||
| 5904 | (interactive "BPop to buffer on same frame:\nP") | 5904 | (interactive "BPop to buffer on same frame:\nP") |
| 5905 | (pop-to-buffer buffer-or-name 'same-frame norecord label)) | 5905 | (pop-to-buffer buffer-or-name 'same-frame norecord label)) |
| 5906 | 5906 | ||
| 5907 | (defsubst pop-to-buffer-other-window (&optional buffer-or-name norecord label) | 5907 | (defun pop-to-buffer-other-window (&optional buffer-or-name norecord label) |
| 5908 | "Pop to buffer specified by BUFFER-OR-NAME in another window. | 5908 | "Pop to buffer specified by BUFFER-OR-NAME in another window. |
| 5909 | The selected window will be used only if there is no other | 5909 | The selected window will be used only if there is no other |
| 5910 | choice. Windows on the selected frame are preferred to windows | 5910 | choice. Windows on the selected frame are preferred to windows |
| @@ -5913,7 +5913,7 @@ LABEL are as for `pop-to-buffer'." | |||
| 5913 | (interactive "BPop to buffer in another window:\nP") | 5913 | (interactive "BPop to buffer in another window:\nP") |
| 5914 | (pop-to-buffer buffer-or-name 'other-window norecord)) | 5914 | (pop-to-buffer buffer-or-name 'other-window norecord)) |
| 5915 | 5915 | ||
| 5916 | (defsubst pop-to-buffer-same-frame-other-window (&optional buffer-or-name norecord label) | 5916 | (defun pop-to-buffer-same-frame-other-window (&optional buffer-or-name norecord label) |
| 5917 | "Pop to buffer specified by BUFFER-OR-NAME in another window on the selected frame. | 5917 | "Pop to buffer specified by BUFFER-OR-NAME in another window on the selected frame. |
| 5918 | The selected window or another frame will be used only if there | 5918 | The selected window or another frame will be used only if there |
| 5919 | is no other choice. Optional arguments BUFFER-OR-NAME, NORECORD | 5919 | is no other choice. Optional arguments BUFFER-OR-NAME, NORECORD |
| @@ -5921,7 +5921,7 @@ and LABEL are as for `pop-to-buffer'." | |||
| 5921 | (interactive "BPop to buffer in another window on same frame:\nP") | 5921 | (interactive "BPop to buffer in another window on same frame:\nP") |
| 5922 | (pop-to-buffer buffer-or-name 'same-frame-other-window norecord label)) | 5922 | (pop-to-buffer buffer-or-name 'same-frame-other-window norecord label)) |
| 5923 | 5923 | ||
| 5924 | (defsubst pop-to-buffer-other-frame (&optional buffer-or-name norecord label) | 5924 | (defun pop-to-buffer-other-frame (&optional buffer-or-name norecord label) |
| 5925 | "Pop to buffer specified by BUFFER-OR-NAME on another frame. | 5925 | "Pop to buffer specified by BUFFER-OR-NAME on another frame. |
| 5926 | The selected frame will be used only if there's no other choice. | 5926 | The selected frame will be used only if there's no other choice. |
| 5927 | Optional arguments BUFFER-OR-NAME, NORECORD and LABEL are as for | 5927 | Optional arguments BUFFER-OR-NAME, NORECORD and LABEL are as for |
| @@ -5994,8 +5994,7 @@ Return the buffer switched to." | |||
| 5994 | (let ((buffer (window-normalize-buffer-to-switch-to buffer-or-name))) | 5994 | (let ((buffer (window-normalize-buffer-to-switch-to buffer-or-name))) |
| 5995 | (if (null force-same-window) | 5995 | (if (null force-same-window) |
| 5996 | (pop-to-buffer | 5996 | (pop-to-buffer |
| 5997 | buffer '(same-window (reuse-window-dedicated . weak)) | 5997 | buffer '(same-window (reuse-window-dedicated . weak)) norecord) |
| 5998 | norecord 'switch-to-buffer) | ||
| 5999 | (cond | 5998 | (cond |
| 6000 | ;; Don't call set-window-buffer if it's not needed since it | 5999 | ;; Don't call set-window-buffer if it's not needed since it |
| 6001 | ;; might signal an error (e.g. if the window is dedicated). | 6000 | ;; might signal an error (e.g. if the window is dedicated). |
| @@ -6005,6 +6004,7 @@ Return the buffer switched to." | |||
| 6005 | ((eq (window-dedicated-p) t) | 6004 | ((eq (window-dedicated-p) t) |
| 6006 | (error "Cannot switch buffers in a dedicated window")) | 6005 | (error "Cannot switch buffers in a dedicated window")) |
| 6007 | (t (set-window-buffer nil buffer))) | 6006 | (t (set-window-buffer nil buffer))) |
| 6007 | |||
| 6008 | (unless norecord | 6008 | (unless norecord |
| 6009 | (select-window (selected-window))) | 6009 | (select-window (selected-window))) |
| 6010 | (set-buffer buffer)))) | 6010 | (set-buffer buffer)))) |