Now on revision 112880. ------------------------------------------------------------ revno: 112880 committer: Glenn Morris branch nick: trunk timestamp: Thu 2013-06-06 20:41:10 -0700 message: * admin/notes/bzr: Finally got the right locations.conf syntax diff: === modified file 'admin/notes/bzr' --- admin/notes/bzr 2013-06-07 03:19:29 +0000 +++ admin/notes/bzr 2013-06-07 03:41:10 +0000 @@ -356,10 +356,8 @@ branches, to override the server setting (untested; not sure this works), or by adding an entry to ~/.bazaar/locations.conf: -FIXME: Don't do this, it doesn't work right. - - [bzr+ssh://USERNAME@bzr.savannah.gnu.org/emacs/*] - post_commit_to = False + [bzr+ssh://USERNAME@bzr.savannah.gnu.org/emacs/*/] + post_commit_to = "" You have to use locations.conf rather than bazaar.conf because the latter has a lower priority than branch.conf. ------------------------------------------------------------ revno: 112879 committer: Juanma Barranquero branch nick: trunk timestamp: Fri 2013-06-07 05:23:57 +0200 message: Fix typos. diff: === modified file 'etc/NEWS' --- etc/NEWS 2013-06-05 20:57:09 +0000 +++ etc/NEWS 2013-06-07 03:23:57 +0000 @@ -404,7 +404,7 @@ It used to disable the minor mode, major mode, and text-property keymaps, whereas now it simply has higher precedence. -** Default process filers and sentinels are not nil any more. +** Default process filters and sentinels are not nil any more. Instead they default to a function which does what the nil value used to do. ** `read-event' does not return decoded chars in ttys any more. === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-06-06 21:35:45 +0000 +++ lisp/ChangeLog 2013-06-07 03:23:57 +0000 @@ -179,7 +179,7 @@ (auto-revert-notify-event-p, auto-revert-notify-event-file-name) (auto-revert-notify-handler): Handle also gfilenotify. - * subr.el: (file-notify-handle-event): New defun. Replacing ... + * subr.el (file-notify-handle-event): New defun. Replacing ... (inotify-event-p, inotify-handle-event, w32notify-handle-event): Remove. @@ -215,7 +215,7 @@ * vc/log-view.el: Doc fix. (log-view-mode-map): Copy keymap from `special-mode-map'. -2013-06-02 Eric Ludlam +2013-06-02 Eric Ludlam * emacs-lisp/eieio.el (eieio--defalias, eieio-hook) (eieio-error-unsupported-class-tags, eieio-skip-typecheck) @@ -3307,7 +3307,7 @@ 2013-03-08 Jambunathan K * hi-lock.el (hi-lock-read-regexp-defaults-function): New var. - (hi-lock-read-regexp-defaults): New defun. + (hi-lock-read-regexp-defaults): New defun. (hi-lock-line-face-buffer, hi-lock-face-buffer) (hi-lock-face-phrase-buffer): Propagate above change. Update docstring (bug#13892). @@ -3363,7 +3363,7 @@ Correct the position of point in some line-up functions. * progmodes/cc-align.el (c-lineup-whitesmith-in-block) - (c-lineup-assignments, c-lineup-gcc-asm-reg ): take position of + (c-lineup-assignments, c-lineup-gcc-asm-reg ): Take position of point at column 0 rather than at a random place in the line. 2013-03-05 Michael Albinus @@ -7370,7 +7370,7 @@ 2012-11-09 Vincent Belaïche - * ses.el: symbol to coordinate mapping is made by symbol property + * ses.el: Symbol to coordinate mapping is made by symbol property `ses-cell'. This means that the same mapping is done for all SES sheets. That is good enough for cells with standard A1 names, but not for named cell. So a hash map is added for the latter. @@ -11305,7 +11305,7 @@ * progmodes/python.el (python-shell-send-setup-max-wait): Delete var. (python-shell-make-comint): accept-process-output at startup. (run-python-internal): Set inferior-python-mode-hook to nil. - (python-shell-internal-get-or-create-process): call sit-for. + (python-shell-internal-get-or-create-process): Call sit-for. (python-preoutput-result): Add obsolete alias. (python-shell-internal-send-string): Use it. (python-shell-send-setup-code): Remove call to @@ -11497,7 +11497,7 @@ 2012-07-27 Fabián Ezequiel Gallina Consistent completion in inferior python with emacs -nw. - * progmodes/python.el (inferior-python-mode): replace "" + * progmodes/python.el (inferior-python-mode): Replace "" binding in inferior-python-mode-map with "\t". (python-shell-completion-complete-at-point) (python-completion-complete-at-point): Remove interactive spec. @@ -19061,8 +19061,8 @@ * progmodes/verilog-mode.el (verilog-read-defines): Fix reading parameters with embedded comments. Reported by Ray Stevens. - (verilog-calc-1, verilog-fork-wait-re) (verilog-forward-sexp, - verilog-wait-fork-re): Fix indentation of "wait fork", bug407. + (verilog-calc-1, verilog-fork-wait-re, verilog-forward-sexp) + (verilog-wait-fork-re): Fix indentation of "wait fork", bug407. Reported by Tim Holt. (verilog-auto): Fix AUTOing a upper module then AUTOing module instantiated by upper module causing wrong expansion until AUTOed a === modified file 'src/ChangeLog' --- src/ChangeLog 2013-06-06 16:35:31 +0000 +++ src/ChangeLog 2013-06-07 03:23:57 +0000 @@ -298,15 +298,15 @@ DPSxshow. (ns_glyph_metrics): CGFloat instead of float. - * nsfns.m (x_set_foreground_color, x_set_background_color): Use - EmacsCGFloat. - (ns_implicitly_set_icon_type, Fx_create_frame): Make static, remove - unused variables. - (Fns_read_file_name): Keep track if panel is for save. Use - ns_filename_from_panel/ns_directory_from_panel. + * nsfns.m (x_set_foreground_color, x_set_background_color): + Use EmacsCGFloat. + (ns_implicitly_set_icon_type, Fx_create_frame): Make static, + remove unused variables. + (Fns_read_file_name): Keep track if panel is for save. + Use ns_filename_from_panel/ns_directory_from_panel. (Fns_list_services): delegate only used for COCOA. - (Fns_convert_utf8_nfd_to_nfc): Remove warning for GNUStep. Just - return the input if GNUStep. + (Fns_convert_utf8_nfd_to_nfc): Remove warning for GNUStep. + Just return the input if GNUStep. (x_screen_planes): Remove. (Fxw_color_values): Use EmacsCGFloat (Fns_display_monitor_attributes_list): Only get screen number for @@ -422,7 +422,7 @@ 2013-05-21 Dmitry Antipov * xdisp.c (reseat_at_previous_visible_line_start): - Already declared in dispextern.h, so remove it here. + Already declared in dispextern.h, so remove it here. (move_it_vertically_backward): Likewise. 2013-05-20 YAMAMOTO Mitsuharu @@ -433,7 +433,7 @@ Mention `display-monitor-attributes-list' in docstrings. * nsfns.m (ns_get_screen): Remove function. All uses removed. - (check_ns_display_info): Sync with check_x_display_info in xfns.c. + (check_ns_display_info): Sync with check_x_display_info in xfns.c. (Fx_server_max_request_size, Fx_server_vendor, Fx_server_version) (Fx_display_screens, Fx_display_mm_width, Fx_display_mm_height) (Fx_display_backing_store, Fx_display_visual_class) @@ -4672,7 +4672,7 @@ * w32term.c (x_window_to_scroll_bar): Likewise. * window.c (window_list): Likewise. * xdisp.c (x_consider_frame_title): Likewise. - * xfaces.c ( Fdisplay_supports_face_attributes_p): Likewise. + * xfaces.c (Fdisplay_supports_face_attributes_p): Likewise. * xfns.c (x_window_to_frame, x_any_window_to_frame) (x_menubar_window_to_frame, x_top_window_to_frame): Likewise. * xmenu.c (menubar_id_to_frame): Likewise. @@ -17904,7 +17904,7 @@ Fix memory allocation problems in Cygwin build (Bug#9273). - * unexcw.c ( __malloc_initialized): Declare external variable. + * unexcw.c (__malloc_initialized): Declare external variable. (fixup_executable): Force the dumped emacs to reinitialize malloc. * gmalloc.c [CYGWIN] (bss_sbrk_heapbase, bss_sbrk_heapinfo): === modified file 'src/w32notify.c' --- src/w32notify.c 2013-01-25 09:39:47 +0000 +++ src/w32notify.c 2013-06-07 03:23:57 +0000 @@ -39,7 +39,7 @@ return, and watch_worker then issues another call to ReadDirectoryChangesW. (Except when it does not, see below.) - In a GUI session, The WM_EMACS_FILENOTIFY message, posted to the + In a GUI session, the WM_EMACS_FILENOTIFY message posted to the message queue gets dispatched to the main Emacs window procedure, which queues it for processing by w32_read_socket. When w32_read_socket sees this message, it accesses the buffer with file ------------------------------------------------------------ revno: 112878 committer: Glenn Morris branch nick: trunk timestamp: Thu 2013-06-06 20:19:29 -0700 message: * admin/notes/bzr (Commit emails): Tweak previous. diff: === modified file 'admin/notes/bzr' --- admin/notes/bzr 2013-06-07 02:58:52 +0000 +++ admin/notes/bzr 2013-06-07 03:19:29 +0000 @@ -356,6 +356,8 @@ branches, to override the server setting (untested; not sure this works), or by adding an entry to ~/.bazaar/locations.conf: +FIXME: Don't do this, it doesn't work right. + [bzr+ssh://USERNAME@bzr.savannah.gnu.org/emacs/*] post_commit_to = False ------------------------------------------------------------ revno: 112877 committer: Glenn Morris branch nick: trunk timestamp: Thu 2013-06-06 19:58:52 -0700 message: * admin/notes/bzr (Commit emails): Previous did not work, try again. diff: === modified file 'admin/notes/bzr' --- admin/notes/bzr 2013-06-07 02:55:58 +0000 +++ admin/notes/bzr 2013-06-07 02:58:52 +0000 @@ -356,7 +356,7 @@ branches, to override the server setting (untested; not sure this works), or by adding an entry to ~/.bazaar/locations.conf: - [/path/to/emacs/bzr/*] + [bzr+ssh://USERNAME@bzr.savannah.gnu.org/emacs/*] post_commit_to = False You have to use locations.conf rather than bazaar.conf because the ------------------------------------------------------------ revno: 112876 committer: Glenn Morris branch nick: trunk timestamp: Thu 2013-06-06 19:55:58 -0700 message: * admin/notes/bzr (Commit emails): More details. diff: === modified file 'admin/notes/bzr' --- admin/notes/bzr 2013-06-07 02:40:15 +0000 +++ admin/notes/bzr 2013-06-07 02:55:58 +0000 @@ -346,3 +346,18 @@ Runs on commit. Projects can enable it themselves by using `bzr config' to set post_commit_to option for a branch. See `bzr help email' (if you have the plugin installed) for other options. + +Note: if you have the bzr-email plugin installed locally, then when +you commit to the Emacs repository it will also try to send a commit +email from your local machine. If your machine is not configured to +send external mail, this will just fail. In any case, you may prefer +to either remove the plugin from your machine, or disable it for Emacs +branches. You can do this either by editing branch.conf in your Emacs +branches, to override the server setting (untested; not sure this +works), or by adding an entry to ~/.bazaar/locations.conf: + + [/path/to/emacs/bzr/*] + post_commit_to = False + +You have to use locations.conf rather than bazaar.conf because the +latter has a lower priority than branch.conf. ------------------------------------------------------------ revno: 112875 committer: Glenn Morris branch nick: trunk timestamp: Thu 2013-06-06 19:40:15 -0700 message: * admin/notes/bzr (Commit emails): New section. diff: === modified file 'admin/notes/bzr' --- admin/notes/bzr 2013-02-17 01:40:14 +0000 +++ admin/notes/bzr 2013-06-07 02:40:15 +0000 @@ -316,3 +316,33 @@ bzr bisect reset or simply delete the entire branch if you created it just for this. + +* Commit emails + +** Old method: bzr-hookless-email +https://launchpad.net/bzr-hookless-email + +Runs hourly via cron. Must ask Savannah admins to enable/disable it +for each branch. Stores the last revision that it mailed as +last_revision_mailed in branch.conf on the server. Breaks with bzr 2.6: + +http://lists.gnu.org/archive/html/savannah-hackers-public/2013-05/msg00000.html + +Fix from https://bugs.launchpad.net/bzr-hookless-email/+bug/988195 +only partially works. Breaks again on every merge commit: + +https://lists.ubuntu.com/archives/bazaar/2013q2/075520.html +http://lists.gnu.org/archive/html/savannah-hackers-public/2013-05/msg00024.html + +You can force it to skip the merge commit by changing the value for +last_revision_mailed, eg: + +bzr config last_revision_mailed=xfq.free@gmail.com-20130603233720-u1aumaxvf3o0rlai -d bzr+ssh://USERNAME@bzr.savannah.gnu.org/emacs/trunk/ + +** New method: bzr-email plugin +https://launchpad.net/bzr-email +http://lists.gnu.org/archive/html/savannah-hackers-public/2013-06/msg00007.html + +Runs on commit. Projects can enable it themselves by using `bzr +config' to set post_commit_to option for a branch. See `bzr help email' +(if you have the plugin installed) for other options. ------------------------------------------------------------ revno: 112874 author: Ted Zlatanov committer: Katsumi Yamaoka branch nick: trunk timestamp: Thu 2013-06-06 22:18:53 +0000 message: gnus-ems.el (gnus-image-type-available-p): Test `display-images-p' before `image-type-available-p' diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2013-06-04 08:14:23 +0000 +++ lisp/gnus/ChangeLog 2013-06-06 22:18:53 +0000 @@ -1,3 +1,9 @@ +2013-06-06 Teodor Zlatanov + + * gnus-ems.el (gnus-image-type-available-p): Test `display-images-p' + before `image-type-available-p' to avoid loading the image libraries + needlessly. + 2013-06-04 Katsumi Yamaoka * gnus-art.el (article-date-ut, article-update-date-lapsed): Don't === modified file 'lisp/gnus/gnus-ems.el' --- lisp/gnus/gnus-ems.el 2013-05-29 02:40:43 +0000 +++ lisp/gnus/gnus-ems.el 2013-06-06 22:18:53 +0000 @@ -165,10 +165,10 @@ (defun gnus-image-type-available-p (type) (and (fboundp 'image-type-available-p) - (image-type-available-p type) (if (fboundp 'display-images-p) (display-images-p) - t))) + t) + (image-type-available-p type))) (defun gnus-create-image (file &optional type data-p &rest props) (let ((face (plist-get props :face))) ------------------------------------------------------------ revno: 112873 committer: Glenn Morris branch nick: trunk timestamp: Thu 2013-06-06 17:35:45 -0400 message: * lisp/font-lock.el (lisp-font-lock-keywords-2): Treat user-error like error diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-06-06 21:04:43 +0000 +++ lisp/ChangeLog 2013-06-06 21:35:45 +0000 @@ -1,5 +1,8 @@ 2013-06-06 Glenn Morris + * font-lock.el (lisp-font-lock-keywords-2): + Treat user-error like error. + * emacs-lisp/bytecomp.el (byte-compile-char-before) (byte-compile-backward-char, byte-compile-backward-word): Handle explicit nil arguments. (Bug#14565) === modified file 'lisp/font-lock.el' --- lisp/font-lock.el 2013-05-24 06:59:55 +0000 +++ lisp/font-lock.el 2013-06-06 21:35:45 +0000 @@ -2328,7 +2328,7 @@ (1 font-lock-keyword-face) (2 font-lock-constant-face nil t)) ;; Erroneous structures. - ("(\\(abort\\|assert\\|warn\\|check-type\\|cerror\\|error\\|signal\\)\\_>" 1 font-lock-warning-face) + ("(\\(abort\\|assert\\|warn\\|check-type\\|cerror\\|\\(?:user-\\)?error\\|signal\\)\\_>" 1 font-lock-warning-face) ;; Words inside \\[] tend to be for `substitute-command-keys'. ("\\\\\\\\\\[\\(\\(?:\\sw\\|\\s_\\)+\\)\\]" (1 font-lock-constant-face prepend)) ------------------------------------------------------------ revno: 112872 committer: Glenn Morris branch nick: trunk timestamp: Thu 2013-06-06 17:32:13 -0400 message: * prog-mode.el: Comment fixes. diff: === modified file 'lisp/progmodes/prog-mode.el' --- lisp/progmodes/prog-mode.el 2013-06-05 18:30:47 +0000 +++ lisp/progmodes/prog-mode.el 2013-06-06 21:32:13 +0000 @@ -1,6 +1,6 @@ -;;; prog-mode.el --- Generic major mode for programming -*- lexical-binding:t -*- +;;; prog-mode.el --- Generic major mode for programming -*- lexical-binding: t -*- -;; Copyright (C) Free Software Foundation, Inc. +;; Copyright (C) 2013 Free Software Foundation, Inc. ;; Maintainer: FSF ;; Keywords: internal @@ -115,5 +115,5 @@ (setq bidi-paragraph-direction 'left-to-right)) (provide 'prog-mode) -;; arch-tag: 6f3ded02-6cc9-11d8-b018-000a95e675a6 + ;;; prog-mode.el ends here ------------------------------------------------------------ revno: 112871 committer: Glenn Morris branch nick: trunk timestamp: Thu 2013-06-06 17:04:43 -0400 message: bytecomp fix for bug#14565 * lisp/emacs-lisp/bytecomp.el (byte-compile-char-before) (byte-compile-backward-char, byte-compile-backward-word): Handle explicit nil arguments. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-06-06 05:35:01 +0000 +++ lisp/ChangeLog 2013-06-06 21:04:43 +0000 @@ -1,3 +1,9 @@ +2013-06-06 Glenn Morris + + * emacs-lisp/bytecomp.el (byte-compile-char-before) + (byte-compile-backward-char, byte-compile-backward-word): + Handle explicit nil arguments. (Bug#14565) + 2013-06-05 Alan Mackenzie * isearch.el (isearch-allow-prefix): New user option. === modified file 'lisp/emacs-lisp/bytecomp.el' --- lisp/emacs-lisp/bytecomp.el 2013-06-05 02:35:40 +0000 +++ lisp/emacs-lisp/bytecomp.el 2013-06-06 21:04:43 +0000 @@ -3447,31 +3447,34 @@ (byte-defop-compiler nconc) (defun byte-compile-char-before (form) - (cond ((= 2 (length form)) + (cond ((or (= 1 (length form)) + (and (= 2 (length form)) (not (nth 1 form)))) + (byte-compile-form '(char-after (1- (point))))) + ((= 2 (length form)) (byte-compile-form (list 'char-after (if (numberp (nth 1 form)) (1- (nth 1 form)) `(1- ,(nth 1 form)))))) - ((= 1 (length form)) - (byte-compile-form '(char-after (1- (point))))) (t (byte-compile-subr-wrong-args form "0-1")))) ;; backward-... ==> forward-... with negated argument. (defun byte-compile-backward-char (form) - (cond ((= 2 (length form)) + (cond ((or (= 1 (length form)) + (and (= 2 (length form)) (not (nth 1 form)))) + (byte-compile-form '(forward-char -1))) + ((= 2 (length form)) (byte-compile-form (list 'forward-char (if (numberp (nth 1 form)) (- (nth 1 form)) `(- ,(nth 1 form)))))) - ((= 1 (length form)) - (byte-compile-form '(forward-char -1))) (t (byte-compile-subr-wrong-args form "0-1")))) (defun byte-compile-backward-word (form) - (cond ((= 2 (length form)) + (cond ((or (= 1 (length form)) + (and (= 2 (length form)) (not (nth 1 form)))) + (byte-compile-form '(forward-word -1))) + ((= 2 (length form)) (byte-compile-form (list 'forward-word (if (numberp (nth 1 form)) (- (nth 1 form)) `(- ,(nth 1 form)))))) - ((= 1 (length form)) - (byte-compile-form '(forward-word -1))) (t (byte-compile-subr-wrong-args form "0-1")))) (defun byte-compile-list (form) ------------------------------------------------------------ revno: 112870 fixes bug: http://debbugs.gnu.org/14558 committer: Eli Zaretskii branch nick: trunk timestamp: Thu 2013-06-06 19:35:31 +0300 message: Improve the fix for bug #14558. src/xdisp.c (note_mouse_highlight): When mouse-highlight is off, still need to set the mouse pointer shape and activate help-echo. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-06-06 07:04:35 +0000 +++ src/ChangeLog 2013-06-06 16:35:31 +0000 @@ -1,3 +1,9 @@ +2013-06-06 Eli Zaretskii + + * xdisp.c (note_mouse_highlight): When mouse-highlight is off, + still need to set the mouse pointer shape and activate help-echo. + (Bug#14558) + 2013-06-06 Paul Eggert A few porting etc. fixes for the new file monitor code. === modified file 'src/xdisp.c' --- src/xdisp.c 2013-06-05 20:45:34 +0000 +++ src/xdisp.c 2013-06-06 16:35:31 +0000 @@ -27554,8 +27554,10 @@ /* EXPORT: Take proper action when the mouse has moved to position X, Y on - frame F as regards highlighting characters that have mouse-face - properties. Also de-highlighting chars where the mouse was before. + frame F with regards to highlighting portions of display that have + mouse-face properties. Also de-highlight portions of display where + the mouse was before, set the mouse pointer shape as appropriate + for the mouse coordinates, and activate help echo (tooltips). X and Y can be negative or out of range. */ void @@ -27665,8 +27667,7 @@ #ifdef HAVE_WINDOW_SYSTEM /* Look for :pointer property on image. */ - if (!NILP (Vmouse_highlight) - && glyph != NULL && glyph->type == IMAGE_GLYPH) + if (glyph != NULL && glyph->type == IMAGE_GLYPH) { struct image *img = IMAGE_FROM_ID (f, glyph->u.img_id); if (img != NULL && IMAGEP (img->spec)) @@ -27709,8 +27710,7 @@ #endif /* HAVE_WINDOW_SYSTEM */ /* Clear mouse face if X/Y not over text. */ - if (NILP (Vmouse_highlight) - || glyph == NULL + if (glyph == NULL || area != TEXT_AREA || !MATRIX_ROW_DISPLAYS_TEXT_P (MATRIX_ROW (w->current_matrix, vpos)) /* Glyph's OBJECT is an integer for glyphs inserted by the @@ -27773,6 +27773,12 @@ else noverlays = 0; + if (NILP (Vmouse_highlight)) + { + clear_mouse_face (hlinfo); + goto check_help_echo; + } + same_region = coords_in_mouse_face_p (w, hpos, vpos); if (same_region) ------------------------------------------------------------ revno: 112869 committer: Paul Eggert branch nick: trunk timestamp: Thu 2013-06-06 00:04:35 -0700 message: A few porting etc. fixes for the new file monitor code. See the thread containing . * gfilenotify.c (dir_monitor_callback, Fgfile_add_watch) (Fgfile_rm_watch): Don't assume EMACS_INT is the same width as a pointer. (dir_monitor_callback, Fgfile_rm_watch): Use assq_no_quit instead of Fassoc, for speed. (dir_monitor_callback, Fgfile_rm_watch): eassert that the monitor is a fixnum. (dir_monitor_callback): No need for CDR_SAFE. Simplify building of lisp with alternative tails. (Fgfile_add_watch, Fgfile_rm_watch): Do not assume glib functions set errno reliably on failure. (Fgfile_add_watch): Check that the monitor survives the XIL trick, and signal an error otherwise. (Fgfile_rm_watch): Prefer CONSP to !NILP. Use Fdelq instead of Fdelete, for speed. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-06-05 20:45:34 +0000 +++ src/ChangeLog 2013-06-06 07:04:35 +0000 @@ -1,3 +1,23 @@ +2013-06-06 Paul Eggert + + A few porting etc. fixes for the new file monitor code. + See the thread containing + . + * gfilenotify.c (dir_monitor_callback, Fgfile_add_watch) + (Fgfile_rm_watch): Don't assume EMACS_INT is the same width as a pointer. + (dir_monitor_callback, Fgfile_rm_watch): + Use assq_no_quit instead of Fassoc, for speed. + (dir_monitor_callback, Fgfile_rm_watch): + eassert that the monitor is a fixnum. + (dir_monitor_callback): No need for CDR_SAFE. + Simplify building of lisp with alternative tails. + (Fgfile_add_watch, Fgfile_rm_watch): + Do not assume glib functions set errno reliably on failure. + (Fgfile_add_watch): Check that the monitor survives the XIL trick, + and signal an error otherwise. + (Fgfile_rm_watch): Prefer CONSP to !NILP. + Use Fdelq instead of Fdelete, for speed. + 2013-06-05 Eli Zaretskii * xdisp.c (handle_tool_bar_click): When mouse-highlight is off, === modified file 'src/gfilenotify.c' --- src/gfilenotify.c 2013-06-05 12:17:02 +0000 +++ src/gfilenotify.c 2013-06-06 07:04:35 +0000 @@ -53,13 +53,13 @@ g_file_monitor. It shall create a Lisp event, and put it into Emacs input queue. */ static gboolean -dir_monitor_callback (GFileMonitor* monitor, - GFile* file, - GFile* other_file, +dir_monitor_callback (GFileMonitor *monitor, + GFile *file, + GFile *other_file, GFileMonitorEvent event_type, gpointer user_data) { - Lisp_Object symbol, watch_object; + Lisp_Object symbol, monitor_object, watch_object; char *name = g_file_get_parse_name (file); char *oname = other_file ? g_file_get_parse_name (other_file) : NULL; @@ -95,21 +95,23 @@ } /* Determine callback function. */ - watch_object = Fassoc (XIL ((EMACS_INT) monitor), watch_list); + monitor_object = XIL ((intptr_t) monitor); + eassert (INTEGERP (monitor_object)); + watch_object = assq_no_quit (monitor_object, watch_list); - if (FUNCTIONP (CDR_SAFE (watch_object))) + if (CONSP (watch_object)) { /* Construct an event. */ struct input_event event; + Lisp_Object otail = oname ? list1 (build_string (oname)) : Qnil; EVENT_INIT (event); event.kind = FILE_NOTIFY_EVENT; event.frame_or_window = Qnil; - event.arg = oname - ? list2 (list4 (XIL ((EMACS_INT) monitor), symbol, - build_string (name), build_string (oname)), - CDR_SAFE (watch_object)) - : list2 (list3 (XIL ((EMACS_INT) monitor), symbol, build_string (name)), - CDR_SAFE (watch_object)); + event.arg = list2 (Fcons (monitor_object, + Fcons (symbol, + Fcons (build_string (name), + otail))), + XCDR (watch_object)); /* Store it into the input event queue. */ kbd_buffer_store_event (&event); @@ -165,7 +167,7 @@ { Lisp_Object watch_descriptor, watch_object; GFile *gfile; - GFileMonitor* monitor; + GFileMonitor *monitor; GFileMonitorFlags gflags = G_FILE_MONITOR_NONE; /* Check parameters. */ @@ -190,14 +192,23 @@ /* Enable watch. */ monitor = g_file_monitor (gfile, gflags, NULL, NULL); - if (monitor != NULL) - g_signal_connect (monitor, "changed", - (GCallback) dir_monitor_callback, NULL); - else - report_file_error ("Cannot watch file", Fcons (file, Qnil)); + if (! monitor) + xsignal2 (Qfile_error, build_string ("Cannot watch file"), file); + + /* On all known glib platforms, converting MONITOR directly to a + Lisp_Object value results is a Lisp integer, which is safe. This + assumption is dicey, though, so check it now. */ + watch_descriptor = XIL ((intptr_t) monitor); + if (! INTEGERP (watch_descriptor)) + { + g_object_unref (monitor); + xsignal2 (Qfile_error, build_string ("Unsupported file watcher"), file); + } + + g_signal_connect (monitor, "changed", + (GCallback) dir_monitor_callback, NULL); /* Store watch object in watch list. */ - watch_descriptor = XIL ((EMACS_INT) monitor); watch_object = Fcons (watch_descriptor, callback); watch_list = Fcons (watch_object, watch_list); @@ -210,20 +221,23 @@ WATCH-DESCRIPTOR should be an object returned by `gfile-add-watch'. */) (Lisp_Object watch_descriptor) { - Lisp_Object watch_object; - GFileMonitor *monitor = (GFileMonitor *) XLI (watch_descriptor); - - watch_object = Fassoc (watch_descriptor, watch_list); - if (NILP (watch_object)) - report_file_error ("Not a watch descriptor", - Fcons (watch_descriptor, Qnil)); - + intptr_t int_monitor; + GFileMonitor *monitor; + Lisp_Object watch_object = assq_no_quit (watch_descriptor, watch_list); + + if (! CONSP (watch_object)) + xsignal2 (Qfile_error, build_string ("Not a watch descriptor"), + watch_descriptor); + + eassert (INTEGERP (watch_descriptor)); + int_monitor = XLI (watch_descriptor); + monitor = (GFileMonitor *) int_monitor; if (!g_file_monitor_cancel (monitor)) - report_file_error ("Could not rm watch", - Fcons (watch_descriptor, Qnil)); + xsignal2 (Qfile_error, build_string ("Could not rm watch"), + watch_descriptor); /* Remove watch descriptor from watch list. */ - watch_list = Fdelete (watch_object, watch_list); + watch_list = Fdelq (watch_object, watch_list); /* Cleanup. */ g_object_unref (monitor); ------------------------------------------------------------ revno: 112868 committer: Glenn Morris branch nick: trunk timestamp: Wed 2013-06-05 23:23:19 -0700 message: * isearch.el (isearch-allow-prefix): New defcustoms need :version tags (chisel this on my tombstone) diff: === modified file 'lisp/isearch.el' --- lisp/isearch.el 2013-06-05 20:57:09 +0000 +++ lisp/isearch.el 2013-06-06 06:23:19 +0000 @@ -2157,6 +2157,7 @@ If non-nil, entering a prefix argument will not terminate the search. This option is ignored \(presumed t) when `isearch-allow-scroll' is set." + :version "24.4" :type 'boolean :group 'isearch) ------------------------------------------------------------ revno: 112867 committer: Juri Linkov branch nick: trunk timestamp: Thu 2013-06-06 08:35:01 +0300 message: Add bug#9706. diff: === modified file 'doc/emacs/ChangeLog' --- doc/emacs/ChangeLog 2013-06-05 20:57:09 +0000 +++ doc/emacs/ChangeLog 2013-06-06 05:35:01 +0000 @@ -1,8 +1,8 @@ 2013-06-05 Alan Mackenzie * search.texi (Isearch Scroll): Rename to "Not Exiting Isearch". - (Net Exiting Isearch): Document new user option - `isearch-allow-prefix'. + (Not Exiting Isearch): Document new user option + `isearch-allow-prefix'. (Bug#9706) 2013-06-03 Juri Linkov === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-06-05 20:57:09 +0000 +++ lisp/ChangeLog 2013-06-06 05:35:01 +0000 @@ -1,8 +1,9 @@ 2013-06-05 Alan Mackenzie * isearch.el (isearch-allow-prefix): New user option. - (isearch-other-meta-char): don't exit isearch when a prefix + (isearch-other-meta-char): Don't exit isearch when a prefix argument is typed whilst `isearch-allow-prefix' is non-nil. + (Bug#9706) 2013-06-05 Stefan Monnier ------------------------------------------------------------ revno: 112866 committer: Alan Mackenzie branch nick: trunk timestamp: Wed 2013-06-05 20:57:09 +0000 message: * isearch.el (isearch-allow-prefix): New user option. (isearch-other-meta-char): don't exit isearch when a prefix argument is typed whilst `isearch-allow-prefix' is non-nil. * search.texi (Isearch Scroll): Rename to "Not Exiting Isearch". (Net Exiting Isearch): Document new user option `isearch-allow-prefix'. * etc/NEWS. Entry for this change. diff: === modified file 'doc/emacs/ChangeLog' --- doc/emacs/ChangeLog 2013-06-03 23:34:27 +0000 +++ doc/emacs/ChangeLog 2013-06-05 20:57:09 +0000 @@ -1,3 +1,9 @@ +2013-06-05 Alan Mackenzie + + * search.texi (Isearch Scroll): Rename to "Not Exiting Isearch". + (Net Exiting Isearch): Document new user option + `isearch-allow-prefix'. + 2013-06-03 Juri Linkov * display.texi (Highlight Interactively): Add global keybindings === modified file 'doc/emacs/emacs.texi' --- doc/emacs/emacs.texi 2013-03-30 16:47:07 +0000 +++ doc/emacs/emacs.texi 2013-06-05 20:57:09 +0000 @@ -396,14 +396,14 @@ Incremental Search -* Basic Isearch:: Basic incremental search commands. -* Repeat Isearch:: Searching for the same string again. -* Error in Isearch:: When your string is not found. -* Special Isearch:: Special input in incremental search. -* Isearch Yank:: Commands that grab text into the search string - or else edit the search string. -* Isearch Scroll:: Scrolling during an incremental search. -* Isearch Minibuffer:: Incremental search of the minibuffer history. +* Basic Isearch:: Basic incremental search commands. +* Repeat Isearch:: Searching for the same string again. +* Error in Isearch:: When your string is not found. +* Special Isearch:: Special input in incremental search. +* Isearch Yank:: Commands that grab text into the search string + or else edit the search string. +* Not Exiting Isearch:: Prefix argument and scrolling commands. +* Isearch Minibuffer:: Incremental search of the minibuffer history. Replacement Commands === modified file 'doc/emacs/search.texi' --- doc/emacs/search.texi 2013-05-15 23:14:18 +0000 +++ doc/emacs/search.texi 2013-06-05 20:57:09 +0000 @@ -52,14 +52,14 @@ @end table @menu -* Basic Isearch:: Basic incremental search commands. -* Repeat Isearch:: Searching for the same string again. -* Error in Isearch:: When your string is not found. -* Special Isearch:: Special input in incremental search. -* Isearch Yank:: Commands that grab text into the search string - or else edit the search string. -* Isearch Scroll:: Scrolling during an incremental search. -* Isearch Minibuffer:: Incremental search of the minibuffer history. +* Basic Isearch:: Basic incremental search commands. +* Repeat Isearch:: Searching for the same string again. +* Error in Isearch:: When your string is not found. +* Special Isearch:: Special input in incremental search. +* Isearch Yank:: Commands that grab text into the search string + or else edit the search string. +* Not Exiting Isearch:: Prefix argument and scrolling commands. +* Isearch Minibuffer:: Incremental search of the minibuffer history. @end menu @node Basic Isearch @@ -332,9 +332,28 @@ minibuffer with @kbd{M-e} (@pxref{Repeat Isearch}) and type @kbd{C-f} at the end of the search string in the minibuffer. -@node Isearch Scroll -@subsection Scrolling During Incremental Search - +@node Not Exiting Isearch +@subsection Not Exiting Incremental Search + +This subsection describes two categories of commands which you can +type without exiting the current incremental search, even though they +are not themselves part of incremental search. + +@table @asis +@item Prefix Arguments +@vindex isearch-allow-prefix + In incremental search, when you enter a prefix argument +(@pxref{Arguments}), by default it will apply either to the next +action in the search or to the command that exits the search. + + In previous versions of Emacs, entering a prefix argument always +terminated the search. You can revert to this behavior by setting the +variable @code{isearch-allow-prefix} to @code{nil}. + + When @code{isearch-allow-scroll} is non-@code{nil} (see below), +prefix arguments always have the default behavior described above. + +@item Scrolling Commands @vindex isearch-allow-scroll Normally, scrolling commands exit incremental search. If you change the variable @code{isearch-allow-scroll} to a non-@code{nil} value, @@ -366,6 +385,7 @@ change point, the buffer contents, the match data, the current buffer, or the selected window and frame. The command must not itself attempt an incremental search. +@end table @node Isearch Minibuffer @subsection Searching the Minibuffer === modified file 'etc/NEWS' --- etc/NEWS 2013-06-05 18:31:48 +0000 +++ etc/NEWS 2013-06-05 20:57:09 +0000 @@ -292,6 +292,10 @@ *** `query-replace' skips invisible text when `search-invisible' is nil, and opens overlays with hidden text when `search-invisible' is `open'. ++++ +*** By default, prefix arguments do not now terminate Isearch mode. +Set `isearch-allow-prefix' to nil to restore old behavior. + ** MH-E has been updated to MH-E version 8.5. See MH-E-NEWS for details. === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-06-05 19:57:10 +0000 +++ lisp/ChangeLog 2013-06-05 20:57:09 +0000 @@ -1,3 +1,9 @@ +2013-06-05 Alan Mackenzie + + * isearch.el (isearch-allow-prefix): New user option. + (isearch-other-meta-char): don't exit isearch when a prefix + argument is typed whilst `isearch-allow-prefix' is non-nil. + 2013-06-05 Stefan Monnier * autorevert.el (auto-revert-notify-handler): Use memq. === modified file 'lisp/isearch.el' --- lisp/isearch.el 2013-06-03 08:51:50 +0000 +++ lisp/isearch.el 2013-06-05 20:57:09 +0000 @@ -2152,6 +2152,14 @@ :type 'boolean :group 'isearch) +(defcustom isearch-allow-prefix t + "Whether prefix arguments are allowed during incremental search. +If non-nil, entering a prefix argument will not terminate the +search. This option is ignored \(presumed t) when +`isearch-allow-scroll' is set." + :type 'boolean + :group 'isearch) + (defun isearch-string-out-of-window (isearch-point) "Test whether the search string is currently outside of the window. Return nil if it's completely visible, or if point is visible, @@ -2304,12 +2312,19 @@ (setq prefix-arg arg) (apply 'isearch-unread keylist) (isearch-edit-string)) - ;; Handle a scrolling function. - ((and isearch-allow-scroll - (progn (setq key (isearch-reread-key-sequence-naturally keylist)) - (setq keylist (listify-key-sequence key)) - (setq main-event (aref key 0)) - (setq scroll-command (isearch-lookup-scroll-key key)))) + ;; Handle a scrolling function or prefix argument. + ((progn + (setq key (isearch-reread-key-sequence-naturally keylist) + keylist (listify-key-sequence key) + main-event (aref key 0)) + (or (and isearch-allow-scroll + (setq scroll-command (isearch-lookup-scroll-key key))) + (and isearch-allow-prefix + (let (overriding-terminal-local-map) + (setq scroll-command (key-binding key)) + (memq scroll-command + '(universal-argument + negative-argument digit-argument)))))) ;; From this point onwards, KEY, KEYLIST and MAIN-EVENT hold a ;; complete key sequence, possibly as modified by function-key-map, ;; not merely the one or two event fragment which invoked ------------------------------------------------------------ revno: 112865 fixes bug: http://debbugs.gnu.org/14558 committer: Eli Zaretskii branch nick: trunk timestamp: Wed 2013-06-05 23:45:34 +0300 message: Fix bug #14558 with turning off mouse-highlight during highlight. src/xdisp.c (handle_tool_bar_click): When mouse-highlight is off, don't insist on being invoked on a highlighted tool-bar button. Avoids losing tool-bar functionality when mouse-highlight is nil. (note_tool_bar_highlight, note_mode_line_or_margin_highlight): Don't highlight when mouse-highlight is nil. (note_mouse_highlight): When mouse-highlight is nil, don't return right away; instead, run tool-bar and mode-line highlight subroutine, clear any existing highlight, and revert the mouse pointer to its default shape. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-06-05 18:10:27 +0000 +++ src/ChangeLog 2013-06-05 20:45:34 +0000 @@ -1,3 +1,15 @@ +2013-06-05 Eli Zaretskii + + * xdisp.c (handle_tool_bar_click): When mouse-highlight is off, + don't insist on being invoked on a highlighted tool-bar button. + Avoids losing tool-bar functionality when mouse-highlight is nil. + (note_tool_bar_highlight, note_mode_line_or_margin_highlight): + Don't highlight when mouse-highlight is nil. + (note_mouse_highlight): When mouse-highlight is nil, don't return + right away; instead, run tool-bar and mode-line highlight + subroutine, clear any existing highlight, and revert the mouse + pointer to its default shape. (Bug#14558) + 2013-06-05 Stefan Monnier * lisp.mk (lisp): Add prog-mode.el. === modified file 'src/xdisp.c' --- src/xdisp.c 2013-06-03 09:01:53 +0000 +++ src/xdisp.c 2013-06-05 20:45:34 +0000 @@ -12132,12 +12132,27 @@ int hpos, vpos, prop_idx; struct glyph *glyph; Lisp_Object enabled_p; + int ts; - /* If not on the highlighted tool-bar item, return. */ + /* If not on the highlighted tool-bar item, and mouse-highlight is + non-nil, return. This is so we generate the tool-bar button + click only when the mouse button is released on the same item as + where it was pressed. However, when mouse-highlight is disabled, + generate the click when the button is released regardless of the + highlight, since tool-bar items are not highlighted in that + case. */ frame_to_window_pixel_xy (w, &x, &y); - if (get_tool_bar_item (f, x, y, &glyph, &hpos, &vpos, &prop_idx) != 0) + ts = get_tool_bar_item (f, x, y, &glyph, &hpos, &vpos, &prop_idx); + if (ts == -1 + || (ts != 0 && !NILP (Vmouse_highlight))) return; + /* When mouse-highlight is off, generate the click for the item + where the button was pressed, disregarding where it was + released. */ + if (NILP (Vmouse_highlight) && !down_p) + prop_idx = last_tool_bar_item; + /* If item is disabled, do nothing. */ enabled_p = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_ENABLED_P); if (NILP (enabled_p)) @@ -12146,7 +12161,8 @@ if (down_p) { /* Show item in pressed state. */ - show_mouse_face (hlinfo, DRAW_IMAGE_SUNKEN); + if (!NILP (Vmouse_highlight)) + show_mouse_face (hlinfo, DRAW_IMAGE_SUNKEN); last_tool_bar_item = prop_idx; } else @@ -12156,7 +12172,8 @@ EVENT_INIT (event); /* Show item in released state. */ - show_mouse_face (hlinfo, DRAW_IMAGE_RAISED); + if (!NILP (Vmouse_highlight)) + show_mouse_face (hlinfo, DRAW_IMAGE_RAISED); key = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_KEY); @@ -12229,7 +12246,7 @@ /* If tool-bar item is not enabled, don't highlight it. */ enabled_p = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_ENABLED_P); - if (!NILP (enabled_p)) + if (!NILP (enabled_p) && !NILP (Vmouse_highlight)) { /* Compute the x-position of the glyph. In front and past the image is a space. We include this in the highlighted area. */ @@ -27399,7 +27416,7 @@ if (STRINGP (string)) { mouse_face = Fget_text_property (pos, Qmouse_face, string); - if (!NILP (mouse_face) + if (!NILP (Vmouse_highlight) && !NILP (mouse_face) && ((area == ON_MODE_LINE) || (area == ON_HEADER_LINE)) && glyph) { @@ -27558,8 +27575,7 @@ return; #endif - if (NILP (Vmouse_highlight) - || !f->glyphs_initialized_p + if (!f->glyphs_initialized_p || f->pointer_invisible) return; @@ -27649,7 +27665,8 @@ #ifdef HAVE_WINDOW_SYSTEM /* Look for :pointer property on image. */ - if (glyph != NULL && glyph->type == IMAGE_GLYPH) + if (!NILP (Vmouse_highlight) + && glyph != NULL && glyph->type == IMAGE_GLYPH) { struct image *img = IMAGE_FROM_ID (f, glyph->u.img_id); if (img != NULL && IMAGEP (img->spec)) @@ -27692,7 +27709,8 @@ #endif /* HAVE_WINDOW_SYSTEM */ /* Clear mouse face if X/Y not over text. */ - if (glyph == NULL + if (NILP (Vmouse_highlight) + || glyph == NULL || area != TEXT_AREA || !MATRIX_ROW_DISPLAYS_TEXT_P (MATRIX_ROW (w->current_matrix, vpos)) /* Glyph's OBJECT is an integer for glyphs inserted by the ------------------------------------------------------------ revno: 112864 committer: Stefan Monnier branch nick: trunk timestamp: Wed 2013-06-05 15:57:10 -0400 message: * lisp/autorevert.el (auto-revert-notify-handler): Use memq. Hide assertion failure. * lisp/skeleton.el: Use cl-lib. (skeleton-further-elements): Use defvar-local. (skeleton-insert): Use cl-progv. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-06-05 18:30:47 +0000 +++ lisp/ChangeLog 2013-06-05 19:57:10 +0000 @@ -1,3 +1,12 @@ +2013-06-05 Stefan Monnier + + * autorevert.el (auto-revert-notify-handler): Use memq. + Hide assertion failure. + + * skeleton.el: Use cl-lib. + (skeleton-further-elements): Use defvar-local. + (skeleton-insert): Use cl-progv. + 2013-06-05 Teodor Zlatanov * progmodes/prog-mode.el (prog-prettify-symbols) === modified file 'lisp/autorevert.el' --- lisp/autorevert.el 2013-06-03 13:03:05 +0000 +++ lisp/autorevert.el 2013-06-05 19:57:10 +0000 @@ -578,7 +578,7 @@ ((featurep 'w32notify) (nth 2 event))))) (defun auto-revert-notify-handler (event) - "Handle an event returned from file notification." + "Handle an EVENT returned from file notification." (when (auto-revert-notify-event-p event) (let* ((descriptor (auto-revert-notify-event-descriptor event)) (action (auto-revert-notify-event-action event)) @@ -591,10 +591,12 @@ (cl-assert descriptor) (cond ((featurep 'gfilenotify) - (cl-assert (or (eq 'attribute-changed action) - (eq 'changed action) - (eq 'created action) - (eq 'deleted action)))) + (cl-assert (memq action '(attribute-changed changed created deleted + ;; FIXME: I keep getting this action, so I + ;; added it here, but I have no idea what + ;; I'm doing. --Stef + changes-done-hint)) + t)) ((featurep 'inotify) (cl-assert (or (memq 'attrib action) (memq 'create action) === modified file 'lisp/skeleton.el' --- lisp/skeleton.el 2013-01-01 09:11:05 +0000 +++ lisp/skeleton.el 2013-06-05 19:57:10 +0000 @@ -31,6 +31,8 @@ ;;; Code: +(eval-when-compile (require 'cl-lib)) + ;; page 1: statement skeleton language definition & interpreter ;; page 2: paired insertion ;; page 3: mirror-mode, an example for setting up paired insertion @@ -84,13 +86,11 @@ "When non-nil, indent rigidly under current line for element `\\n'. Else use mode's `indent-line-function'.") -(defvar skeleton-further-elements () +(defvar-local skeleton-further-elements () "A buffer-local varlist (see `let') of mode specific skeleton elements. These variables are bound while interpreting a skeleton. Their value may in turn be any valid skeleton element if they are themselves to be used as skeleton elements.") -(make-variable-buffer-local 'skeleton-further-elements) - (defvar skeleton-subprompt (substitute-command-keys @@ -260,8 +260,10 @@ skeleton-modified skeleton-point resume: help input v1 v2) (setq skeleton-positions nil) (unwind-protect - (eval `(let ,skeleton-further-elements - (skeleton-internal-list skeleton str))) + (cl-progv + (mapcar #'car skeleton-further-elements) + (mapcar (lambda (x) (eval (cadr x))) skeleton-further-elements) + (skeleton-internal-list skeleton str)) (run-hooks 'skeleton-end-hook) (sit-for 0) (or (pos-visible-in-window-p beg) ------------------------------------------------------------ revno: 112863 committer: Ted Zlatanov branch nick: quickfixes timestamp: Wed 2013-06-05 14:31:48 -0400 message: Document new prog-mode symbol prettify support. diff: === modified file 'etc/ChangeLog' --- etc/ChangeLog 2013-06-03 06:34:21 +0000 +++ etc/ChangeLog 2013-06-05 18:31:48 +0000 @@ -1,3 +1,7 @@ +2013-06-05 Teodor Zlatanov + + * NEWS: Document new prog-mode symbol prettify support. + 2013-06-03 Tassilo Horn * NEWS: Document eshell visual subcommands and options. === modified file 'etc/NEWS' --- etc/NEWS 2013-06-05 01:58:43 +0000 +++ etc/NEWS 2013-06-05 18:31:48 +0000 @@ -2838,6 +2838,11 @@ modes, e.g. (add-hook 'prog-mode-hook 'flyspell-prog-mode) to enable on-the-fly spell checking for comments and strings. +**** New option, `prog-prettify-symbols' lets the user control symbol +prettify (replacing a string like "lambda" with the Greek lambda +character. The mode derived from `prog-mode' must call +`prog-prettify-install' with its own custom alist, which can be empty. + *** New hook `change-major-mode-after-body-hook', run by `run-mode-hooks' just before any other mode hooks. ------------------------------------------------------------ revno: 112862 committer: Ted Zlatanov branch nick: quickfixes timestamp: Wed 2013-06-05 14:30:47 -0400 message: (prog-prettify-symbols) (prog-prettify-install): Update docstrings. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-06-05 18:10:27 +0000 +++ lisp/ChangeLog 2013-06-05 18:30:47 +0000 @@ -1,3 +1,8 @@ +2013-06-05 Teodor Zlatanov + + * progmodes/prog-mode.el (prog-prettify-symbols) + (prog-prettify-install): Update docstrings. + 2013-06-05 Stefan Monnier * simple.el: Move all the prog-mode code to prog-mode.el. === modified file 'lisp/progmodes/prog-mode.el' --- lisp/progmodes/prog-mode.el 2013-06-05 18:10:27 +0000 +++ lisp/progmodes/prog-mode.el 2013-06-05 18:30:47 +0000 @@ -58,8 +58,8 @@ (defcustom prog-prettify-symbols nil "Whether symbols should be prettified. -When set to an alist in the form `(STRING . CHARACTER)' it will -augment the mode's native prettify alist." +When set to an alist in the form `((STRING . CHARACTER)...)' it +will augment the mode's native prettify alist." :type '(choice (const :tag "No thanks" nil) (const :tag "Mode defaults" t) @@ -96,6 +96,12 @@ (0 (prog--prettify-font-lock-compose-symbol ',alist))))))) (defun prog-prettify-install (alist) +"Install prog-mode support to prettify symbols according to ALIST. + +ALIST is in the format `((STRING . CHARACTER)...)' like +`prog-prettify-symbols'. + +Internally, `font-lock-add-keywords' is called." (setq-local prog-prettify-symbols-alist alist) (let ((keywords (prog-prettify-font-lock-symbols-keywords))) (if keywords (font-lock-add-keywords nil keywords)))) ------------------------------------------------------------ revno: 112861 committer: Stefan Monnier branch nick: trunk timestamp: Wed 2013-06-05 14:10:27 -0400 message: * lisp/simple.el: Move all the prog-mode code to prog-mode.el. * lisp/progmodes/prog-mode.el: New file. * lisp/loadup.el: * src/lisp.mk (lisp): Add prog-mode.el. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-06-05 17:48:50 +0000 +++ lisp/ChangeLog 2013-06-05 18:10:27 +0000 @@ -1,3 +1,9 @@ +2013-06-05 Stefan Monnier + + * simple.el: Move all the prog-mode code to prog-mode.el. + * progmodes/prog-mode.el: New file. + * loadup.el: Add prog-mode.el. + 2013-06-05 Teodor Zlatanov * simple.el (prog-prettify-symbols): Add version. === modified file 'lisp/loadup.el' --- lisp/loadup.el 2013-05-16 09:58:56 +0000 +++ lisp/loadup.el 2013-06-05 18:10:27 +0000 @@ -210,6 +210,7 @@ (load "textmodes/page") (load "register") (load "textmodes/paragraphs") +(load "progmodes/prog-mode") (load "emacs-lisp/lisp-mode") (load "textmodes/text-mode") (load "textmodes/fill") === added file 'lisp/progmodes/prog-mode.el' --- lisp/progmodes/prog-mode.el 1970-01-01 00:00:00 +0000 +++ lisp/progmodes/prog-mode.el 2013-06-05 18:10:27 +0000 @@ -0,0 +1,113 @@ +;;; prog-mode.el --- Generic major mode for programming -*- lexical-binding:t -*- + +;; Copyright (C) Free Software Foundation, Inc. + +;; Maintainer: FSF +;; Keywords: internal +;; Package: emacs + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; This major mode is mostly intended as a parent of other programming +;; modes. All major modes for programming languages should derive from this +;; mode so that users can put generic customization on prog-mode-hook. + +;;; Code: + +(eval-when-compile (require 'cl-lib)) + +(defgroup prog-mode nil + "Generic programming mode, from which others derive." + :group 'languages) + +(defvar prog-mode-map + (let ((map (make-sparse-keymap))) + (define-key map [?\C-\M-q] 'prog-indent-sexp) + map) + "Keymap used for programming modes.") + +(defun prog-indent-sexp (&optional defun) + "Indent the expression after point. +When interactively called with prefix, indent the enclosing defun +instead." + (interactive "P") + (save-excursion + (when defun + (end-of-line) + (beginning-of-defun)) + (let ((start (point)) + (end (progn (forward-sexp 1) (point)))) + (indent-region start end nil)))) + +(defvar prog-prettify-symbols-alist nil) + +(defcustom prog-prettify-symbols nil + "Whether symbols should be prettified. +When set to an alist in the form `(STRING . CHARACTER)' it will +augment the mode's native prettify alist." + :type '(choice + (const :tag "No thanks" nil) + (const :tag "Mode defaults" t) + (alist :tag "Mode defaults augmented with your own list" + :key-type string :value-type character)) + :version "24.4") + +(defun prog--prettify-font-lock-compose-symbol (alist) + "Compose a sequence of ascii chars into a symbol. +Regexp match data 0 points to the chars." + ;; Check that the chars should really be composed into a symbol. + (let* ((start (match-beginning 0)) + (end (match-end 0)) + (syntaxes (if (eq (char-syntax (char-after start)) ?w) + '(?w) '(?. ?\\)))) + (if (or (memq (char-syntax (or (char-before start) ?\ )) syntaxes) + (memq (char-syntax (or (char-after end) ?\ )) syntaxes) + (nth 8 (syntax-ppss))) + ;; No composition for you. Let's actually remove any composition + ;; we may have added earlier and which is now incorrect. + (remove-text-properties start end '(composition)) + ;; That's a symbol alright, so add the composition. + (compose-region start end (cdr (assoc (match-string 0) alist))))) + ;; Return nil because we're not adding any face property. + nil) + +(defun prog-prettify-font-lock-symbols-keywords () + (when prog-prettify-symbols + (let ((alist (append prog-prettify-symbols-alist + (if (listp prog-prettify-symbols) + prog-prettify-symbols + nil)))) + `((,(regexp-opt (mapcar 'car alist) t) + (0 (prog--prettify-font-lock-compose-symbol ',alist))))))) + +(defun prog-prettify-install (alist) + (setq-local prog-prettify-symbols-alist alist) + (let ((keywords (prog-prettify-font-lock-symbols-keywords))) + (if keywords (font-lock-add-keywords nil keywords)))) + +;;;###autoload +(define-derived-mode prog-mode fundamental-mode "Prog" + "Major mode for editing programming language source code." + (set (make-local-variable 'require-final-newline) mode-require-final-newline) + (set (make-local-variable 'parse-sexp-ignore-comments) t) + ;; Any programming language is always written left to right. + (setq bidi-paragraph-direction 'left-to-right)) + +(provide 'prog-mode) +;; arch-tag: 6f3ded02-6cc9-11d8-b018-000a95e675a6 +;;; prog-mode.el ends here === modified file 'lisp/simple.el' --- lisp/simple.el 2013-06-05 17:48:50 +0000 +++ lisp/simple.el 2013-06-05 18:10:27 +0000 @@ -372,81 +372,6 @@ "Parent major mode from which special major modes should inherit." (setq buffer-read-only t)) -;; Major mode meant to be the parent of programming modes. - -(defvar prog-mode-map - (let ((map (make-sparse-keymap))) - (define-key map [?\C-\M-q] 'prog-indent-sexp) - map) - "Keymap used for programming modes.") - -(defun prog-indent-sexp (&optional defun) - "Indent the expression after point. -When interactively called with prefix, indent the enclosing defun -instead." - (interactive "P") - (save-excursion - (when defun - (end-of-line) - (beginning-of-defun)) - (let ((start (point)) - (end (progn (forward-sexp 1) (point)))) - (indent-region start end nil)))) - -(define-derived-mode prog-mode fundamental-mode "Prog" - "Major mode for editing programming language source code." - (set (make-local-variable 'require-final-newline) mode-require-final-newline) - (set (make-local-variable 'parse-sexp-ignore-comments) t) - (make-local-variable 'prog-prettify-symbols-alist) - ;; Any programming language is always written left to right. - (setq bidi-paragraph-direction 'left-to-right)) - -(defvar prog-prettify-symbols-alist nil) - -(defcustom prog-prettify-symbols nil - "Whether symbols should be prettified. -When set to an alist in the form `(STRING . CHARACTER)' it will -augment the mode's native prettify alist." - :type '(choice - (const :tag "No thanks" nil) - (const :tag "Mode defaults" t) - (alist :tag "Mode defaults augmented with your own list" - :key-type string :value-type character)) - :version "24.4" - :group 'languages) - -(defun prog--prettify-font-lock-compose-symbol (alist) - "Compose a sequence of ascii chars into a symbol. -Regexp match data 0 points to the chars." - ;; Check that the chars should really be composed into a symbol. - (let* ((start (match-beginning 0)) - (end (match-end 0)) - (syntaxes (if (eq (char-syntax (char-after start)) ?w) - '(?w) '(?. ?\\)))) - (if (or (memq (char-syntax (or (char-before start) ?\ )) syntaxes) - (memq (char-syntax (or (char-after end) ?\ )) syntaxes) - (nth 8 (syntax-ppss))) - ;; No composition for you. Let's actually remove any composition - ;; we may have added earlier and which is now incorrect. - (remove-text-properties start end '(composition)) - ;; That's a symbol alright, so add the composition. - (compose-region start end (cdr (assoc (match-string 0) alist))))) - ;; Return nil because we're not adding any face property. - nil) - -(defun prog-prettify-font-lock-symbols-keywords () - (when prog-prettify-symbols - (let ((alist (append prog-prettify-symbols-alist - (if (listp prog-prettify-symbols) - prog-prettify-symbols - nil)))) - `((,(regexp-opt (mapcar 'car alist) t) - (0 (prog--prettify-font-lock-compose-symbol ',alist))))))) - -(defun prog-prettify-install (alist) - (setq-local prog-prettify-symbols-alist alist) - (font-lock-add-keywords nil (prog-prettify-font-lock-symbols-keywords))) - ;; Making and deleting lines. (defvar hard-newline (propertize "\n" 'hard t 'rear-nonsticky '(hard)) === modified file 'src/ChangeLog' --- src/ChangeLog 2013-06-05 17:04:13 +0000 +++ src/ChangeLog 2013-06-05 18:10:27 +0000 @@ -1,3 +1,7 @@ +2013-06-05 Stefan Monnier + + * lisp.mk (lisp): Add prog-mode.el. + 2013-06-05 Paul Eggert Chain glib's SIGCHLD handler from Emacs's (Bug#14474). === modified file 'src/lisp.mk' --- src/lisp.mk 2013-01-01 09:11:05 +0000 +++ src/lisp.mk 2013-06-05 18:10:27 +0000 @@ -129,6 +129,7 @@ $(lispsource)/textmodes/page.elc \ $(lispsource)/register.elc \ $(lispsource)/textmodes/paragraphs.elc \ + $(lispsource)/progmodes/prog-mode.elc \ $(lispsource)/emacs-lisp/lisp-mode.elc \ $(lispsource)/textmodes/text-mode.elc \ $(lispsource)/textmodes/fill.elc \ ------------------------------------------------------------ revno: 112860 committer: Ted Zlatanov branch nick: quickfixes timestamp: Wed 2013-06-05 13:48:50 -0400 message: Introduce and use prog-prettify-install. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-06-05 15:03:37 +0000 +++ lisp/ChangeLog 2013-06-05 17:48:50 +0000 @@ -1,5 +1,23 @@ 2013-06-05 Teodor Zlatanov + * simple.el (prog-prettify-symbols): Add version. + (prog-prettify-install): Add convenience function to prettify symbols. + + * progmodes/perl-mode.el (perl--augmented-font-lock-keywords) + (perl--augmented-font-lock-keywords-1) + (perl--augmented-font-lock-keywords-2, perl-mode): Remove unneeded + variables and use it. + + * progmodes/cfengine.el (cfengine3--augmented-font-lock-keywords) + (cfengine3-mode): Remove unneeded variable and use it. + + * emacs-lisp/lisp-mode.el (lisp--augmented-font-lock-keywords) + (lisp--augmented-font-lock-keywords-1) + (lisp--augmented-font-lock-keywords-2, lisp-mode-variables): + Remove unneeded variables and use it. + +2013-06-05 Teodor Zlatanov + * net/tls.el (open-tls-stream): Remove unneeded buffer contents up to point when opening the connection. Suggested by João Távora in === modified file 'lisp/emacs-lisp/lisp-mode.el' --- lisp/emacs-lisp/lisp-mode.el 2013-06-05 14:26:50 +0000 +++ lisp/emacs-lisp/lisp-mode.el 2013-06-05 17:48:50 +0000 @@ -187,11 +187,6 @@ font-lock-string-face)))) font-lock-comment-face)) -;; Temporary variables used to add font-lock keywords dynamically. -(defvar lisp--augmented-font-lock-keywords) -(defvar lisp--augmented-font-lock-keywords-1) -(defvar lisp--augmented-font-lock-keywords-2) - (defun lisp-mode-variables (&optional lisp-syntax keywords-case-insensitive) "Common initialization routine for lisp modes. The LISP-SYNTAX argument is used by code in inf-lisp.el and is @@ -228,20 +223,11 @@ (setq-local imenu-generic-expression lisp-imenu-generic-expression) (setq-local multibyte-syntax-as-symbol t) (setq-local syntax-begin-function 'beginning-of-defun) - (setq-local prog-prettify-symbols-alist lisp--prettify-symbols-alist) - (setq lisp--augmented-font-lock-keywords - (append lisp-font-lock-keywords - (prog-prettify-font-lock-symbols-keywords))) - (setq lisp--augmented-font-lock-keywords-1 - (append lisp-font-lock-keywords-1 - (prog-prettify-font-lock-symbols-keywords))) - (setq lisp--augmented-font-lock-keywords-2 - (append lisp-font-lock-keywords-2 - (prog-prettify-font-lock-symbols-keywords))) + (prog-prettify-install lisp--prettify-symbols-alist) (setq font-lock-defaults - `((lisp--augmented-font-lock-keywords - lisp--augmented-font-lock-keywords-1 - lisp--augmented-font-lock-keywords-2) + `((lisp-font-lock-keywords + lisp-font-lock-keywords-1 + lisp-font-lock-keywords-2) nil ,keywords-case-insensitive nil nil (font-lock-mark-block-function . mark-defun) (font-lock-syntactic-face-function === modified file 'lisp/progmodes/cfengine.el' --- lisp/progmodes/cfengine.el 2013-06-05 14:26:50 +0000 +++ lisp/progmodes/cfengine.el 2013-06-05 17:48:50 +0000 @@ -532,8 +532,6 @@ ("=>" . ?⇒) ("::" . ?∷))) -(defvar cfengine3--augmented-font-lock-keywords) - ;;;###autoload (define-derived-mode cfengine3-mode prog-mode "CFE3" "Major mode for editing CFEngine3 input. @@ -546,17 +544,10 @@ (set (make-local-variable 'indent-line-function) #'cfengine3-indent-line) - ;; Define the symbols to be prettified - (setq-local prog-prettify-symbols-alist cfengine3--prettify-symbols-alist) - - ;; Tell font-lock.el how to handle cfengine3 keywords.. - (setq cfengine3--augmented-font-lock-keywords - (append cfengine3-font-lock-keywords - (prog-prettify-font-lock-symbols-keywords))) - (setq font-lock-defaults - '(cfengine3--augmented-font-lock-keywords + '(cfengine3-font-lock-keywords nil nil nil beginning-of-defun)) + (prog-prettify-install cfengine3--prettify-symbols-alist) ;; Use defuns as the essential syntax block. (set (make-local-variable 'beginning-of-defun-function) === modified file 'lisp/progmodes/perl-mode.el' --- lisp/progmodes/perl-mode.el 2013-06-05 14:26:50 +0000 +++ lisp/progmodes/perl-mode.el 2013-06-05 17:48:50 +0000 @@ -215,11 +215,6 @@ (defvar perl-font-lock-keywords perl-font-lock-keywords-1 "Default expressions to highlight in Perl mode.") -;; Temporary variables used to add font-lock keywords dynamically. -(defvar perl--augmented-font-lock-keywords) -(defvar perl--augmented-font-lock-keywords-1) -(defvar perl--augmented-font-lock-keywords-2) - (defvar perl-quote-like-pairs '((?\( . ?\)) (?\[ . ?\]) (?\{ . ?\}) (?\< . ?\>))) @@ -656,26 +651,14 @@ (setq-local comment-indent-function #'perl-comment-indent) (setq-local parse-sexp-ignore-comments t) - ;; Define the symbols to be prettified. - (setq-local prog-prettify-symbols-alist perl--prettify-symbols-alist) - ;; Tell font-lock.el how to handle Perl. - (setq perl--augmented-font-lock-keywords - (append perl-font-lock-keywords - (prog-prettify-font-lock-symbols-keywords))) - (setq perl--augmented-font-lock-keywords-1 - (append perl-font-lock-keywords-1 - (prog-prettify-font-lock-symbols-keywords))) - (setq perl--augmented-font-lock-keywords-2 - (append perl-font-lock-keywords-2 - (prog-prettify-font-lock-symbols-keywords))) - - (setq font-lock-defaults '((perl--augmented-font-lock-keywords - perl--augmented-font-lock-keywords-1 - perl--augmented-font-lock-keywords-2) + (setq font-lock-defaults '((perl-font-lock-keywords + perl-font-lock-keywords-1 + perl-font-lock-keywords-2) nil nil ((?\_ . "w")) nil (font-lock-syntactic-face-function . perl-font-lock-syntactic-face-function))) + (prog-prettify-install perl--prettify-symbols-alist) (setq-local syntax-propertize-function #'perl-syntax-propertize-function) (add-hook 'syntax-propertize-extend-region-functions #'syntax-propertize-multiline 'append 'local) === modified file 'lisp/simple.el' --- lisp/simple.el 2013-06-05 14:26:50 +0000 +++ lisp/simple.el 2013-06-05 17:48:50 +0000 @@ -412,6 +412,7 @@ (const :tag "Mode defaults" t) (alist :tag "Mode defaults augmented with your own list" :key-type string :value-type character)) + :version "24.4" :group 'languages) (defun prog--prettify-font-lock-compose-symbol (alist) @@ -442,6 +443,10 @@ `((,(regexp-opt (mapcar 'car alist) t) (0 (prog--prettify-font-lock-compose-symbol ',alist))))))) +(defun prog-prettify-install (alist) + (setq-local prog-prettify-symbols-alist alist) + (font-lock-add-keywords nil (prog-prettify-font-lock-symbols-keywords))) + ;; Making and deleting lines. (defvar hard-newline (propertize "\n" 'hard t 'rear-nonsticky '(hard)) ------------------------------------------------------------ revno: 112859 committer: Paul Eggert branch nick: trunk timestamp: Wed 2013-06-05 10:04:13 -0700 message: Chain glib's SIGCHLD handler from Emacs's (Bug#14474). * process.c (dummy_handler): New function. (lib_child_handler): New static var. (handle_child_signal): Invoke it. (catch_child_signal): If a library has set up a signal handler, save it into lib_child_handler. (init_process_emacs): If using glib and not on Windows, tickle glib's child-handling code so that it initializes its private SIGCHLD handler. * syssignal.h (SA_SIGINFO): Default to 0. * xterm.c (x_term_init): Remove D-bus hack that I installed on May 31; it should no longer be needed now. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-06-05 12:17:02 +0000 +++ src/ChangeLog 2013-06-05 17:04:13 +0000 @@ -1,3 +1,17 @@ +2013-06-05 Paul Eggert + + Chain glib's SIGCHLD handler from Emacs's (Bug#14474). + * process.c (dummy_handler): New function. + (lib_child_handler): New static var. + (handle_child_signal): Invoke it. + (catch_child_signal): If a library has set up a signal handler, + save it into lib_child_handler. + (init_process_emacs): If using glib and not on Windows, tickle glib's + child-handling code so that it initializes its private SIGCHLD handler. + * syssignal.h (SA_SIGINFO): Default to 0. + * xterm.c (x_term_init): Remove D-bus hack that I installed on May + 31; it should no longer be needed now. + 2013-06-05 Michael Albinus * emacs.c (main) [HAVE_GFILENOTIFY]: Call globals_of_gfilenotify. === modified file 'src/process.c' --- src/process.c 2013-06-03 18:47:35 +0000 +++ src/process.c 2013-06-05 17:04:13 +0000 @@ -6100,6 +6100,12 @@ might inadvertently reap a GTK-created process that happened to have the same process ID. */ +/* LIB_CHILD_HANDLER is a SIGCHLD handler that Emacs calls while doing + its own SIGCHLD handling. On POSIXish systems, glib needs this to + keep track of its own children. The default handler does nothing. */ +static void dummy_handler (int sig) {} +static signal_handler_t volatile lib_child_handler = dummy_handler; + /* Handle a SIGCHLD signal by looking for known child processes of Emacs whose status have changed. For each one found, record its new status. @@ -6184,6 +6190,8 @@ } } } + + lib_child_handler (sig); } static void @@ -7035,9 +7043,13 @@ void catch_child_signal (void) { - struct sigaction action; + struct sigaction action, old_action; emacs_sigaction_init (&action, deliver_child_signal); - sigaction (SIGCHLD, &action, 0); + sigaction (SIGCHLD, &action, &old_action); + eassert (! (old_action.sa_flags & SA_SIGINFO)); + if (old_action.sa_handler != SIG_DFL && old_action.sa_handler != SIG_IGN + && old_action.sa_handler != deliver_child_signal) + lib_child_handler = old_action.sa_handler; } @@ -7055,6 +7067,11 @@ if (! noninteractive || initialized) #endif { +#if defined HAVE_GLIB && !defined WINDOWSNT + /* Tickle glib's child-handling code so that it initializes its + private SIGCHLD handler. */ + g_source_unref (g_child_watch_source_new (0)); +#endif catch_child_signal (); } === modified file 'src/syssignal.h' --- src/syssignal.h 2013-01-02 16:13:04 +0000 +++ src/syssignal.h 2013-06-05 17:04:13 +0000 @@ -50,6 +50,10 @@ # define NSIG NSIG_MINIMUM #endif +#ifndef SA_SIGINFO +# define SA_SIGINFO 0 +#endif + #ifndef emacs_raise # define emacs_raise(sig) raise (sig) #endif === modified file 'src/xterm.c' --- src/xterm.c 2013-05-31 01:41:52 +0000 +++ src/xterm.c 2013-06-05 17:04:13 +0000 @@ -9897,13 +9897,6 @@ XSetLocaleModifiers (""); - /* If D-Bus is not already configured, inhibit D-Bus autolaunch, - as autolaunch can mess up Emacs's SIGCHLD handler. - FIXME: Rewrite subprocess handlers to use glib's child watchers. - See Bug#14474. */ - if (! egetenv ("DBUS_SESSION_BUS_ADDRESS")) - xputenv ("DBUS_SESSION_BUS_ADDRESS=unix:path=/dev/null"); - /* Emacs can only handle core input events, so make sure Gtk doesn't use Xinput or Xinput2 extensions. */ xputenv ("GDK_CORE_DEVICE_EVENTS=1"); ------------------------------------------------------------ revno: 112858 committer: Ted Zlatanov branch nick: quickfixes timestamp: Wed 2013-06-05 11:03:37 -0400 message: (open-tls-stream): Remove unneeded buffer contents when opening the connection. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-06-05 14:57:45 +0000 +++ lisp/ChangeLog 2013-06-05 15:03:37 +0000 @@ -1,3 +1,10 @@ +2013-06-05 Teodor Zlatanov + + * net/tls.el (open-tls-stream): Remove unneeded buffer contents up + to point when opening the connection. + Suggested by João Távora in + . + 2013-06-05 Stefan Monnier * subr.el (load-history-regexp, load-history-filename-element) === modified file 'lisp/net/tls.el' --- lisp/net/tls.el 2013-01-02 16:13:04 +0000 +++ lisp/net/tls.el 2013-06-05 15:03:37 +0000 @@ -286,7 +286,10 @@ (format "Host name in certificate doesn't \ match `%s'. Connect anyway? " host)))))) (setq done nil) - (delete-process process))) + (delete-process process)) + ;; Delete all the informational messages that could confuse + ;; future uses of `buffer'. + (delete-region (point-min) (point))) (message "Opening TLS connection to `%s'...%s" host (if done "done" "failed")) (when use-temp-buffer ------------------------------------------------------------ revno: 112857 committer: Stefan Monnier branch nick: trunk timestamp: Wed 2013-06-05 10:57:45 -0400 message: * lisp/emacs-lisp/edebug.el (edebug-result): Move before first use. * lisp/subr.el (load-history-regexp, load-history-filename-element) (eval-after-load, after-load-functions, do-after-load-evaluation) (eval-next-after-load, display-delayed-warnings) (collapse-delayed-warnings, delayed-warnings-hook): Move after the definition of save-match-data. (overriding-local-map): Remove accidental obsolescence declaration. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-06-05 14:26:50 +0000 +++ lisp/ChangeLog 2013-06-05 14:57:45 +0000 @@ -1,3 +1,14 @@ +2013-06-05 Stefan Monnier + + * subr.el (load-history-regexp, load-history-filename-element) + (eval-after-load, after-load-functions, do-after-load-evaluation) + (eval-next-after-load, display-delayed-warnings) + (collapse-delayed-warnings, delayed-warnings-hook): Move after the + definition of save-match-data. + (overriding-local-map): Remove accidental obsolescence declaration. + + * emacs-lisp/edebug.el (edebug-result): Move before first use. + 2013-06-05 Teodor Zlatanov Generalize symbol prettify support to prog-mode and implement it @@ -11,8 +22,8 @@ (lisp--augmented-font-lock-keywords-2, lisp-mode-variables) (lisp--prettify-symbols-alist): Implement prettify of lambda. * progmodes/cfengine.el (cfengine3--augmented-font-lock-keywords) - (cfengine3--prettify-symbols-alist, cfengine3-mode): Implement - prettify of -> => :: strings. + (cfengine3--prettify-symbols-alist, cfengine3-mode): + Implement prettify of -> => :: strings. * progmodes/perl-mode.el (perl-prettify-symbols) (perl--font-lock-compose-symbol) (perl--font-lock-symbols-keywords): Move to prog-mode. @@ -21,8 +32,8 @@ (perl-font-lock-keywords-2): Remove explicit prettify support. (perl--augmented-font-lock-keywords) (perl--augmented-font-lock-keywords-1) - (perl--augmented-font-lock-keywords-2, perl-mode): Implement - prettify support. + (perl--augmented-font-lock-keywords-2, perl-mode): + Implement prettify support. 2013-06-05 Leo Liu @@ -109,7 +120,7 @@ * subr.el: (file-notify-handle-event): New defun. Replacing ... (inotify-event-p, inotify-handle-event, w32notify-handle-event): - Removed. + Remove. 2013-06-03 Juri Linkov @@ -135,8 +146,8 @@ 2013-06-03 Tassilo Horn - * eshell/em-term.el (eshell-term-initialize): Use - `cl-intersection' rather than `intersection'. + * eshell/em-term.el (eshell-term-initialize): + Use `cl-intersection' rather than `intersection'. 2013-06-02 Xue Fuqiao @@ -190,7 +201,7 @@ (eieiomt-optimizing-obarray, eieiomt-install) (eieiomt-add, eieiomt-next, eieiomt-sym-optimize) (eieio-generic-form, eieio-defmethod, make-obsolete) - (eieio-defgeneric, make-obsolete): Moved to eieio-core.el + (eieio-defgeneric, make-obsolete): Move to eieio-core.el (defclass): Remove `eval-and-compile' from macro. (call-next-method, shared-initialize): Instead of using `scoped-class' variable, use new eieio--scoped-class, and @@ -282,8 +293,8 @@ 2013-05-31 Dmitry Gutov - * progmodes/ruby-mode.el (ruby-syntax-expansion-allowed-p): New - function, checks if point is inside a literal that allows + * progmodes/ruby-mode.el (ruby-syntax-expansion-allowed-p): + New function, checks if point is inside a literal that allows expression expansion. (ruby-syntax-propertize-expansion): Use it. (ruby-syntax-propertize-function): Bind `case-fold-search' to nil @@ -394,7 +405,7 @@ * emacs-lisp/trace.el (trace--read-args): Provide a default. * emacs-lisp/lisp-mode.el (lisp-mode-shared-map): Inherit from - prog-mode-map. + prog-mode-map (bug#14504). 2013-05-29 Leo Liu @@ -426,7 +437,7 @@ 2013-05-28 Aidan Gauland - * eshell/em-unix.el: Added -r option to cp + * eshell/em-unix.el: Add -r option to cp. 2013-05-28 Glenn Morris @@ -2178,9 +2189,9 @@ 2013-04-19 Masatake YAMATO * progmodes/sh-script.el (sh-imenu-generic-expression): - Handle function names with a single character. (Bug#14111) + Handle function names with a single character. (Bug#14111) -2013-04-19 Dima Kogan (tiny change) +2013-04-19 Dima Kogan (tiny change) * progmodes/gud.el (gud-perldb-marker-filter): Understand position info for subroutines defined in an eval (bug#14182). @@ -2595,6 +2606,7 @@ * emacs-lisp/package.el (package-pinned-packages): New var. (package--add-to-archive-contents): Obey it (bug#14118). + 2013-04-03 Alan Mackenzie Handle `parse-partial-sexp' landing inside a comment opener (Bug#13244). @@ -3234,7 +3246,7 @@ 2013-03-08 Jambunathan K * hi-lock.el (hi-lock-read-regexp-defaults-function): New var. - (hi-lock-read-regexp-defaults): New defun. + (hi-lock-read-regexp-defaults): New defun. (hi-lock-line-face-buffer, hi-lock-face-buffer) (hi-lock-face-phrase-buffer): Propagate above change. Update docstring (bug#13892). === modified file 'lisp/emacs-lisp/edebug.el' --- lisp/emacs-lisp/edebug.el 2013-04-08 02:21:59 +0000 +++ lisp/emacs-lisp/edebug.el 2013-06-05 14:57:45 +0000 @@ -472,6 +472,8 @@ (or (fboundp 'edebug-original-eval-defun) (defalias 'edebug-original-eval-defun (symbol-function 'eval-defun))) +(defvar edebug-result) ; The result of the function call returned by body. + ;; We should somehow arrange to be able to do this ;; without actually replacing the eval-defun command. (defun edebug-eval-defun (edebug-it) @@ -487,7 +489,7 @@ Setting option `edebug-all-defs' to a non-nil value reverses the meaning of the prefix argument. Code is then instrumented when this function is -invoked without a prefix argument +invoked without a prefix argument. If acting on a `defun' for FUNCTION, and the function was instrumented, `Edebug: FUNCTION' is printed in the minibuffer. If not instrumented, @@ -2106,7 +2108,6 @@ (defvar edebug-coverage) ; the coverage results of each expression of function. (defvar edebug-buffer) ; which buffer the function is in. -(defvar edebug-result) ; the result of the function call returned by body (defvar edebug-outside-executing-macro) (defvar edebug-outside-defining-kbd-macro) === modified file 'lisp/subr.el' --- lisp/subr.el 2013-06-05 01:58:43 +0000 +++ lisp/subr.el 2013-06-05 14:57:45 +0000 @@ -1261,8 +1261,6 @@ (make-obsolete-variable 'redisplay-end-trigger-functions 'jit-lock-register "23.1") (make-obsolete-variable 'deferred-action-list 'post-command-hook "24.1") (make-obsolete-variable 'deferred-action-function 'post-command-hook "24.1") -(make-obsolete-variable 'overriding-local-map - 'overriding-terminal-local-map "24.4" 'set) (make-obsolete 'window-redisplay-end-trigger nil "23.1") (make-obsolete 'set-window-redisplay-end-trigger nil "23.1") @@ -1749,7 +1747,7 @@ (nconc found (list (cons toggle keymap)) rest)) (push (cons toggle keymap) minor-mode-map-alist))))))) -;;; Load history +;;;; Load history (defsubst autoloadp (object) "Non-nil if OBJECT is an autoload." @@ -1832,173 +1830,6 @@ file)) -;;;; Specifying things to do later. - -(defun load-history-regexp (file) - "Form a regexp to find FILE in `load-history'. -FILE, a string, is described in the function `eval-after-load'." - (if (file-name-absolute-p file) - (setq file (file-truename file))) - (concat (if (file-name-absolute-p file) "\\`" "\\(\\`\\|/\\)") - (regexp-quote file) - (if (file-name-extension file) - "" - ;; Note: regexp-opt can't be used here, since we need to call - ;; this before Emacs has been fully started. 2006-05-21 - (concat "\\(" (mapconcat 'regexp-quote load-suffixes "\\|") "\\)?")) - "\\(" (mapconcat 'regexp-quote jka-compr-load-suffixes "\\|") - "\\)?\\'")) - -(defun load-history-filename-element (file-regexp) - "Get the first elt of `load-history' whose car matches FILE-REGEXP. -Return nil if there isn't one." - (let* ((loads load-history) - (load-elt (and loads (car loads)))) - (save-match-data - (while (and loads - (or (null (car load-elt)) - (not (string-match file-regexp (car load-elt))))) - (setq loads (cdr loads) - load-elt (and loads (car loads))))) - load-elt)) - -(put 'eval-after-load 'lisp-indent-function 1) -(defun eval-after-load (file form) - "Arrange that if FILE is loaded, FORM will be run immediately afterwards. -If FILE is already loaded, evaluate FORM right now. - -If a matching file is loaded again, FORM will be evaluated again. - -If FILE is a string, it may be either an absolute or a relative file -name, and may have an extension \(e.g. \".el\") or may lack one, and -additionally may or may not have an extension denoting a compressed -format \(e.g. \".gz\"). - -When FILE is absolute, this first converts it to a true name by chasing -symbolic links. Only a file of this name \(see next paragraph regarding -extensions) will trigger the evaluation of FORM. When FILE is relative, -a file whose absolute true name ends in FILE will trigger evaluation. - -When FILE lacks an extension, a file name with any extension will trigger -evaluation. Otherwise, its extension must match FILE's. A further -extension for a compressed format \(e.g. \".gz\") on FILE will not affect -this name matching. - -Alternatively, FILE can be a feature (i.e. a symbol), in which case FORM -is evaluated at the end of any file that `provide's this feature. -If the feature is provided when evaluating code not associated with a -file, FORM is evaluated immediately after the provide statement. - -Usually FILE is just a library name like \"font-lock\" or a feature name -like 'font-lock. - -This function makes or adds to an entry on `after-load-alist'." - ;; Add this FORM into after-load-alist (regardless of whether we'll be - ;; evaluating it now). - (let* ((regexp-or-feature - (if (stringp file) - (setq file (purecopy (load-history-regexp file))) - file)) - (elt (assoc regexp-or-feature after-load-alist))) - (unless elt - (setq elt (list regexp-or-feature)) - (push elt after-load-alist)) - ;; Make sure `form' is evalled in the current lexical/dynamic code. - (setq form `(funcall ',(eval `(lambda () ,form) lexical-binding))) - ;; Is there an already loaded file whose name (or `provide' name) - ;; matches FILE? - (prog1 (if (if (stringp file) - (load-history-filename-element regexp-or-feature) - (featurep file)) - (eval form)) - (when (symbolp regexp-or-feature) - ;; For features, the after-load-alist elements get run when `provide' is - ;; called rather than at the end of the file. So add an indirection to - ;; make sure that `form' is really run "after-load" in case the provide - ;; call happens early. - (setq form - `(if load-file-name - (let ((fun (make-symbol "eval-after-load-helper"))) - (fset fun `(lambda (file) - (if (not (equal file ',load-file-name)) - nil - (remove-hook 'after-load-functions ',fun) - ,',form))) - (add-hook 'after-load-functions fun)) - ;; Not being provided from a file, run form right now. - ,form))) - ;; Add FORM to the element unless it's already there. - (unless (member form (cdr elt)) - (nconc elt (list form)))))) - -(defvar after-load-functions nil - "Special hook run after loading a file. -Each function there is called with a single argument, the absolute -name of the file just loaded.") - -(defun do-after-load-evaluation (abs-file) - "Evaluate all `eval-after-load' forms, if any, for ABS-FILE. -ABS-FILE, a string, should be the absolute true name of a file just loaded. -This function is called directly from the C code." - ;; Run the relevant eval-after-load forms. - (mapc #'(lambda (a-l-element) - (when (and (stringp (car a-l-element)) - (string-match-p (car a-l-element) abs-file)) - ;; discard the file name regexp - (mapc #'eval (cdr a-l-element)))) - after-load-alist) - ;; Complain when the user uses obsolete files. - (when (string-match-p "/obsolete/[^/]*\\'" abs-file) - (run-with-timer 0 nil - (lambda (file) - (message "Package %s is obsolete!" - (substring file 0 - (string-match "\\.elc?\\>" file)))) - (file-name-nondirectory abs-file))) - ;; Finally, run any other hook. - (run-hook-with-args 'after-load-functions abs-file)) - -(defun eval-next-after-load (file) - "Read the following input sexp, and run it whenever FILE is loaded. -This makes or adds to an entry on `after-load-alist'. -FILE should be the name of a library, with no directory name." - (declare (obsolete eval-after-load "23.2")) - (eval-after-load file (read))) - -(defun display-delayed-warnings () - "Display delayed warnings from `delayed-warnings-list'. -Used from `delayed-warnings-hook' (which see)." - (dolist (warning (nreverse delayed-warnings-list)) - (apply 'display-warning warning)) - (setq delayed-warnings-list nil)) - -(defun collapse-delayed-warnings () - "Remove duplicates from `delayed-warnings-list'. -Collapse identical adjacent warnings into one (plus count). -Used from `delayed-warnings-hook' (which see)." - (let ((count 1) - collapsed warning) - (while delayed-warnings-list - (setq warning (pop delayed-warnings-list)) - (if (equal warning (car delayed-warnings-list)) - (setq count (1+ count)) - (when (> count 1) - (setcdr warning (cons (format "%s [%d times]" (cadr warning) count) - (cddr warning))) - (setq count 1)) - (push warning collapsed))) - (setq delayed-warnings-list (nreverse collapsed)))) - -;; At present this is only used for Emacs internals. -;; Ref http://lists.gnu.org/archive/html/emacs-devel/2012-02/msg00085.html -(defvar delayed-warnings-hook '(collapse-delayed-warnings - display-delayed-warnings) - "Normal hook run to process and display delayed warnings. -By default, this hook contains functions to consolidate the -warnings listed in `delayed-warnings-list', display them, and set -`delayed-warnings-list' back to nil.") - - ;;;; Process stuff. (defun process-lines (program &rest args) @@ -3864,6 +3695,173 @@ (concat str (propertize (string ?\x200e) 'invisible t)) str)) +;;;; Specifying things to do later. + +(defun load-history-regexp (file) + "Form a regexp to find FILE in `load-history'. +FILE, a string, is described in the function `eval-after-load'." + (if (file-name-absolute-p file) + (setq file (file-truename file))) + (concat (if (file-name-absolute-p file) "\\`" "\\(\\`\\|/\\)") + (regexp-quote file) + (if (file-name-extension file) + "" + ;; Note: regexp-opt can't be used here, since we need to call + ;; this before Emacs has been fully started. 2006-05-21 + (concat "\\(" (mapconcat 'regexp-quote load-suffixes "\\|") "\\)?")) + "\\(" (mapconcat 'regexp-quote jka-compr-load-suffixes "\\|") + "\\)?\\'")) + +(defun load-history-filename-element (file-regexp) + "Get the first elt of `load-history' whose car matches FILE-REGEXP. +Return nil if there isn't one." + (let* ((loads load-history) + (load-elt (and loads (car loads)))) + (save-match-data + (while (and loads + (or (null (car load-elt)) + (not (string-match file-regexp (car load-elt))))) + (setq loads (cdr loads) + load-elt (and loads (car loads))))) + load-elt)) + +(put 'eval-after-load 'lisp-indent-function 1) +(defun eval-after-load (file form) + "Arrange that if FILE is loaded, FORM will be run immediately afterwards. +If FILE is already loaded, evaluate FORM right now. + +If a matching file is loaded again, FORM will be evaluated again. + +If FILE is a string, it may be either an absolute or a relative file +name, and may have an extension \(e.g. \".el\") or may lack one, and +additionally may or may not have an extension denoting a compressed +format \(e.g. \".gz\"). + +When FILE is absolute, this first converts it to a true name by chasing +symbolic links. Only a file of this name \(see next paragraph regarding +extensions) will trigger the evaluation of FORM. When FILE is relative, +a file whose absolute true name ends in FILE will trigger evaluation. + +When FILE lacks an extension, a file name with any extension will trigger +evaluation. Otherwise, its extension must match FILE's. A further +extension for a compressed format \(e.g. \".gz\") on FILE will not affect +this name matching. + +Alternatively, FILE can be a feature (i.e. a symbol), in which case FORM +is evaluated at the end of any file that `provide's this feature. +If the feature is provided when evaluating code not associated with a +file, FORM is evaluated immediately after the provide statement. + +Usually FILE is just a library name like \"font-lock\" or a feature name +like 'font-lock. + +This function makes or adds to an entry on `after-load-alist'." + ;; Add this FORM into after-load-alist (regardless of whether we'll be + ;; evaluating it now). + (let* ((regexp-or-feature + (if (stringp file) + (setq file (purecopy (load-history-regexp file))) + file)) + (elt (assoc regexp-or-feature after-load-alist))) + (unless elt + (setq elt (list regexp-or-feature)) + (push elt after-load-alist)) + ;; Make sure `form' is evalled in the current lexical/dynamic code. + (setq form `(funcall ',(eval `(lambda () ,form) lexical-binding))) + ;; Is there an already loaded file whose name (or `provide' name) + ;; matches FILE? + (prog1 (if (if (stringp file) + (load-history-filename-element regexp-or-feature) + (featurep file)) + (eval form)) + (when (symbolp regexp-or-feature) + ;; For features, the after-load-alist elements get run when `provide' is + ;; called rather than at the end of the file. So add an indirection to + ;; make sure that `form' is really run "after-load" in case the provide + ;; call happens early. + (setq form + `(if load-file-name + (let ((fun (make-symbol "eval-after-load-helper"))) + (fset fun `(lambda (file) + (if (not (equal file ',load-file-name)) + nil + (remove-hook 'after-load-functions ',fun) + ,',form))) + (add-hook 'after-load-functions fun)) + ;; Not being provided from a file, run form right now. + ,form))) + ;; Add FORM to the element unless it's already there. + (unless (member form (cdr elt)) + (nconc elt (list form)))))) + +(defvar after-load-functions nil + "Special hook run after loading a file. +Each function there is called with a single argument, the absolute +name of the file just loaded.") + +(defun do-after-load-evaluation (abs-file) + "Evaluate all `eval-after-load' forms, if any, for ABS-FILE. +ABS-FILE, a string, should be the absolute true name of a file just loaded. +This function is called directly from the C code." + ;; Run the relevant eval-after-load forms. + (mapc #'(lambda (a-l-element) + (when (and (stringp (car a-l-element)) + (string-match-p (car a-l-element) abs-file)) + ;; discard the file name regexp + (mapc #'eval (cdr a-l-element)))) + after-load-alist) + ;; Complain when the user uses obsolete files. + (when (string-match-p "/obsolete/[^/]*\\'" abs-file) + (run-with-timer 0 nil + (lambda (file) + (message "Package %s is obsolete!" + (substring file 0 + (string-match "\\.elc?\\>" file)))) + (file-name-nondirectory abs-file))) + ;; Finally, run any other hook. + (run-hook-with-args 'after-load-functions abs-file)) + +(defun eval-next-after-load (file) + "Read the following input sexp, and run it whenever FILE is loaded. +This makes or adds to an entry on `after-load-alist'. +FILE should be the name of a library, with no directory name." + (declare (obsolete eval-after-load "23.2")) + (eval-after-load file (read))) + +(defun display-delayed-warnings () + "Display delayed warnings from `delayed-warnings-list'. +Used from `delayed-warnings-hook' (which see)." + (dolist (warning (nreverse delayed-warnings-list)) + (apply 'display-warning warning)) + (setq delayed-warnings-list nil)) + +(defun collapse-delayed-warnings () + "Remove duplicates from `delayed-warnings-list'. +Collapse identical adjacent warnings into one (plus count). +Used from `delayed-warnings-hook' (which see)." + (let ((count 1) + collapsed warning) + (while delayed-warnings-list + (setq warning (pop delayed-warnings-list)) + (if (equal warning (car delayed-warnings-list)) + (setq count (1+ count)) + (when (> count 1) + (setcdr warning (cons (format "%s [%d times]" (cadr warning) count) + (cddr warning))) + (setq count 1)) + (push warning collapsed))) + (setq delayed-warnings-list (nreverse collapsed)))) + +;; At present this is only used for Emacs internals. +;; Ref http://lists.gnu.org/archive/html/emacs-devel/2012-02/msg00085.html +(defvar delayed-warnings-hook '(collapse-delayed-warnings + display-delayed-warnings) + "Normal hook run to process and display delayed warnings. +By default, this hook contains functions to consolidate the +warnings listed in `delayed-warnings-list', display them, and set +`delayed-warnings-list' back to nil.") + + ;;;; invisibility specs (defun add-to-invisibility-spec (element) ------------------------------------------------------------ revno: 112856 committer: Ted Zlatanov branch nick: quickfixes timestamp: Wed 2013-06-05 10:26:50 -0400 message: Symbol prettify in prog-mode; added to perl-mode, cfengine3-mode, and emacs-lisp-mode. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-06-05 12:45:51 +0000 +++ lisp/ChangeLog 2013-06-05 14:26:50 +0000 @@ -1,3 +1,29 @@ +2013-06-05 Teodor Zlatanov + + Generalize symbol prettify support to prog-mode and implement it + for perl-mode, cfengine3-mode, and emacs-lisp-mode. + * simple.el (prog-prettify-symbols-alist, prog-prettify-symbols) + (prog--prettify-font-lock-compose-symbol) + (prog-prettify-font-lock-symbols-keywords): New variables and + functions to support symbol prettification. + * emacs-lisp/lisp-mode.el (lisp--augmented-font-lock-keywords) + (lisp--augmented-font-lock-keywords-1) + (lisp--augmented-font-lock-keywords-2, lisp-mode-variables) + (lisp--prettify-symbols-alist): Implement prettify of lambda. + * progmodes/cfengine.el (cfengine3--augmented-font-lock-keywords) + (cfengine3--prettify-symbols-alist, cfengine3-mode): Implement + prettify of -> => :: strings. + * progmodes/perl-mode.el (perl-prettify-symbols) + (perl--font-lock-compose-symbol) + (perl--font-lock-symbols-keywords): Move to prog-mode. + (perl--prettify-symbols-alist): Prettify -> => :: strings. + (perl-font-lock-keywords-1) + (perl-font-lock-keywords-2): Remove explicit prettify support. + (perl--augmented-font-lock-keywords) + (perl--augmented-font-lock-keywords-1) + (perl--augmented-font-lock-keywords-2, perl-mode): Implement + prettify support. + 2013-06-05 Leo Liu Re-implement smie matching block highlight using === modified file 'lisp/emacs-lisp/lisp-mode.el' --- lisp/emacs-lisp/lisp-mode.el 2013-06-03 15:28:10 +0000 +++ lisp/emacs-lisp/lisp-mode.el 2013-06-05 14:26:50 +0000 @@ -187,6 +187,11 @@ font-lock-string-face)))) font-lock-comment-face)) +;; Temporary variables used to add font-lock keywords dynamically. +(defvar lisp--augmented-font-lock-keywords) +(defvar lisp--augmented-font-lock-keywords-1) +(defvar lisp--augmented-font-lock-keywords-2) + (defun lisp-mode-variables (&optional lisp-syntax keywords-case-insensitive) "Common initialization routine for lisp modes. The LISP-SYNTAX argument is used by code in inf-lisp.el and is @@ -223,9 +228,20 @@ (setq-local imenu-generic-expression lisp-imenu-generic-expression) (setq-local multibyte-syntax-as-symbol t) (setq-local syntax-begin-function 'beginning-of-defun) + (setq-local prog-prettify-symbols-alist lisp--prettify-symbols-alist) + (setq lisp--augmented-font-lock-keywords + (append lisp-font-lock-keywords + (prog-prettify-font-lock-symbols-keywords))) + (setq lisp--augmented-font-lock-keywords-1 + (append lisp-font-lock-keywords-1 + (prog-prettify-font-lock-symbols-keywords))) + (setq lisp--augmented-font-lock-keywords-2 + (append lisp-font-lock-keywords-2 + (prog-prettify-font-lock-symbols-keywords))) (setq font-lock-defaults - `((lisp-font-lock-keywords - lisp-font-lock-keywords-1 lisp-font-lock-keywords-2) + `((lisp--augmented-font-lock-keywords + lisp--augmented-font-lock-keywords-1 + lisp--augmented-font-lock-keywords-2) nil ,keywords-case-insensitive nil nil (font-lock-mark-block-function . mark-defun) (font-lock-syntactic-face-function @@ -448,6 +464,9 @@ :type 'hook :group 'lisp) +(defconst lisp--prettify-symbols-alist + '(("lambda" . ?λ))) + (define-derived-mode emacs-lisp-mode prog-mode "Emacs-Lisp" "Major mode for editing Lisp code to run in Emacs. Commands: === modified file 'lisp/progmodes/cfengine.el' --- lisp/progmodes/cfengine.el 2013-03-22 19:06:53 +0000 +++ lisp/progmodes/cfengine.el 2013-06-05 14:26:50 +0000 @@ -527,6 +527,13 @@ ;; Doze path separators. (modify-syntax-entry ?\\ "." table)) +(defconst cfengine3--prettify-symbols-alist + '(("->" . ?→) + ("=>" . ?⇒) + ("::" . ?∷))) + +(defvar cfengine3--augmented-font-lock-keywords) + ;;;###autoload (define-derived-mode cfengine3-mode prog-mode "CFE3" "Major mode for editing CFEngine3 input. @@ -538,8 +545,18 @@ (cfengine-common-syntax cfengine3-mode-syntax-table) (set (make-local-variable 'indent-line-function) #'cfengine3-indent-line) + + ;; Define the symbols to be prettified + (setq-local prog-prettify-symbols-alist cfengine3--prettify-symbols-alist) + + ;; Tell font-lock.el how to handle cfengine3 keywords.. + (setq cfengine3--augmented-font-lock-keywords + (append cfengine3-font-lock-keywords + (prog-prettify-font-lock-symbols-keywords))) + (setq font-lock-defaults - '(cfengine3-font-lock-keywords nil nil nil beginning-of-defun)) + '(cfengine3--augmented-font-lock-keywords + nil nil nil beginning-of-defun)) ;; Use defuns as the essential syntax block. (set (make-local-variable 'beginning-of-defun-function) === modified file 'lisp/progmodes/perl-mode.el' --- lisp/progmodes/perl-mode.el 2013-05-07 18:06:13 +0000 +++ lisp/progmodes/perl-mode.el 2013-06-05 14:26:50 +0000 @@ -158,44 +158,10 @@ ;; Regexps updated with help from Tom Tromey and ;; Jim Campbell . -(defcustom perl-prettify-symbols t - "If non-nil, some symbols will be displayed using Unicode chars." - :version "24.4" - :type 'boolean) - (defconst perl--prettify-symbols-alist - '(;;("andalso" . ?∧) ("orelse" . ?∨) ("as" . ?≡)("not" . ?¬) - ;;("div" . ?÷) ("*" . ?×) ("o" . ?○) - ("->" . ?→) + '(("->" . ?→) ("=>" . ?⇒) - ;;("<-" . ?←) ("<>" . ?≠) (">=" . ?≥) ("<=" . ?≤) ("..." . ?⋯) - ("::" . ?∷) - )) - -(defun perl--font-lock-compose-symbol () - "Compose a sequence of ascii chars into a symbol. -Regexp match data 0 points to the chars." - ;; Check that the chars should really be composed into a symbol. - (let* ((start (match-beginning 0)) - (end (match-end 0)) - (syntaxes (if (eq (char-syntax (char-after start)) ?w) - '(?w) '(?. ?\\)))) - (if (or (memq (char-syntax (or (char-before start) ?\ )) syntaxes) - (memq (char-syntax (or (char-after end) ?\ )) syntaxes) - (nth 8 (syntax-ppss))) - ;; No composition for you. Let's actually remove any composition - ;; we may have added earlier and which is now incorrect. - (remove-text-properties start end '(composition)) - ;; That's a symbol alright, so add the composition. - (compose-region start end (cdr (assoc (match-string 0) - perl--prettify-symbols-alist))))) - ;; Return nil because we're not adding any face property. - nil) - -(defun perl--font-lock-symbols-keywords () - (when perl-prettify-symbols - `((,(regexp-opt (mapcar 'car perl--prettify-symbols-alist) t) - (0 (perl--font-lock-compose-symbol)))))) + ("::" . ?∷))) (defconst perl-font-lock-keywords-1 '(;; What is this for? @@ -243,13 +209,17 @@ ;; Fontify keywords with/and labels as we do in `c++-font-lock-keywords'. ("\\<\\(continue\\|goto\\|last\\|next\\|redo\\)\\>[ \t]*\\(\\sw+\\)?" (1 font-lock-keyword-face) (2 font-lock-constant-face nil t)) - ("^[ \t]*\\(\\sw+\\)[ \t]*:[^:]" 1 font-lock-constant-face) - ,@(perl--font-lock-symbols-keywords))) + ("^[ \t]*\\(\\sw+\\)[ \t]*:[^:]" 1 font-lock-constant-face))) "Gaudy level highlighting for Perl mode.") (defvar perl-font-lock-keywords perl-font-lock-keywords-1 "Default expressions to highlight in Perl mode.") +;; Temporary variables used to add font-lock keywords dynamically. +(defvar perl--augmented-font-lock-keywords) +(defvar perl--augmented-font-lock-keywords-1) +(defvar perl--augmented-font-lock-keywords-2) + (defvar perl-quote-like-pairs '((?\( . ?\)) (?\[ . ?\]) (?\{ . ?\}) (?\< . ?\>))) @@ -685,11 +655,25 @@ (setq-local comment-start-skip "\\(^\\|\\s-\\);?#+ *") (setq-local comment-indent-function #'perl-comment-indent) (setq-local parse-sexp-ignore-comments t) + + ;; Define the symbols to be prettified. + (setq-local prog-prettify-symbols-alist perl--prettify-symbols-alist) + ;; Tell font-lock.el how to handle Perl. - (setq font-lock-defaults '((perl-font-lock-keywords - perl-font-lock-keywords-1 - perl-font-lock-keywords-2) - nil nil ((?\_ . "w")) nil + (setq perl--augmented-font-lock-keywords + (append perl-font-lock-keywords + (prog-prettify-font-lock-symbols-keywords))) + (setq perl--augmented-font-lock-keywords-1 + (append perl-font-lock-keywords-1 + (prog-prettify-font-lock-symbols-keywords))) + (setq perl--augmented-font-lock-keywords-2 + (append perl-font-lock-keywords-2 + (prog-prettify-font-lock-symbols-keywords))) + + (setq font-lock-defaults '((perl--augmented-font-lock-keywords + perl--augmented-font-lock-keywords-1 + perl--augmented-font-lock-keywords-2) + nil nil ((?\_ . "w")) nil (font-lock-syntactic-face-function . perl-font-lock-syntactic-face-function))) (setq-local syntax-propertize-function #'perl-syntax-propertize-function) === modified file 'lisp/simple.el' --- lisp/simple.el 2013-05-25 02:21:49 +0000 +++ lisp/simple.el 2013-06-05 14:26:50 +0000 @@ -397,9 +397,51 @@ "Major mode for editing programming language source code." (set (make-local-variable 'require-final-newline) mode-require-final-newline) (set (make-local-variable 'parse-sexp-ignore-comments) t) + (make-local-variable 'prog-prettify-symbols-alist) ;; Any programming language is always written left to right. (setq bidi-paragraph-direction 'left-to-right)) +(defvar prog-prettify-symbols-alist nil) + +(defcustom prog-prettify-symbols nil + "Whether symbols should be prettified. +When set to an alist in the form `(STRING . CHARACTER)' it will +augment the mode's native prettify alist." + :type '(choice + (const :tag "No thanks" nil) + (const :tag "Mode defaults" t) + (alist :tag "Mode defaults augmented with your own list" + :key-type string :value-type character)) + :group 'languages) + +(defun prog--prettify-font-lock-compose-symbol (alist) + "Compose a sequence of ascii chars into a symbol. +Regexp match data 0 points to the chars." + ;; Check that the chars should really be composed into a symbol. + (let* ((start (match-beginning 0)) + (end (match-end 0)) + (syntaxes (if (eq (char-syntax (char-after start)) ?w) + '(?w) '(?. ?\\)))) + (if (or (memq (char-syntax (or (char-before start) ?\ )) syntaxes) + (memq (char-syntax (or (char-after end) ?\ )) syntaxes) + (nth 8 (syntax-ppss))) + ;; No composition for you. Let's actually remove any composition + ;; we may have added earlier and which is now incorrect. + (remove-text-properties start end '(composition)) + ;; That's a symbol alright, so add the composition. + (compose-region start end (cdr (assoc (match-string 0) alist))))) + ;; Return nil because we're not adding any face property. + nil) + +(defun prog-prettify-font-lock-symbols-keywords () + (when prog-prettify-symbols + (let ((alist (append prog-prettify-symbols-alist + (if (listp prog-prettify-symbols) + prog-prettify-symbols + nil)))) + `((,(regexp-opt (mapcar 'car alist) t) + (0 (prog--prettify-font-lock-compose-symbol ',alist))))))) + ;; Making and deleting lines. (defvar hard-newline (propertize "\n" 'hard t 'rear-nonsticky '(hard)) ------------------------------------------------------------ revno: 112855 committer: Alan Mackenzie branch nick: trunk timestamp: Wed 2013-06-05 12:45:51 +0000 message: Add ChangeLog entry for version #112847. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-06-05 07:40:02 +0000 +++ lisp/ChangeLog 2013-06-05 12:45:51 +0000 @@ -54,6 +54,12 @@ (compilation-auto-jump): Suppress the "Mark set" message to give way to exit message. +2013-06-04 Alan Mackenzie + + Remove faulty optimisation from indentation calculation. + * progmodes/cc-engine.el (c-guess-basic-syntax): Don't calculate + search limit based on 2000 characters back from indent-point. + 2013-06-03 Tassilo Horn * eshell/em-term.el (cl-lib): Require `cl-lib'. ------------------------------------------------------------ revno: 112854 committer: Michael Albinus branch nick: trunk timestamp: Wed 2013-06-05 14:17:02 +0200 message: * emacs.c (main) [HAVE_GFILENOTIFY]: Call globals_of_gfilenotify. * gfilenotify.c (globals_of_gfilenotify): New function. (syms_of_gfilenotify): Move global initialization there. * lisp.h (globals_of_gfilenotify) [HAVE_GFILENOTIFY]: Add prototype. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-06-05 01:58:43 +0000 +++ src/ChangeLog 2013-06-05 12:17:02 +0000 @@ -1,3 +1,12 @@ +2013-06-05 Michael Albinus + + * emacs.c (main) [HAVE_GFILENOTIFY]: Call globals_of_gfilenotify. + + * gfilenotify.c (globals_of_gfilenotify): New function. + (syms_of_gfilenotify): Move global initialization there. + + * lisp.h (globals_of_gfilenotify) [HAVE_GFILENOTIFY]: Add prototype. + 2013-06-05 Stefan Monnier * keymap.c (Fcurrent_active_maps, Fdescribe_buffer_bindings): === modified file 'src/emacs.c' --- src/emacs.c 2013-06-03 13:03:05 +0000 +++ src/emacs.c 2013-06-05 12:17:02 +0000 @@ -1250,6 +1250,10 @@ tzset (); #endif /* MSDOS */ +#ifdef HAVE_GFILENOTIFY + globals_of_gfilenotify (); +#endif + #ifdef WINDOWSNT globals_of_w32 (); #ifdef HAVE_W32NOTIFY === modified file 'src/gfilenotify.c' --- src/gfilenotify.c 2013-06-03 13:03:05 +0000 +++ src/gfilenotify.c 2013-06-05 12:17:02 +0000 @@ -233,11 +233,16 @@ void +globals_of_gfilenotify (void) +{ + g_type_init (); + watch_list = Qnil; +} + +void syms_of_gfilenotify (void) { - g_type_init (); - DEFSYM (Qgfile_add_watch, "gfile-add-watch"); defsubr (&Sgfile_add_watch); @@ -255,8 +260,6 @@ DEFSYM (Qunmounted, "unmounted"); DEFSYM (Qmoved, "moved"); - /* Initialize internal objects. */ - watch_list = Qnil; staticpro (&watch_list); Fprovide (intern_c_string ("gfilenotify"), Qnil); === modified file 'src/lisp.h' --- src/lisp.h 2013-06-03 13:03:05 +0000 +++ src/lisp.h 2013-06-05 12:17:02 +0000 @@ -3786,6 +3786,7 @@ /* Defined in gfilenotify.c */ #ifdef HAVE_GFILENOTIFY +extern void globals_of_gfilenotify (void); extern void syms_of_gfilenotify (void); #endif ------------------------------------------------------------ revno: 112853 fixes bug: http://debbugs.gnu.org/14395 committer: Leo Liu branch nick: trunk timestamp: Wed 2013-06-05 15:40:02 +0800 message: Re-implement smie matching block highlight using show-paren-data-function. * emacs-lisp/smie.el (smie-matching-block-highlight) (smie--highlight-matching-block-overlay) (smie--highlight-matching-block-lastpos) (smie-highlight-matching-block) (smie-highlight-matching-block-mode): Remove. (smie--matching-block-data-cache): New variable. (smie--matching-block-data): New function. (smie-setup): Use smie--matching-block-data for show-paren-data-function. * progmodes/octave.el (octave-mode-menu): Fix. (octave-find-definition): Skip garbage lines. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-06-05 02:35:40 +0000 +++ lisp/ChangeLog 2013-06-05 07:40:02 +0000 @@ -1,3 +1,20 @@ +2013-06-05 Leo Liu + + Re-implement smie matching block highlight using + show-paren-data-function. (Bug#14395) + * emacs-lisp/smie.el (smie-matching-block-highlight) + (smie--highlight-matching-block-overlay) + (smie--highlight-matching-block-lastpos) + (smie-highlight-matching-block) + (smie-highlight-matching-block-mode): Remove. + (smie--matching-block-data-cache): New variable. + (smie--matching-block-data): New function. + (smie-setup): Use smie--matching-block-data for + show-paren-data-function. + + * progmodes/octave.el (octave-mode-menu): Fix. + (octave-find-definition): Skip garbage lines. + 2013-06-05 Stefan Monnier Fix compilation error with simultaneous dynamic+lexical scoping. === modified file 'lisp/emacs-lisp/smie.el' --- lisp/emacs-lisp/smie.el 2013-05-29 06:50:48 +0000 +++ lisp/emacs-lisp/smie.el 2013-06-05 07:40:02 +0000 @@ -1021,87 +1021,63 @@ (let ((blink-matching-check-function #'smie-blink-matching-check)) (blink-matching-open)))))))) -(defface smie-matching-block-highlight '((t (:inherit highlight))) - "Face used to highlight matching block." - :group 'smie) - -(defvar smie--highlight-matching-block-overlay nil) -(defvar-local smie--highlight-matching-block-lastpos -1) - -(defun smie-highlight-matching-block () - (when (and smie-closer-alist - (/= (point) smie--highlight-matching-block-lastpos)) - (unless (overlayp smie--highlight-matching-block-overlay) - (setq smie--highlight-matching-block-overlay - (make-overlay (point) (point)))) - (setq smie--highlight-matching-block-lastpos (point)) - (let ((beg-of-tok - (lambda (&optional start) - "Move to the beginning of current token at START." - (let* ((token) - (start (or start (point))) - (beg (progn - (funcall smie-backward-token-function) - (forward-comment (point-max)) - (point))) - (end (progn - (setq token (funcall smie-forward-token-function)) - (forward-comment (- (point))) - (point)))) - (if (and (<= beg start) (<= start end) - (or (assoc token smie-closer-alist) - (rassoc token smie-closer-alist))) - (progn (goto-char beg) token) - (goto-char start) - nil)))) - (highlight - (lambda (beg end) - (move-overlay smie--highlight-matching-block-overlay - beg end (current-buffer)) - (overlay-put smie--highlight-matching-block-overlay - 'face 'smie-matching-block-highlight)))) - (overlay-put smie--highlight-matching-block-overlay 'face nil) - (unless (nth 8 (syntax-ppss)) - (save-excursion +(defvar-local smie--matching-block-data-cache nil) + +(defun smie--matching-block-data (orig &rest args) + "A function suitable for `show-paren-data-function' (which see)." + (when smie-closer-alist + (if (eq (point) (car smie--matching-block-data-cache)) + (or (cdr smie--matching-block-data-cache) + (apply orig args)) + (setq smie--matching-block-data-cache (list (point))) + (let* ((beg-of-tok + (lambda (&optional start) + "Move to the beginning of current token at START." + (let* ((token) + (start (or start (point))) + (beg (progn + (funcall smie-backward-token-function) + (forward-comment (point-max)) + (point))) + (end (progn + (setq token (funcall smie-forward-token-function)) + (forward-comment (- (point))) + (point)))) + (if (and (<= beg start) (<= start end) + (or (assoc token smie-closer-alist) + (rassoc token smie-closer-alist))) + (progn (goto-char beg) (list token beg end)) + (goto-char start) + nil)))) + (tok-at-pt + (lambda () + (or (funcall beg-of-tok) + (funcall beg-of-tok + (prog1 (point) + (funcall smie-forward-token-function))))))) + (unless (nth 8 (syntax-ppss)) (condition-case nil - (let ((token - (or (funcall beg-of-tok) - (funcall beg-of-tok - (prog1 (point) - (funcall smie-forward-token-function)))))) - (cond - ((assoc token smie-closer-alist) ; opener - (forward-sexp 1) - (let ((end (point)) - (closer (funcall smie-backward-token-function))) - (when (rassoc closer smie-closer-alist) - (funcall highlight (point) end)))) - ((rassoc token smie-closer-alist) ; closer - (funcall smie-forward-token-function) - (forward-sexp -1) - (let ((beg (point)) - (opener (funcall smie-forward-token-function))) - (when (assoc opener smie-closer-alist) - (funcall highlight beg (point))))))) - (scan-error))))))) - -(defvar smie--highlight-matching-block-timer nil) - -;;;###autoload -(define-minor-mode smie-highlight-matching-block-mode nil - :global t :group 'smie - (when (timerp smie--highlight-matching-block-timer) - (cancel-timer smie--highlight-matching-block-timer)) - (setq smie--highlight-matching-block-timer nil) - (if smie-highlight-matching-block-mode - (progn - (remove-hook 'post-self-insert-hook #'smie-blink-matching-open 'local) - (setq smie--highlight-matching-block-timer - (run-with-idle-timer 0.2 t #'smie-highlight-matching-block))) - (when smie--highlight-matching-block-overlay - (delete-overlay smie--highlight-matching-block-overlay) - (setq smie--highlight-matching-block-overlay nil)) - (kill-local-variable 'smie--highlight-matching-block-lastpos))) + (let ((here (funcall tok-at-pt))) + (when here + (let (pair there) + (cond + ((assoc (car here) smie-closer-alist) ; opener + (forward-sexp 1) + (setq there (funcall tok-at-pt)) + (setq pair (cons (car here) (car there)))) + ((rassoc (car here) smie-closer-alist) ; closer + (funcall smie-forward-token-function) + (forward-sexp -1) + (setq there (funcall tok-at-pt)) + (setq pair (cons (car there) (car here))))) + ;; Update the cache + (setcdr smie--matching-block-data-cache + (list (nth 1 here) (nth 2 here) + (nth 1 there) (nth 2 there) + (not (member pair smie-closer-alist))))))) + (scan-error)) + (goto-char (car smie--matching-block-data-cache)))) + (apply #'smie--matching-block-data orig args)))) ;;; The indentation engine. @@ -1799,9 +1775,10 @@ (setq-local smie-closer-alist ca) ;; Only needed for interactive calls to blink-matching-open. (setq-local blink-matching-check-function #'smie-blink-matching-check) - (unless smie-highlight-matching-block-mode - (add-hook 'post-self-insert-hook - #'smie-blink-matching-open 'append 'local)) + (add-hook 'post-self-insert-hook + #'smie-blink-matching-open 'append 'local) + (add-function :around (local 'show-paren-data-function) + #'smie--matching-block-data) ;; Setup smie-blink-matching-triggers. Rather than wait for SPC to ;; blink, try to blink as soon as we type the last char of a block ender. (let ((closers (sort (mapcar #'cdr smie-closer-alist) #'string-lessp)) === modified file 'lisp/progmodes/octave.el' --- lisp/progmodes/octave.el 2013-06-01 03:38:36 +0000 +++ lisp/progmodes/octave.el 2013-06-05 07:40:02 +0000 @@ -153,10 +153,10 @@ 'eldoc-mode)) :style toggle :selected (or eldoc-post-insert-mode eldoc-mode) :help "Display function signatures after typing `SPC' or `('"] - ["Delimiter Matching" smie-highlight-matching-block-mode - :style toggle :selected smie-highlight-matching-block-mode + ["Delimiter Matching" show-paren-mode + :style toggle :selected show-paren-mode :help "Highlight matched pairs such as `if ... end'" - :visible (fboundp 'smie-highlight-matching-block-mode)] + :visible (fboundp 'smie--matching-block-data)] ["Auto Fill" auto-fill-mode :style toggle :selected auto-fill-function :help "Automatic line breaking"] @@ -1715,9 +1715,13 @@ (list (format "\ if iskeyword(\"%s\") disp(\"`%s' is a keyword\") else which(\"%s\") endif\n" fn fn fn))) - (let* ((line (car inferior-octave-output-list)) - (file (when (and line (string-match "from the file \\(.*\\)$" line)) - (match-string 1 line)))) + (let (line file) + ;; Skip garbage lines such as + ;; warning: fmincg.m: possible Matlab-style .... + (while (and (not file) (consp inferior-octave-output-list)) + (setq line (pop inferior-octave-output-list)) + (when (string-match "from the file \\(.*\\)$" line) + (setq file (match-string 1 line)))) (if (not file) (user-error "%s" (or line (format "`%s' not found" fn))) (require 'etags) ------------------------------------------------------------ revno: 112852 committer: Stefan Monnier branch nick: trunk timestamp: Tue 2013-06-04 22:35:40 -0400 message: Fix compilation error with simultaneous dynamic+lexical scoping. Add warning when a defvar appears after the first let-binding. * lisp/emacs-lisp/bytecomp.el (byte-compile-lexical-variables): New var. (byte-compile-close-variables): Initialize it. (byte-compile--declare-var): New function. (byte-compile-file-form-defvar) (byte-compile-file-form-define-abbrev-table) (byte-compile-file-form-custom-declare-variable): Use it. (byte-compile-make-lambda-lexenv): Change the argument. Simplify. (byte-compile-lambda): Share call to byte-compile-arglist-vars. (byte-compile-bind): Handle dynamic bindings that shadow lexical bindings. (byte-compile-unbind): Make arg non-optional. (byte-compile-let): Simplify. * lisp/emacs-lisp/cconv.el (byte-compile-lexical-variables): Declare var. (cconv--analyse-function, cconv-analyse-form): Populate it. Protect byte-compile-bound-variables to limit the scope of defvars. (cconv-analyse-form): Add missing rule for (defvar ). Remove unneeded rule for `declare'. * lisp/emacs-lisp/cl-macs.el (cl--compiler-macro-adjoin): Use macroexp-let2 so as to avoid depending on cl-adjoin at run-time. * lisp/emacs-lisp/cl-lib.el (cl-pushnew): Use backquotes. * lisp/emacs-lisp/macroexp.el (macroexp--compiling-p): New function. (macroexp--warn-and-return): Use it. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-06-05 01:19:33 +0000 +++ lisp/ChangeLog 2013-06-05 02:35:40 +0000 @@ -1,3 +1,32 @@ +2013-06-05 Stefan Monnier + + Fix compilation error with simultaneous dynamic+lexical scoping. + Add warning when a defvar appears after the first let-binding. + * emacs-lisp/bytecomp.el (byte-compile-lexical-variables): New var. + (byte-compile-close-variables): Initialize it. + (byte-compile--declare-var): New function. + (byte-compile-file-form-defvar) + (byte-compile-file-form-define-abbrev-table) + (byte-compile-file-form-custom-declare-variable): Use it. + (byte-compile-make-lambda-lexenv): Change the argument. Simplify. + (byte-compile-lambda): Share call to byte-compile-arglist-vars. + (byte-compile-bind): Handle dynamic bindings that shadow + lexical bindings. + (byte-compile-unbind): Make arg non-optional. + (byte-compile-let): Simplify. + * emacs-lisp/cconv.el (byte-compile-lexical-variables): Declare var. + (cconv--analyse-function, cconv-analyse-form): Populate it. + Protect byte-compile-bound-variables to limit the scope of defvars. + (cconv-analyse-form): Add missing rule for (defvar ). + Remove unneeded rule for `declare'. + + * emacs-lisp/cl-macs.el (cl--compiler-macro-adjoin): Use macroexp-let2 + so as to avoid depending on cl-adjoin at run-time. + * emacs-lisp/cl-lib.el (cl-pushnew): Use backquotes. + + * emacs-lisp/macroexp.el (macroexp--compiling-p): New function. + (macroexp--warn-and-return): Use it. + 2013-06-05 Leo Liu * eshell/esh-mode.el (eshell-mode): Fix key bindings. @@ -17,7 +46,7 @@ * emacs-lisp/lisp.el: Use lexical-binding. (lisp--local-variables-1, lisp--local-variables): New functions. (lisp--local-variables-completion-table): New var. - (lisp-completion-at-point): Use it to provide completion of let-bound vars. + (lisp-completion-at-point): Use it complete let-bound vars. * emacs-lisp/lisp-mode.el (eval-sexp-add-defvars): Expand macros eagerly (bug#14422). === modified file 'lisp/emacs-lisp/bytecomp.el' --- lisp/emacs-lisp/bytecomp.el 2013-05-28 06:52:51 +0000 +++ lisp/emacs-lisp/bytecomp.el 2013-06-05 02:35:40 +0000 @@ -411,6 +411,9 @@ (defvar byte-compile-bound-variables nil "List of dynamic variables bound in the context of the current form. This list lives partly on the stack.") +(defvar byte-compile-lexical-variables nil + "List of variables that have been treated as lexical. +Filled in `cconv-analyse-form' but initialized and consulted here.") (defvar byte-compile-const-variables nil "List of variables declared as constants during compilation of this file.") (defvar byte-compile-free-references) @@ -1489,6 +1492,7 @@ (byte-compile--outbuffer nil) (byte-compile-function-environment nil) (byte-compile-bound-variables nil) + (byte-compile-lexical-variables nil) (byte-compile-const-variables nil) (byte-compile-free-references nil) (byte-compile-free-assignments nil) @@ -2245,15 +2249,24 @@ (put 'defvar 'byte-hunk-handler 'byte-compile-file-form-defvar) (put 'defconst 'byte-hunk-handler 'byte-compile-file-form-defvar) + +(defun byte-compile--declare-var (sym) + (when (and (symbolp sym) + (not (string-match "[-*/:$]" (symbol-name sym))) + (byte-compile-warning-enabled-p 'lexical)) + (byte-compile-warn "global/dynamic var `%s' lacks a prefix" + sym)) + (when (memq sym byte-compile-lexical-variables) + (setq byte-compile-lexical-variables + (delq sym byte-compile-lexical-variables)) + (byte-compile-warn "Variable `%S' declared after its first use" sym)) + (push sym byte-compile-bound-variables)) + (defun byte-compile-file-form-defvar (form) - (when (and (symbolp (nth 1 form)) - (not (string-match "[-*/:$]" (symbol-name (nth 1 form)))) - (byte-compile-warning-enabled-p 'lexical)) - (byte-compile-warn "global/dynamic var `%s' lacks a prefix" - (nth 1 form))) - (push (nth 1 form) byte-compile-bound-variables) - (if (eq (car form) 'defconst) - (push (nth 1 form) byte-compile-const-variables)) + (let ((sym (nth 1 form))) + (byte-compile--declare-var sym) + (if (eq (car form) 'defconst) + (push sym byte-compile-const-variables))) (if (and (null (cddr form)) ;No `value' provided. (eq (car form) 'defvar)) ;Just a declaration. nil @@ -2267,7 +2280,7 @@ 'byte-compile-file-form-define-abbrev-table) (defun byte-compile-file-form-define-abbrev-table (form) (if (eq 'quote (car-safe (car-safe (cdr form)))) - (push (car-safe (cdr (cadr form))) byte-compile-bound-variables)) + (byte-compile--declare-var (car-safe (cdr (cadr form))))) (byte-compile-keep-pending form)) (put 'custom-declare-variable 'byte-hunk-handler @@ -2275,7 +2288,7 @@ (defun byte-compile-file-form-custom-declare-variable (form) (when (byte-compile-warning-enabled-p 'callargs) (byte-compile-nogroup-warn form)) - (push (nth 1 (nth 1 form)) byte-compile-bound-variables) + (byte-compile--declare-var (nth 1 (nth 1 form))) (byte-compile-keep-pending form)) (put 'require 'byte-hunk-handler 'byte-compile-file-form-require) @@ -2576,19 +2589,16 @@ "Return a list of the variables in the lambda argument list ARGLIST." (remq '&rest (remq '&optional arglist))) -(defun byte-compile-make-lambda-lexenv (form) +(defun byte-compile-make-lambda-lexenv (args) "Return a new lexical environment for a lambda expression FORM." - ;; See if this is a closure or not - (let ((args (byte-compile-arglist-vars (cadr form)))) - (let ((lexenv nil)) - ;; Fill in the initial stack contents - (let ((stackpos 0)) - ;; Add entries for each argument - (dolist (arg args) - (push (cons arg stackpos) lexenv) - (setq stackpos (1+ stackpos))) - ;; Return the new lexical environment - lexenv)))) + (let* ((lexenv nil) + (stackpos 0)) + ;; Add entries for each argument. + (dolist (arg args) + (push (cons arg stackpos) lexenv) + (setq stackpos (1+ stackpos))) + ;; Return the new lexical environment. + lexenv)) (defun byte-compile-make-args-desc (arglist) (let ((mandatory 0) @@ -2626,9 +2636,9 @@ (byte-compile-set-symbol-position 'lambda)) (byte-compile-check-lambda-list (nth 1 fun)) (let* ((arglist (nth 1 fun)) + (arglistvars (byte-compile-arglist-vars arglist)) (byte-compile-bound-variables - (append (and (not lexical-binding) - (byte-compile-arglist-vars arglist)) + (append (if (not lexical-binding) arglistvars) byte-compile-bound-variables)) (body (cdr (cdr fun))) (doc (if (stringp (car body)) @@ -2676,7 +2686,8 @@ ;; args (since lambda expressions should be ;; closed by now). (and lexical-binding - (byte-compile-make-lambda-lexenv fun)) + (byte-compile-make-lambda-lexenv + arglistvars)) reserved-csts))) ;; Build the actual byte-coded function. (cl-assert (eq 'byte-code (car-safe compiled))) @@ -3862,9 +3873,8 @@ "Emit byte-codes to push the initialization value for CLAUSE on the stack. Return the offset in the form (VAR . OFFSET)." (let* ((var (if (consp clause) (car clause) clause))) - ;; We record the stack position even of dynamic bindings and - ;; variables in non-stack lexical environments; we'll put - ;; them in the proper place below. + ;; We record the stack position even of dynamic bindings; we'll put + ;; them in the proper place later. (prog1 (cons var byte-compile-depth) (if (consp clause) (byte-compile-form (cadr clause)) @@ -3882,33 +3892,41 @@ INIT-LEXENV should be a lexical-environment alist describing the positions of the init value that have been pushed on the stack. Return non-nil if the TOS value was popped." - ;; The presence of lexical bindings mean that we may have to + ;; The mix of lexical and dynamic bindings mean that we may have to ;; juggle things on the stack, to move them to TOS for ;; dynamic binding. - (cond ((not (byte-compile-not-lexical-var-p var)) - ;; VAR is a simple stack-allocated lexical variable - (push (assq var init-lexenv) - byte-compile--lexical-environment) - nil) - ((eq var (caar init-lexenv)) - ;; VAR is dynamic and is on the top of the - ;; stack, so we can just bind it like usual - (byte-compile-dynamic-variable-bind var) - t) - (t - ;; VAR is dynamic, but we have to get its - ;; value out of the middle of the stack - (let ((stack-pos (cdr (assq var init-lexenv)))) - (byte-compile-stack-ref stack-pos) - (byte-compile-dynamic-variable-bind var) - ;; Now we have to store nil into its temporary - ;; stack position to avoid problems with GC - (byte-compile-push-constant nil) - (byte-compile-stack-set stack-pos)) - nil))) + (if (and lexical-binding (not (byte-compile-not-lexical-var-p var))) + ;; VAR is a simple stack-allocated lexical variable. + (progn (push (assq var init-lexenv) + byte-compile--lexical-environment) + nil) + ;; VAR should be dynamically bound. + (while (assq var byte-compile--lexical-environment) + ;; This dynamic binding shadows a lexical binding. + (setq byte-compile--lexical-environment + (remq (assq var byte-compile--lexical-environment) + byte-compile--lexical-environment))) + (cond + ((eq var (caar init-lexenv)) + ;; VAR is dynamic and is on the top of the + ;; stack, so we can just bind it like usual. + (byte-compile-dynamic-variable-bind var) + t) + (t + ;; VAR is dynamic, but we have to get its + ;; value out of the middle of the stack. + (let ((stack-pos (cdr (assq var init-lexenv)))) + (byte-compile-stack-ref stack-pos) + (byte-compile-dynamic-variable-bind var) + ;; Now we have to store nil into its temporary + ;; stack position so it doesn't prevent the value from being GC'd. + ;; FIXME: Not worth the trouble. + ;; (byte-compile-push-constant nil) + ;; (byte-compile-stack-set stack-pos) + ) + nil)))) -(defun byte-compile-unbind (clauses init-lexenv - &optional preserve-body-value) +(defun byte-compile-unbind (clauses init-lexenv preserve-body-value) "Emit byte-codes to unbind the variables bound by CLAUSES. CLAUSES is a `let'-style variable binding list. INIT-LEXENV should be a lexical-environment alist describing the positions of the init value that @@ -3916,7 +3934,7 @@ then an additional value on the top of the stack, above any lexical binding slots, is preserved, so it will be on the top of the stack after all binding slots have been popped." - ;; Unbind dynamic variables + ;; Unbind dynamic variables. (let ((num-dynamic-bindings 0)) (dolist (clause clauses) (unless (assq (if (consp clause) (car clause) clause) @@ -3927,14 +3945,15 @@ ;; Pop lexical variables off the stack, possibly preserving the ;; return value of the body. (when init-lexenv - ;; INIT-LEXENV contains all init values left on the stack + ;; INIT-LEXENV contains all init values left on the stack. (byte-compile-discard (length init-lexenv) preserve-body-value))) (defun byte-compile-let (form) - "Generate code for the `let' form FORM." + "Generate code for the `let' or `let*' form FORM." (let ((clauses (cadr form)) - (init-lexenv nil)) - (when (eq (car form) 'let) + (init-lexenv nil) + (is-let (eq (car form) 'let))) + (when is-let ;; First compute the binding values in the old scope. (dolist (var clauses) (push (byte-compile-push-binding-init var) init-lexenv))) @@ -3946,28 +3965,20 @@ ;; For `let', do it in reverse order, because it makes no ;; semantic difference, but it is a lot more efficient since the ;; values are now in reverse order on the stack. - (dolist (var (if (eq (car form) 'let) (reverse clauses) clauses)) - (unless (eq (car form) 'let) + (dolist (var (if is-let (reverse clauses) clauses)) + (unless is-let (push (byte-compile-push-binding-init var) init-lexenv)) (let ((var (if (consp var) (car var) var))) - (cond ((null lexical-binding) - ;; If there are no lexical bindings, we can do things simply. - (byte-compile-dynamic-variable-bind var)) - ((byte-compile-bind var init-lexenv) - (pop init-lexenv))))) + (if (byte-compile-bind var init-lexenv) + (pop init-lexenv)))) ;; Emit the body. (let ((init-stack-depth byte-compile-depth)) (byte-compile-body-do-effect (cdr (cdr form))) - ;; Unbind the variables. - (if lexical-binding - ;; Unbind both lexical and dynamic variables. - (progn - (cl-assert (or (eq byte-compile-depth init-stack-depth) - (eq byte-compile-depth (1+ init-stack-depth)))) - (byte-compile-unbind clauses init-lexenv (> byte-compile-depth - init-stack-depth))) - ;; Unbind dynamic variables. - (byte-compile-out 'byte-unbind (length clauses))))))) + ;; Unbind both lexical and dynamic variables. + (cl-assert (or (eq byte-compile-depth init-stack-depth) + (eq byte-compile-depth (1+ init-stack-depth)))) + (byte-compile-unbind clauses init-lexenv + (> byte-compile-depth init-stack-depth)))))) === modified file 'lisp/emacs-lisp/cconv.el' --- lisp/emacs-lisp/cconv.el 2013-01-01 09:11:05 +0000 +++ lisp/emacs-lisp/cconv.el 2013-06-05 02:35:40 +0000 @@ -81,7 +81,6 @@ ;; and other oddities. ;; - new byte codes for unwind-protect, catch, and condition-case so that ;; closures aren't needed at all. -;; - inline source code of different binding mode by first compiling it. ;; - a reference to a var that is known statically to always hold a constant ;; should be turned into a byte-constant rather than a byte-stack-ref. ;; Hmm... right, that's called constant propagation and could be done here, @@ -95,6 +94,7 @@ ;; (defmacro dlet (binders &rest body) ;; ;; Works in both lexical and non-lexical mode. +;; (declare (indent 1) (debug let)) ;; `(progn ;; ,@(mapcar (lambda (binder) ;; `(defvar ,(if (consp binder) (car binder) binder))) @@ -489,6 +489,7 @@ (unless (fboundp 'byte-compile-not-lexical-var-p) ;; Only used to test the code in non-lexbind Emacs. (defalias 'byte-compile-not-lexical-var-p 'boundp)) +(defvar byte-compile-lexical-variables) (defun cconv--analyse-use (vardata form varkind) "Analyze the use of a variable. @@ -530,6 +531,7 @@ ;; outside of it. (envcopy (mapcar (lambda (vdata) (list (car vdata) nil nil nil nil)) env)) + (byte-compile-bound-variables byte-compile-bound-variables) (newenv envcopy)) ;; Push it before recursing, so cconv-freevars-alist contains entries in ;; the order they'll be used by closure-convert-rec. @@ -541,6 +543,7 @@ (format "Argument %S is not a lexical variable" arg))) ((eq ?& (aref (symbol-name arg) 0)) nil) ;Ignore &rest, &optional, ... (t (let ((varstruct (list arg nil nil nil nil))) + (cl-pushnew arg byte-compile-lexical-variables) (push (cons (list arg) (cdr varstruct)) newvars) (push varstruct newenv))))) (dolist (form body) ;Analyze body forms. @@ -579,6 +582,7 @@ (let ((orig-env env) (newvars nil) (var nil) + (byte-compile-bound-variables byte-compile-bound-variables) (value nil)) (dolist (binder binders) (if (not (consp binder)) @@ -592,6 +596,7 @@ (cconv-analyse-form value (if (eq letsym 'let*) env orig-env))) (unless (byte-compile-not-lexical-var-p var) + (cl-pushnew var byte-compile-lexical-variables) (let ((varstruct (list var nil nil nil nil))) (push (cons binder (cdr varstruct)) newvars) (push varstruct env)))) @@ -616,7 +621,8 @@ (`((lambda . ,_) . ,_) ; First element is lambda expression. (byte-compile-log-warning - "Use of deprecated ((lambda ...) ...) form" t :warning) + (format "Use of deprecated ((lambda %s ...) ...) form" (nth 1 (car form))) + t :warning) (dolist (exp `((function ,(car form)) . ,(cdr form))) (cconv-analyse-form exp env))) @@ -645,6 +651,7 @@ (`(track-mouse . ,body) (cconv--analyse-function () body env form)) + (`(defvar ,var) (push var byte-compile-bound-variables)) (`(,(or `defconst `defvar) ,var ,value . ,_) (push var byte-compile-bound-variables) (cconv-analyse-form value env)) @@ -668,7 +675,9 @@ ;; seem worth the trouble. (dolist (form forms) (cconv-analyse-form form nil))) - (`(declare . ,_) nil) ;The args don't contain code. + ;; `declare' should now be macro-expanded away (and if they're not, we're + ;; in trouble because they *can* contain code nowadays). + ;; (`(declare . ,_) nil) ;The args don't contain code. (`(,_ . ,body-forms) ; First element is a function or whatever. (dolist (form body-forms) (cconv-analyse-form form env))) === modified file 'lisp/emacs-lisp/cl-lib.el' --- lisp/emacs-lisp/cl-lib.el 2013-02-20 02:07:07 +0000 +++ lisp/emacs-lisp/cl-lib.el 2013-06-05 02:35:40 +0000 @@ -156,8 +156,8 @@ ;; earlier and should have triggered them already. (with-no-warnings ,place) (setq ,place (cons ,var ,place)))) - (list 'setq place (cl-list* 'cl-adjoin x place keys))) - (cl-list* 'cl-callf2 'cl-adjoin x place keys))) + `(setq ,place (cl-adjoin ,x ,place ,@keys))) + `(cl-callf2 cl-adjoin ,x ,place ,@keys))) (defun cl--set-elt (seq n val) (if (listp seq) (setcar (nthcdr n seq) val) (aset seq n val))) === modified file 'lisp/emacs-lisp/cl-loaddefs.el' --- lisp/emacs-lisp/cl-loaddefs.el 2013-05-15 02:00:07 +0000 +++ lisp/emacs-lisp/cl-loaddefs.el 2013-06-05 02:35:40 +0000 @@ -267,7 +267,7 @@ ;;;;;; cl-typecase cl-ecase cl-case cl-load-time-value cl-eval-when ;;;;;; cl-destructuring-bind cl-function cl-defmacro cl-defun cl-gentemp ;;;;;; cl-gensym cl--compiler-macro-cXXr cl--compiler-macro-list*) -;;;;;; "cl-macs" "cl-macs.el" "b839ad3781c4f2f849df0639b4eba166") +;;;;;; "cl-macs" "cl-macs.el" "80cb53f97b21adb6069c43c38a2e094d") ;;; Generated autoloads from cl-macs.el (autoload 'cl--compiler-macro-list* "cl-macs" "\ === modified file 'lisp/emacs-lisp/cl-macs.el' --- lisp/emacs-lisp/cl-macs.el 2013-05-10 02:01:12 +0000 +++ lisp/emacs-lisp/cl-macs.el 2013-06-05 02:35:40 +0000 @@ -2763,10 +2763,10 @@ ;;;###autoload (defun cl--compiler-macro-adjoin (form a list &rest keys) - (if (and (cl--simple-expr-p a) (cl--simple-expr-p list) - (not (memq :key keys))) - `(if (cl-member ,a ,list ,@keys) ,list (cons ,a ,list)) - form)) + (if (memq :key keys) form + (macroexp-let2 macroexp-copyable-p va a + (macroexp-let2 macroexp-copyable-p vlist list + `(if (cl-member ,va ,vlist ,@keys) ,vlist (cons ,va ,vlist)))))) (defun cl--compiler-macro-get (_form sym prop &optional def) (if def === modified file 'lisp/emacs-lisp/macroexp.el' --- lisp/emacs-lisp/macroexp.el 2013-01-02 16:13:04 +0000 +++ lisp/emacs-lisp/macroexp.el 2013-06-05 02:35:40 +0000 @@ -111,15 +111,20 @@ (funcall (eval (cadr form))) (byte-compile-constant nil))) +(defun macroexp--compiling-p () + "Return non-nil if we're macroexpanding for the compiler." + ;; FIXME: ¡¡Major Ugly Hack!! To determine whether the output of this + ;; macro-expansion will be processed by the byte-compiler, we check + ;; circumstantial evidence. + (member '(declare-function . byte-compile-macroexpand-declare-function) + macroexpand-all-environment)) + + (defun macroexp--warn-and-return (msg form) (let ((when-compiled (lambda () (byte-compile-log-warning msg t)))) (cond ((null msg) form) - ;; FIXME: ¡¡Major Ugly Hack!! To determine whether the output of this - ;; macro-expansion will be processed by the byte-compiler, we check - ;; circumstantial evidence. - ((member '(declare-function . byte-compile-macroexpand-declare-function) - macroexpand-all-environment) + ((macroexp--compiling-p) `(progn (macroexp--funcall-if-compiled ',when-compiled) ,form))