Now on revision 107584. ------------------------------------------------------------ revno: 107584 committer: Chong Yidong branch nick: trunk timestamp: Mon 2012-03-12 14:34:32 +0800 message: Rename inhibit_window_configuration_change_hook to inhibit_lisp_code. This is a tweak to r107391, suggested by Stefan. * eval.c (inhibit_lisp_code): Rename from inhibit_window_configuration_change_hook; move from window.c. * xfns.c (unwind_create_frame_1, Fx_create_frame): * window.c (run_window_configuration_change_hook) (syms_of_window): Callers changed. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-03-11 17:08:10 +0000 +++ src/ChangeLog 2012-03-12 06:34:32 +0000 @@ -1,3 +1,12 @@ +2012-03-12 Chong Yidong + + * eval.c (inhibit_lisp_code): Rename from + inhibit_window_configuration_change_hook; move from window.c. + + * xfns.c (unwind_create_frame_1, Fx_create_frame): + * window.c (run_window_configuration_change_hook) + (syms_of_window): Callers changed. + 2012-03-11 Chong Yidong * keymap.c (Fkey_description): Doc fix (Bug#9700). === modified file 'src/eval.c' --- src/eval.c 2012-02-15 04:00:34 +0000 +++ src/eval.c 2012-03-12 06:34:32 +0000 @@ -124,6 +124,12 @@ int handling_signal; +/* If non-nil, Lisp code must not be run since some part of Emacs is + in an inconsistent state. Currently, x-create-frame uses this to + avoid triggering window-configuration-change-hook while the new + frame is half-initialized. */ +Lisp_Object inhibit_lisp_code; + static Lisp_Object funcall_lambda (Lisp_Object, ptrdiff_t, Lisp_Object *); static void unwind_to_catch (struct catchtag *, Lisp_Object) NO_RETURN; static int interactive_p (int); @@ -3766,6 +3772,8 @@ staticpro (&Vsignaling_function); Vsignaling_function = Qnil; + inhibit_lisp_code = Qnil; + defsubr (&Sor); defsubr (&Sand); defsubr (&Sif); === modified file 'src/lisp.h' --- src/lisp.h 2012-02-25 19:39:42 +0000 +++ src/lisp.h 2012-03-12 06:34:32 +0000 @@ -2937,6 +2937,7 @@ extern Lisp_Object Qand_rest; extern Lisp_Object Vautoload_queue; extern Lisp_Object Vsignaling_function; +extern Lisp_Object inhibit_lisp_code; extern int handling_signal; #if BYTE_MARK_STACK extern struct catchtag *catchlist; === modified file 'src/window.c' --- src/window.c 2012-02-23 17:40:33 +0000 +++ src/window.c 2012-03-12 06:34:32 +0000 @@ -122,9 +122,6 @@ /* Hook to run when window config changes. */ static Lisp_Object Qwindow_configuration_change_hook; -/* If non-nil, run_window_configuration_change_hook does nothing. */ -Lisp_Object inhibit_window_configuration_change_hook; - /* Used by the function window_scroll_pixel_based */ static int window_scroll_pixel_based_preserve_x; static int window_scroll_pixel_based_preserve_y; @@ -2897,7 +2894,7 @@ = Fdefault_value (Qwindow_configuration_change_hook); XSETFRAME (frame, f); - if (NILP (Vrun_hooks) || !NILP (inhibit_window_configuration_change_hook)) + if (NILP (Vrun_hooks) || !NILP (inhibit_lisp_code)) return; /* Use the right buffer. Matters when running the local hooks. */ @@ -6527,8 +6524,6 @@ window_scroll_preserve_hpos = -1; window_scroll_preserve_vpos = -1; - inhibit_window_configuration_change_hook = Qnil; - DEFVAR_LISP ("temp-buffer-show-function", Vtemp_buffer_show_function, doc: /* Non-nil means call as function to display a help buffer. The function is called with one argument, the buffer to be displayed. === modified file 'src/window.h' --- src/window.h 2012-02-23 07:28:21 +0000 +++ src/window.h 2012-03-12 06:34:32 +0000 @@ -810,10 +810,6 @@ extern Lisp_Object Vmouse_event; -/* If non-nil, run_window_configuration_change_hook does nothing. */ - -extern Lisp_Object inhibit_window_configuration_change_hook; - EXFUN (Fnext_window, 3); EXFUN (Fselect_window, 2); EXFUN (Fset_window_buffer, 3); === modified file 'src/xfns.c' --- src/xfns.c 2012-02-23 07:28:21 +0000 +++ src/xfns.c 2012-03-12 06:34:32 +0000 @@ -2952,7 +2952,7 @@ static Lisp_Object unwind_create_frame_1 (Lisp_Object val) { - inhibit_window_configuration_change_hook = val; + inhibit_lisp_code = val; return Qnil; } @@ -3337,9 +3337,8 @@ Vframe_list. */ { int count2 = SPECPDL_INDEX (); - record_unwind_protect (unwind_create_frame_1, - inhibit_window_configuration_change_hook); - inhibit_window_configuration_change_hook = Qt; + record_unwind_protect (unwind_create_frame_1, inhibit_lisp_code); + inhibit_lisp_code = Qt; x_default_parameter (f, parms, Qmenu_bar_lines, NILP (Vmenu_bar_mode) ------------------------------------------------------------ revno: 107583 fixes bug(s): http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10958 committer: Stefan Monnier branch nick: trunk timestamp: Mon 2012-03-12 00:10:59 -0400 message: * lisp/minibuffer.el (minibuffer-complete): Don't get confused when the function is run twice via different commands. (complete-with-action): Fix docstring. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-03-12 03:58:20 +0000 +++ lisp/ChangeLog 2012-03-12 04:10:59 +0000 @@ -1,3 +1,9 @@ +2012-03-12 Stefan Monnier + + * minibuffer.el (minibuffer-complete): Don't get confused when the + function is run twice via different commands (bug#10958). + (complete-with-action): Fix docstring. + 2012-03-12 Chong Yidong * nxml/nxml-mode.el (nxml-mode-map): Do not bind C-RET (Bug#6776). @@ -21,8 +27,8 @@ 2012-03-11 Andreas Schwab - * server.el (server-eval-at): Handle non-tcp connections. Decode - result string. + * server.el (server-eval-at): Handle non-tcp connections. + Decode result string. * server.el (server-msg-size): New constant. (server-reply-print): New function. @@ -85,13 +91,13 @@ 2012-03-10 Chong Yidong * emulation/cua-rect.el (cua--init-rectangles): - * emulation/cua-base.el (cua--init-keymaps): Add - delete-forward-char to remappings (Bug#9666). + * emulation/cua-base.el (cua--init-keymaps): + Add delete-forward-char to remappings (Bug#9666). 2012-03-10 Martin Rudalics - * speedbar.el (speedbar-unhighlight-one-tag-line): Avoid - unhighlighting due to frame switching (Bug#10275). + * speedbar.el (speedbar-unhighlight-one-tag-line): + Avoid unhighlighting due to frame switching (Bug#10275). 2012-03-10 Chong Yidong @@ -115,8 +121,8 @@ 2012-03-09 Eli Zaretskii - * mail/smtpmail.el (smtpmail-send-it): Bind - coding-system-for-write to *-unix, so that FCC files are kept in + * mail/smtpmail.el (smtpmail-send-it): + Bind coding-system-for-write to *-unix, so that FCC files are kept in valid mbox format. 2012-03-09 Glenn Morris @@ -127,8 +133,8 @@ 2012-03-08 Eli Zaretskii - * international/quail.el (quail-insert-kbd-layout): Insert - invisible LRM characters before each character in a keyboard + * international/quail.el (quail-insert-kbd-layout): + Insert invisible LRM characters before each character in a keyboard layout cell, to prevent their reordering by bidi display engine. For details, see the discussion in http://lists.gnu.org/archive/html/emacs-devel/2012-03/msg00085.html. @@ -147,8 +153,8 @@ 2012-03-07 Eli Zaretskii - * international/quail.el (quail-help): Force - bidi-paragraph-direction be left-to-right. See discussion in + * international/quail.el (quail-help): + Force bidi-paragraph-direction be left-to-right. See discussion in http://lists.gnu.org/archive/html/emacs-devel/2012-03/msg00062.html for the reason. @@ -280,16 +286,16 @@ New variables for... (c-state-semi-safe-place): New function. Here, in a macro is "safe". (c-invalidate-state-cache-1): New stuff for c-state-semi-safe-place. - (c-in-literal, c-literal-limits, c-determine-limit-get-base): Use - c-state-semi-safe-place. + (c-in-literal, c-literal-limits, c-determine-limit-get-base): + Use c-state-semi-safe-place. - * progmodes/cc-langs.el (c-get-state-before-change-functions): Add - c-invalidate-macro-cache to the C, C++, Obj entries. + * progmodes/cc-langs.el (c-get-state-before-change-functions): + Add c-invalidate-macro-cache to the C, C++, Obj entries. 2012-03-02 Michael Albinus - * jka-compr.el (jka-compr-call-process): Apply - `file-accessible-directory-p' only when the default directory is + * jka-compr.el (jka-compr-call-process): + Apply `file-accessible-directory-p' only when the default directory is not remote. 2012-03-01 Michael Albinus === modified file 'lisp/minibuffer.el' --- lisp/minibuffer.el 2012-03-10 07:08:51 +0000 +++ lisp/minibuffer.el 2012-03-12 04:10:59 +0000 @@ -162,7 +162,7 @@ (defun complete-with-action (action table string pred) "Perform completion ACTION. STRING is the string to complete. -TABLE is the completion table, which should not be a function. +TABLE is the completion table. PRED is a completion predicate. ACTION can be one of nil, t or `lambda'." (cond @@ -776,7 +776,8 @@ (interactive) ;; If the previous command was not this, ;; mark the completion buffer obsolete. - (unless (eq this-command last-command) + (setq this-command 'completion-at-point) + (unless (eq 'completion-at-point last-command) (completion--flush-all-sorted-completions) (setq minibuffer-scroll-window nil)) ------------------------------------------------------------ revno: 107582 fixes bug(s): http://debbugs.gnu.org/6776 committer: Chong Yidong branch nick: trunk timestamp: Mon 2012-03-12 11:58:20 +0800 message: Adapt nXML mode to Emacs 24 completion scheme. * lisp/nxml/nxml-mode.el (nxml-mode-map): Do not bind C-RET. (nxml-completion-at-point-function): New function. (nxml-mode): Use it. (nxml-bind-meta-tab-to-complete-flag): Default to t. diff: === modified file 'etc/NEWS' --- etc/NEWS 2012-03-08 05:27:03 +0000 +++ etc/NEWS 2012-03-12 03:58:20 +0000 @@ -771,6 +771,11 @@ --- ** mpc.el: Can use pseudo tags of the form tag1|tag2 as a union of two tags. +** nXML mode no longer binds C-RET to `nxml-complete'. +Completion is now performed via `completion-at-point', bound to M-TAB. +If `nxml-bind-meta-tab-to-complete-flag' is non-nil (the default), +this performs tag completion. + --- ** Prolog mode has been completely revamped, with lots of additional functionality such as more intelligent indentation, electricity, support for === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-03-12 03:03:16 +0000 +++ lisp/ChangeLog 2012-03-12 03:58:20 +0000 @@ -1,5 +1,10 @@ 2012-03-12 Chong Yidong + * nxml/nxml-mode.el (nxml-mode-map): Do not bind C-RET (Bug#6776). + (nxml-completion-at-point-function): New function. + (nxml-mode): Use it. + (nxml-bind-meta-tab-to-complete-flag): Default to t. + * emacs-lisp/package.el (package-unpack, package-unpack-single): Load generated autoloads file before byte compiling (Bug#10970). (package--make-autoloads-and-compile): New helper fun. === modified file 'lisp/nxml/nxml-mode.el' --- lisp/nxml/nxml-mode.el 2012-01-19 07:21:25 +0000 +++ lisp/nxml/nxml-mode.el 2012-03-12 03:58:20 +0000 @@ -86,18 +86,9 @@ :group 'nxml :type 'integer) -(defcustom nxml-bind-meta-tab-to-complete-flag (not window-system) - "Non-nil means bind M-TAB in `nxml-mode-map' to `nxml-complete'. -C-return will be bound to `nxml-complete' in any case. -M-TAB gets swallowed by many window systems/managers, and -`documentation' will show M-TAB rather than C-return as the -binding for `nxml-complete' when both are bound. So it's better -to bind M-TAB only when it will work." +(defcustom nxml-bind-meta-tab-to-complete-flag t + "Non-nil means to use nXML completion in \\[completion-at-point]." :group 'nxml - :set (lambda (sym flag) - (set-default sym flag) - (when (and (boundp 'nxml-mode-map) nxml-mode-map) - (define-key nxml-mode-map "\M-\t" (and flag 'nxml-complete)))) :type 'boolean) (defcustom nxml-prefer-utf-16-to-utf-8-flag nil @@ -418,9 +409,7 @@ (define-key map "\C-c\C-o" nxml-outline-prefix-map) (define-key map [S-mouse-2] 'nxml-mouse-hide-direct-text-content) (define-key map "/" 'nxml-electric-slash) - (define-key map [C-return] 'nxml-complete) - (when nxml-bind-meta-tab-to-complete-flag - (define-key map "\M-\t" 'nxml-complete)) + (define-key map "\M-\t" 'completion-at-point) map) "Keymap for nxml-mode.") @@ -479,7 +468,7 @@ If `nxml-slash-auto-complete-flag' is non-nil, then inserting a ` branch nick: trunk timestamp: Mon 2012-03-12 11:03:16 +0800 message: Load a package's generated autoloads file before byte compiling it. * lisp/emacs-lisp/package.el (package-unpack, package-unpack-single): Load generated autoloads file before byte compiling. (package--make-autoloads-and-compile): New helper fun. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-03-12 02:41:22 +0000 +++ lisp/ChangeLog 2012-03-12 03:03:16 +0000 @@ -1,3 +1,9 @@ +2012-03-12 Chong Yidong + + * emacs-lisp/package.el (package-unpack, package-unpack-single): + Load generated autoloads file before byte compiling (Bug#10970). + (package--make-autoloads-and-compile): New helper fun. + 2012-03-12 Christopher Schmidt * ibuffer.el (ibuffer-redisplay): Remove another gratuitous error. === modified file 'lisp/emacs-lisp/package.el' --- lisp/emacs-lisp/package.el 2012-03-04 09:45:01 +0000 +++ lisp/emacs-lisp/package.el 2012-03-12 03:03:16 +0000 @@ -607,16 +607,25 @@ (error "Package does not untar cleanly into directory %s/" dir)))) (tar-untar-buffer)) -(defun package-unpack (name version) - (let* ((dirname (concat (symbol-name name) "-" version)) +(defun package-unpack (package version) + (let* ((name (symbol-name package)) + (dirname (concat name "-" version)) (pkg-dir (expand-file-name dirname package-user-dir))) (make-directory package-user-dir t) ;; FIXME: should we delete PKG-DIR if it exists? (let* ((default-directory (file-name-as-directory package-user-dir))) (package-untar-buffer dirname) - (package-generate-autoloads (symbol-name name) pkg-dir) - (let ((load-path (cons pkg-dir load-path))) - (byte-recompile-directory pkg-dir 0 t))))) + (package--make-autoloads-and-compile name pkg-dir)))) + +(defun package--make-autoloads-and-compile (name pkg-dir) + "Generate autoloads and do byte-compilation for package named NAME. +PKG-DIR is the name of the package directory." + (package-generate-autoloads name pkg-dir) + (let ((load-path (cons pkg-dir load-path))) + ;; We must load the autoloads file before byte compiling, in + ;; case there are magic cookies to set up non-trivial paths. + (load (expand-file-name (concat name "-autoloads") pkg-dir) nil t) + (byte-recompile-directory pkg-dir 0 t))) (defun package--write-file-no-coding (file-name) (let ((buffer-file-coding-system 'no-conversion)) @@ -656,9 +665,7 @@ nil pkg-file nil nil nil 'excl)) - (package-generate-autoloads file-name pkg-dir) - (let ((load-path (cons pkg-dir load-path))) - (byte-recompile-directory pkg-dir 0 t))))) + (package--make-autoloads-and-compile file-name pkg-dir)))) (defmacro package--with-work-buffer (location file &rest body) "Run BODY in a buffer containing the contents of FILE at LOCATION. ------------------------------------------------------------ revno: 107580 author: Christopher Schmidt committer: Chong Yidong branch nick: trunk timestamp: Mon 2012-03-12 10:41:22 +0800 message: * ibuffer.el (ibuffer-redisplay): Remove another gratuitous error. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-03-11 17:58:16 +0000 +++ lisp/ChangeLog 2012-03-12 02:41:22 +0000 @@ -1,3 +1,7 @@ +2012-03-12 Christopher Schmidt + + * ibuffer.el (ibuffer-redisplay): Remove another gratuitous error. + 2012-03-11 Michael Albinus * autorevert.el (auto-revert-handler): Ensure, that === modified file 'lisp/ibuffer.el' --- lisp/ibuffer.el 2012-03-11 17:31:44 +0000 +++ lisp/ibuffer.el 2012-03-12 02:41:22 +0000 @@ -2173,11 +2173,10 @@ (cadr bufs)) (ibuffer-current-buffers-with-marks bufs) ibuffer-display-maybe-show-predicates))) - (when (null blist) - (if (and (featurep 'ibuf-ext) - ibuffer-filtering-qualifiers) - (message "No buffers! (note: filtering in effect)") - (error "No buffers!"))) + (and (null blist) + (featurep 'ibuf-ext) + ibuffer-filtering-qualifiers + (message "No buffers! (note: filtering in effect)")) (unless silent (message "Updating buffer list...")) (ibuffer-redisplay-engine blist arg) ------------------------------------------------------------ revno: 107579 committer: David Engster branch nick: trunk timestamp: Sun 2012-03-11 21:29:14 +0100 message: * semantic/wisent/javascript.el (js-mode): Define `js-mode' as child-mode of `javascript-mode' (bug #8445). diff: === modified file 'lisp/cedet/ChangeLog' --- lisp/cedet/ChangeLog 2012-02-28 08:17:21 +0000 +++ lisp/cedet/ChangeLog 2012-03-11 20:29:14 +0000 @@ -1,3 +1,8 @@ +2012-03-11 David Engster + + * semantic/wisent/javascript.el (js-mode): Define `js-mode' as + child-mode of `javascript-mode' (bug #8445). + 2012-02-28 Glenn Morris * semantic/db.el (semanticdb-search-results-table): === modified file 'lisp/cedet/semantic/wisent/javascript.el' --- lisp/cedet/semantic/wisent/javascript.el 2012-01-19 07:21:25 +0000 +++ lisp/cedet/semantic/wisent/javascript.el 2012-03-11 20:29:14 +0000 @@ -75,6 +75,10 @@ ;; ;; This sets up the javascript parser +;; Since javascript-mode is an alias for js-mode, let it inherit all +;; the overrides. +(define-child-mode js-mode javascript-mode) + ;; In semantic-imenu.el, not part of Emacs. (defvar semantic-imenu-summary-function) ------------------------------------------------------------ revno: 107578 committer: Michael Albinus branch nick: trunk timestamp: Sun 2012-03-11 19:02:48 +0100 message: Fix previous patch. diff: === modified file 'lisp/autorevert.el' --- lisp/autorevert.el 2012-03-11 17:58:16 +0000 +++ lisp/autorevert.el 2012-03-11 18:02:48 +0000 @@ -444,11 +444,11 @@ ;; `remote-file-name-inhibit-cache' forces Tramp ;; to reread the values. (let ((remote-file-name-inhibit-cache t)) - (file-readable-p buffer-file-name) - (/= auto-revert-tail-pos - (setq size - (nth 7 (file-attributes - buffer-file-name))))) + (and (file-readable-p buffer-file-name) + (/= auto-revert-tail-pos + (setq size + (nth 7 (file-attributes + buffer-file-name)))))) (and (not (file-remote-p buffer-file-name)) (file-readable-p buffer-file-name) (not (verify-visited-file-modtime buffer))))) ------------------------------------------------------------ revno: 107577 committer: Michael Albinus branch nick: trunk timestamp: Sun 2012-03-11 18:58:16 +0100 message: * autorevert.el (auto-revert-handler): Ensure, that file-readable-p is applied only for local files or in auto-revert-tail-mode. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-03-11 17:54:16 +0000 +++ lisp/ChangeLog 2012-03-11 17:58:16 +0000 @@ -1,3 +1,9 @@ +2012-03-11 Michael Albinus + + * autorevert.el (auto-revert-handler): Ensure, that + file-readable-p is applied only for local files or in + auto-revert-tail-mode. + 2012-03-11 Andreas Schwab * server.el (server-eval-at): Handle non-tcp connections. Decode === modified file 'lisp/autorevert.el' --- lisp/autorevert.el 2012-01-19 07:21:25 +0000 +++ lisp/autorevert.el 2012-03-11 17:58:16 +0000 @@ -439,17 +439,18 @@ (let* ((buffer (current-buffer)) size (revert (or (and buffer-file-name - (file-readable-p buffer-file-name) (if auto-revert-tail-mode ;; Tramp caches the file attributes. Setting ;; `remote-file-name-inhibit-cache' forces Tramp ;; to reread the values. (let ((remote-file-name-inhibit-cache t)) + (file-readable-p buffer-file-name) (/= auto-revert-tail-pos (setq size (nth 7 (file-attributes buffer-file-name))))) (and (not (file-remote-p buffer-file-name)) + (file-readable-p buffer-file-name) (not (verify-visited-file-modtime buffer))))) (and (or auto-revert-mode global-auto-revert-non-file-buffers) ------------------------------------------------------------ revno: 107576 committer: Andreas Schwab branch nick: emacs timestamp: Sun 2012-03-11 18:54:16 +0100 message: * server.el (server-eval-at): Handle non-tcp connections. Decode result string. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-03-11 17:53:07 +0000 +++ lisp/ChangeLog 2012-03-11 17:54:16 +0000 @@ -1,5 +1,8 @@ 2012-03-11 Andreas Schwab + * server.el (server-eval-at): Handle non-tcp connections. Decode + result string. + * server.el (server-msg-size): New constant. (server-reply-print): New function. (server-eval-and-print): Use it. === modified file 'lisp/server.el' --- lisp/server.el 2012-03-11 17:53:07 +0000 +++ lisp/server.el 2012-03-11 17:54:16 +0000 @@ -1559,34 +1559,39 @@ Returns the result of the evaluation, or signals an error if it cannot contact the specified server. For example: \(server-eval-at \"server\" '(emacs-pid)) -returns the process ID of the Emacs instance running \"server\". -This function requires the use of TCP sockets. " - (or server-use-tcp - (error "This function requires TCP sockets")) - (let ((auth-file (expand-file-name server server-auth-dir)) - (coding-system-for-read 'binary) - (coding-system-for-write 'binary) - address port secret process) - (unless (file-exists-p auth-file) - (error "No such server definition: %s" auth-file)) +returns the process ID of the Emacs instance running \"server\"." + (let* ((server-dir (if server-use-tcp server-auth-dir server-socket-dir)) + (server-file (expand-file-name server server-dir)) + (coding-system-for-read 'binary) + (coding-system-for-write 'binary) + address port secret process) + (unless (file-exists-p server-file) + (error "No such server: %s" server)) (with-temp-buffer - (insert-file-contents auth-file) - (unless (looking-at "\\([0-9.]+\\):\\([0-9]+\\)") - (error "Invalid auth file")) - (setq address (match-string 1) - port (string-to-number (match-string 2))) - (forward-line 1) - (setq secret (buffer-substring (point) (line-end-position))) - (erase-buffer) - (unless (setq process (open-network-stream "eval-at" (current-buffer) - address port)) - (error "Unable to contact the server")) - (set-process-query-on-exit-flag process nil) - (process-send-string - process - (concat "-auth " secret " -eval " - (server-quote-arg (format "%S" form)) - "\n")) + (when server-use-tcp + (let ((coding-system-for-read 'no-conversion)) + (insert-file-contents server-file) + (unless (looking-at "\\([0-9.]+\\):\\([0-9]+\\)") + (error "Invalid auth file")) + (setq address (match-string 1) + port (string-to-number (match-string 2))) + (forward-line 1) + (setq secret (buffer-substring (point) (line-end-position))) + (erase-buffer))) + (unless (setq process (make-network-process + :name "eval-at" + :buffer (current-buffer) + :host address + :service (if server-use-tcp port server-file) + :family (if server-use-tcp 'ipv4 'local) + :noquery t)) + (error "Unable to contact the server")) + (if server-use-tcp + (process-send-string process (concat "-auth " secret "\n"))) + (process-send-string process + (concat "-eval " + (server-quote-arg (format "%S" form)) + "\n")) (while (memq (process-status process) '(open run)) (accept-process-output process 0 10)) (goto-char (point-min)) @@ -1600,7 +1605,8 @@ (progn (skip-chars-forward "^\n") (point)))))) (if (not (equal answer "")) - (read (server-unquote-arg answer))))))) + (read (decode-coding-string (server-unquote-arg answer) + 'emacs-internal))))))) (provide 'server) ------------------------------------------------------------ revno: 107575 committer: Andreas Schwab branch nick: emacs timestamp: Sun 2012-03-11 18:53:07 +0100 message: Define -print-nonl client command * lib-src/emacsclient.c (main): Handle -print-nonl command. * lisp/server.el (server-msg-size): New constant. (server-reply-print): New function. (server-eval-and-print): Use it. (server-eval-at): Use server-quote-arg and server-unquote-arg. Handle -print-nonl. diff: === modified file 'lib-src/ChangeLog' --- lib-src/ChangeLog 2012-03-11 11:49:59 +0000 +++ lib-src/ChangeLog 2012-03-11 17:53:07 +0000 @@ -1,5 +1,7 @@ 2012-03-11 Andreas Schwab + * emacsclient.c (main): Handle -print-nonl command. + * emacsclient.c (main): Handle multiple messages in a single datagram. === modified file 'lib-src/emacsclient.c' --- lib-src/emacsclient.c 2012-03-11 11:49:59 +0000 +++ lib-src/emacsclient.c 2012-03-11 17:53:07 +0000 @@ -1812,6 +1812,14 @@ printf ("%s", str); needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n'; } + else if (strprefix ("-print-nonl ", p)) + { + /* -print-nonl STRING: Print STRING on the terminal. + Used to continue a preceding -print command. */ + str = unquote_argument (p + strlen ("-print-nonl ")); + printf ("%s", str); + needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n'; + } else if (strprefix ("-error ", p)) { /* -error DESCRIPTION: Signal an error on the terminal. */ === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-03-11 17:31:44 +0000 +++ lisp/ChangeLog 2012-03-11 17:53:07 +0000 @@ -1,3 +1,11 @@ +2012-03-11 Andreas Schwab + + * server.el (server-msg-size): New constant. + (server-reply-print): New function. + (server-eval-and-print): Use it. + (server-eval-at): Use server-quote-arg and server-unquote-arg. + Handle -print-nonl. + 2012-03-11 Christopher Schmidt * ibuffer.el (ibuffer-redisplay): Remove gratuitous error === modified file 'lisp/server.el' --- lisp/server.el 2012-02-08 16:48:25 +0000 +++ lisp/server.el 2012-03-11 17:53:07 +0000 @@ -706,9 +706,29 @@ (pp v) (let ((text (buffer-substring-no-properties (point-min) (point-max)))) - (server-send-string - proc (format "-print %s\n" - (server-quote-arg text))))))))) + (server-reply-print (server-quote-arg text) proc))))))) + +(defconst server-msg-size 1024 + "Maximum size of a message sent to a client.") + +(defun server-reply-print (qtext proc) + "Send a `-print QTEXT' command to client PROC. +QTEXT must be already quoted. +This handles splitting the command if it would be bigger than +`server-msg-size'." + (let ((prefix "-print ") + part) + (while (> (+ (length qtext) (length prefix) 1) server-msg-size) + ;; We have to split the string + (setq part (substring qtext 0 (- server-msg-size (length prefix) 1))) + ;; Don't split in the middle of a quote sequence + (if (string-match "\\(^\\|[^&]\\)\\(&&\\)+$" part) + ;; There is an uneven number of & at the end + (setq part (substring part 0 -1))) + (setq qtext (substring qtext (length part))) + (server-send-string proc (concat prefix part "\n")) + (setq prefix "-print-nonl ")) + (server-send-string proc (concat prefix qtext "\n")))) (defun server-create-tty-frame (tty type proc) (unless tty @@ -911,6 +931,11 @@ Print STRING on stdout. Used to send values returned by -eval. +`-print-nonl STRING' + Print STRING on stdout. Used to continue a + preceding -print command that would be too big to send + in a single message. + `-error DESCRIPTION' Signal an error and delete process PROC. @@ -1560,20 +1585,22 @@ (process-send-string process (concat "-auth " secret " -eval " - (replace-regexp-in-string - " " "&_" (format "%S" form)) + (server-quote-arg (format "%S" form)) "\n")) (while (memq (process-status process) '(open run)) (accept-process-output process 0 10)) (goto-char (point-min)) ;; If the result is nil, there's nothing in the buffer. If the ;; result is non-nil, it's after "-print ". - (when (search-forward "\n-print" nil t) - (let ((start (point))) - (while (search-forward "&_" nil t) - (replace-match " " t t)) - (goto-char start) - (read (current-buffer))))))) + (let ((answer "")) + (while (re-search-forward "\n-print\\(-nonl\\)? " nil t) + (setq answer + (concat answer + (buffer-substring (point) + (progn (skip-chars-forward "^\n") + (point)))))) + (if (not (equal answer "")) + (read (server-unquote-arg answer))))))) (provide 'server) ------------------------------------------------------------ revno: 107574 fixes bug(s): http://debbugs.gnu.org/10987 author: Christopher Schmidt committer: Chong Yidong branch nick: trunk timestamp: Mon 2012-03-12 01:31:44 +0800 message: * ibuffer.el (ibuffer-redisplay): Remove gratuitous error. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-03-11 16:57:04 +0000 +++ lisp/ChangeLog 2012-03-11 17:31:44 +0000 @@ -1,3 +1,8 @@ +2012-03-11 Christopher Schmidt + + * ibuffer.el (ibuffer-redisplay): Remove gratuitous error + (Bug#10987). + 2012-03-11 Chong Yidong * simple.el (goto-line): Doc fix (Bug#9938). === modified file 'lisp/ibuffer.el' --- lisp/ibuffer.el 2012-01-19 07:21:25 +0000 +++ lisp/ibuffer.el 2012-03-11 17:31:44 +0000 @@ -2140,11 +2140,10 @@ (unless silent (message "Redisplaying current buffer list...")) (let ((blist (ibuffer-current-state-list))) - (when (null blist) - (if (and (featurep 'ibuf-ext) + (when (and (null blist) + (featurep 'ibuf-ext) (or ibuffer-filtering-qualifiers ibuffer-hidden-filter-groups)) - (message "No buffers! (note: filtering in effect)") - (error "No buffers!"))) + (message "No buffers! (note: filtering in effect)")) (ibuffer-redisplay-engine blist t) (unless silent (message "Redisplaying current buffer list...done")) ------------------------------------------------------------ revno: 107573 fixes bug(s): http://debbugs.gnu.org/9700 committer: Chong Yidong branch nick: trunk timestamp: Mon 2012-03-12 01:08:10 +0800 message: * keymap.c (Fkey_description): Doc fix. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-03-11 16:27:36 +0000 +++ src/ChangeLog 2012-03-11 17:08:10 +0000 @@ -1,5 +1,7 @@ 2012-03-11 Chong Yidong + * keymap.c (Fkey_description): Doc fix (Bug#9700). + * editfns.c (Fconstrain_to_field): Doc fix (Bug#9452). 2012-03-10 Chong Yidong === modified file 'src/keymap.c' --- src/keymap.c 2012-02-13 15:55:27 +0000 +++ src/keymap.c 2012-03-11 17:08:10 +0000 @@ -2043,8 +2043,9 @@ DEFUN ("key-description", Fkey_description, Skey_description, 1, 2, 0, doc: /* Return a pretty description of key-sequence KEYS. Optional arg PREFIX is the sequence of keys leading up to KEYS. -Control characters turn into "C-foo" sequences, meta into "M-foo", -spaces are put between sequence elements, etc. */) +For example, [?\C-x ?l] is converted into the string \"C-x l\". + +The `kbd' macro is an approximate inverse of this. */) (Lisp_Object keys, Lisp_Object prefix) { int len = 0; ------------------------------------------------------------ revno: 107572 fixes bug(s): http://debbugs.gnu.org/9938 committer: Chong Yidong branch nick: trunk timestamp: Mon 2012-03-12 00:57:04 +0800 message: * simple.el (goto-line): Doc fix. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-03-11 16:10:07 +0000 +++ lisp/ChangeLog 2012-03-11 16:57:04 +0000 @@ -1,5 +1,7 @@ 2012-03-11 Chong Yidong + * simple.el (goto-line): Doc fix (Bug#9938). + * subr.el (save-window-excursion): Doc fix (Bug#9979). * dabbrev.el (dabbrev--find-expansion): Update progress reporter === modified file 'lisp/simple.el' --- lisp/simple.el 2012-03-05 15:53:34 +0000 +++ lisp/simple.el 2012-03-11 16:57:04 +0000 @@ -893,16 +893,23 @@ ;; Counting lines, one way or another. (defun goto-line (line &optional buffer) - "Goto LINE, counting from line 1 at beginning of buffer. -Normally, move point in the current buffer, and leave mark at the -previous position. With just \\[universal-argument] as argument, -move point in the most recently selected other buffer, and switch to it. - -If there's a number in the buffer at point, it is the default for LINE. + "Go to LINE, counting from line 1 at beginning of buffer. +If called interactively, a numeric prefix argument specifies +LINE; without a numeric prefix argument, read LINE from the +minibuffer. + +If optional argument BUFFER is non-nil, switch to that buffer and +move to line LINE there. If called interactively with \\[universal-argument] +as argument, BUFFER is the most recently selected other buffer. + +Prior to moving point, this function sets the mark (without +activating it), unless Transient Mark mode is enabled and the +mark is already active. This function is usually the wrong thing to use in a Lisp program. What you probably want instead is something like: - (goto-char (point-min)) (forward-line (1- N)) + (goto-char (point-min)) + (forward-line (1- N)) If at all possible, an even better solution is to use char counts rather than line counts." (interactive ------------------------------------------------------------ revno: 107571 fixes bug(s): http://debbugs.gnu.org/9452 committer: Chong Yidong branch nick: trunk timestamp: Mon 2012-03-12 00:27:36 +0800 message: * src/editfns.c (Fconstrain_to_field): Doc fix. * doc/lispref/text.texi (Fields): Minor copyedit. diff: === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2012-03-11 16:10:07 +0000 +++ doc/lispref/ChangeLog 2012-03-11 16:27:36 +0000 @@ -6,6 +6,8 @@ * display.texi (Temporary Displays): with-output-to-temp-buffer is now a macro. + * text.texi (Fields): Minor copyedit. + 2012-03-10 Eli Zaretskii * strings.texi (String Basics): === modified file 'doc/lispref/text.texi' --- doc/lispref/text.texi 2012-03-08 05:27:03 +0000 +++ doc/lispref/text.texi 2012-03-11 16:27:36 +0000 @@ -3777,7 +3777,7 @@ If @var{new-pos} is @code{nil}, then @code{constrain-to-field} uses the value of point instead, and moves point to the resulting position -as well as returning it. +in addition to returning that position. If @var{old-pos} is at the boundary of two fields, then the acceptable final positions depend on the argument @var{escape-from-edge}. If === modified file 'src/ChangeLog' --- src/ChangeLog 2012-03-10 07:46:07 +0000 +++ src/ChangeLog 2012-03-11 16:27:36 +0000 @@ -1,3 +1,7 @@ +2012-03-11 Chong Yidong + + * editfns.c (Fconstrain_to_field): Doc fix (Bug#9452). + 2012-03-10 Chong Yidong * frame.c (other_visible_frames): Don't assume the selected frame === modified file 'src/editfns.c' --- src/editfns.c 2012-01-19 07:21:25 +0000 +++ src/editfns.c 2012-03-11 16:27:36 +0000 @@ -663,10 +663,11 @@ DEFUN ("constrain-to-field", Fconstrain_to_field, Sconstrain_to_field, 2, 5, 0, doc: /* Return the position closest to NEW-POS that is in the same field as OLD-POS. - A field is a region of text with the same `field' property. -If NEW-POS is nil, then the current point is used instead, and set to the -constrained position if that is different. + +If NEW-POS is nil, then use the current point instead, and move point +to the resulting constrained position, in addition to returning that +position. If OLD-POS is at the boundary of two fields, then the allowable positions for NEW-POS depends on the value of the optional argument ------------------------------------------------------------ revno: 107570 committer: Chong Yidong branch nick: trunk timestamp: Mon 2012-03-12 00:16:50 +0800 message: Further doc fix for save-window-excursion. diff: === modified file 'lisp/subr.el' --- lisp/subr.el 2012-03-11 16:10:07 +0000 +++ lisp/subr.el 2012-03-11 16:16:50 +0000 @@ -3027,11 +3027,11 @@ (defmacro save-window-excursion (&rest body) "Execute BODY, then restore previous window configuration. -Return the value of the last form in BODY. -Restore which buffer appears in which window, where display -starts, and the value of point and mark for each window, as well -as the choice of selected window, and which buffer is current. -The value of point in the current buffer is not restored. +This macro saves the window configuration on the selected frame, +executes BODY, then calls `set-window-configuration' to restore +the saved window configuration. The return value is the last +form in BODY. The window configuration is also restored if BODY +exits nonlocally. BEWARE: Most uses of this macro introduce bugs. E.g. it should not be used to try and prevent some code from opening ------------------------------------------------------------ revno: 107569 fixes bug(s): http://debbugs.gnu.org/9979 committer: Chong Yidong branch nick: trunk timestamp: Mon 2012-03-12 00:10:07 +0800 message: Doc fixes for save-window-excursion. * lisp/subr.el (save-window-excursion): Doc fix. * doc/lispref/windows.texi (Window Configurations): save-window-excursion is now a macro. * doc/lispref/display.texi (Temporary Displays): with-output-to-temp-buffer is now a macro. diff: === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2012-03-10 09:55:54 +0000 +++ doc/lispref/ChangeLog 2012-03-11 16:10:07 +0000 @@ -1,3 +1,11 @@ +2012-03-11 Chong Yidong + + * windows.texi (Window Configurations): save-window-excursion is + now a macro. + + * display.texi (Temporary Displays): with-output-to-temp-buffer is + now a macro. + 2012-03-10 Eli Zaretskii * strings.texi (String Basics): === modified file 'doc/lispref/display.texi' --- doc/lispref/display.texi 2012-03-04 06:50:18 +0000 +++ doc/lispref/display.texi 2012-03-11 16:10:07 +0000 @@ -1031,7 +1031,7 @@ buffer and then present it to the user for perusal rather than for editing. Many help commands use this feature. -@defspec with-output-to-temp-buffer buffer-name forms@dots{} +@defmac with-output-to-temp-buffer buffer-name forms@dots{} This function executes @var{forms} while arranging to insert any output they print into the buffer named @var{buffer-name}, which is first created if necessary, and put into Help mode. Finally, the buffer is @@ -1083,7 +1083,7 @@ ---------- Buffer: foo ---------- @end group @end example -@end defspec +@end defmac @defopt temp-buffer-show-function If this variable is non-@code{nil}, @code{with-output-to-temp-buffer} === modified file 'doc/lispref/windows.texi' --- doc/lispref/windows.texi 2012-03-04 06:50:18 +0000 +++ doc/lispref/windows.texi 2012-03-11 16:10:07 +0000 @@ -3142,7 +3142,7 @@ @end example @end defun -@defspec save-window-excursion forms@dots{} +@defmac save-window-excursion forms@dots{} This special form records the window configuration, executes @var{forms} in sequence, then restores the earlier window configuration. The window configuration includes, for each window, the value of point and the @@ -3179,7 +3179,7 @@ ;; @r{The screen is now split again.} @end group @end example -@end defspec +@end defmac @defun window-configuration-p object This function returns @code{t} if @var{object} is a window configuration. === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-03-11 15:45:44 +0000 +++ lisp/ChangeLog 2012-03-11 16:10:07 +0000 @@ -1,5 +1,7 @@ 2012-03-11 Chong Yidong + * subr.el (save-window-excursion): Doc fix (Bug#9979). + * dabbrev.el (dabbrev--find-expansion): Update progress reporter when finished (Bug#10963). === modified file 'lisp/subr.el' --- lisp/subr.el 2012-02-10 15:59:29 +0000 +++ lisp/subr.el 2012-03-11 16:10:07 +0000 @@ -3026,13 +3026,12 @@ (set-buffer ,old-buffer)))))) (defmacro save-window-excursion (&rest body) - "Execute BODY, preserving window sizes and contents. + "Execute BODY, then restore previous window configuration. Return the value of the last form in BODY. -Restore which buffer appears in which window, where display starts, -and the value of point and mark for each window. -Also restore the choice of selected window. -Also restore which buffer is current. -Does not restore the value of point in current buffer. +Restore which buffer appears in which window, where display +starts, and the value of point and mark for each window, as well +as the choice of selected window, and which buffer is current. +The value of point in the current buffer is not restored. BEWARE: Most uses of this macro introduce bugs. E.g. it should not be used to try and prevent some code from opening ------------------------------------------------------------ revno: 107568 committer: Chong Yidong branch nick: trunk timestamp: Sun 2012-03-11 23:45:44 +0800 message: * dabbrev.el (dabbrev--find-expansion): Update progress reporter. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-03-11 13:30:30 +0000 +++ lisp/ChangeLog 2012-03-11 15:45:44 +0000 @@ -1,3 +1,8 @@ +2012-03-11 Chong Yidong + + * dabbrev.el (dabbrev--find-expansion): Update progress reporter + when finished (Bug#10963). + 2012-03-11 Martin Rudalics * window.el (split-window-below): Fix bug in case where === modified file 'lisp/dabbrev.el' --- lisp/dabbrev.el 2012-01-19 07:21:25 +0000 +++ lisp/dabbrev.el 2012-03-11 15:45:44 +0000 @@ -763,6 +763,7 @@ (- (length dabbrev--friend-buffer-list))) (setq dabbrev--last-expansion-location (point-min)) (setq expansion (dabbrev--try-find abbrev nil 1 ignore-case))) + (progress-reporter-done dabbrev--progress-reporter) expansion))))) ;; Compute the list of buffers to scan. ------------------------------------------------------------ revno: 107567 fixes bug(s): http://debbugs.gnu.org/10223 committer: Chong Yidong branch nick: trunk timestamp: Sun 2012-03-11 23:12:26 +0800 message: Allow url-http to handle expired keepalive connections. * lisp/url/url-http.el (url-http-end-of-document-sentinel): Handle keepalive expiry by calling url-http again. (url-http): New arg, for the above. diff: === modified file 'lisp/url/ChangeLog' --- lisp/url/ChangeLog 2012-03-11 09:43:01 +0000 +++ lisp/url/ChangeLog 2012-03-11 15:12:26 +0000 @@ -1,3 +1,9 @@ +2012-03-11 Chong Yidong + + * url-http.el (url-http-end-of-document-sentinel): Handle + keepalive expiry by calling url-http again (Bug#10223). + (url-http): New arg, for the above. + 2012-03-11 Devon Sean McCullough * url-http.el (url-http-find-free-connection): Don't pass a nil === modified file 'lisp/url/url-http.el' --- lisp/url/url-http.el 2012-03-11 09:43:01 +0000 +++ lisp/url/url-http.el 2012-03-11 15:12:26 +0000 @@ -27,6 +27,7 @@ (eval-when-compile (require 'cl)) (defvar url-http-extra-headers) (defvar url-http-target-url) +(defvar url-http-no-retry) (defvar url-http-proxy) (defvar url-http-connection-opened) (require 'url-gw) @@ -875,19 +876,26 @@ url-http-open-connections)) (defun url-http-end-of-document-sentinel (proc why) - ;; Sentinel used for old HTTP/0.9 or connections we know are going - ;; to die as the 'end of document' notifier. + ;; Sentinel used to handle (i) terminated old HTTP/0.9 connections, + ;; and (ii) closed connection due to reusing a HTTP connection which + ;; we believed was still alive, but which the server closed on us. + ;; We handle case (ii) by calling `url-http' again. (url-http-debug "url-http-end-of-document-sentinel in buffer (%s)" (process-buffer proc)) (url-http-idle-sentinel proc why) (when (buffer-name (process-buffer proc)) (with-current-buffer (process-buffer proc) (goto-char (point-min)) - (if (not (looking-at "HTTP/")) - ;; HTTP/0.9 just gets passed back no matter what - (url-http-activate-callback) - (if (url-http-parse-headers) - (url-http-activate-callback)))))) + (cond ((not (looking-at "HTTP/")) + (if url-http-no-retry + ;; HTTP/0.9 just gets passed back no matter what + (url-http-activate-callback) + ;; Call `url-http' again if our connection expired. + (erase-buffer) + (url-http url-current-object url-callback-function + url-callback-arguments (current-buffer)))) + ((url-http-parse-headers) + (url-http-activate-callback)))))) (defun url-http-simple-after-change-function (st nd length) ;; Function used when we do NOT know how long the document is going to be @@ -1165,11 +1173,14 @@ (goto-char (point-max))))) ;;;###autoload -(defun url-http (url callback cbargs) +(defun url-http (url callback cbargs &optional retry-buffer) "Retrieve URL via HTTP asynchronously. URL must be a parsed URL. See `url-generic-parse-url' for details. When retrieval is completed, the function CALLBACK is executed with -CBARGS as the arguments." +CBARGS as the arguments. + +Optional arg RETRY-BUFFER, if non-nil, specifies the buffer of a +previous `url-http' call, which is being re-attempted." (check-type url vector "Need a pre-parsed URL.") (declare (special url-current-object url-http-end-of-headers @@ -1190,7 +1201,8 @@ (let* ((host (url-host (or url-using-proxy url))) (port (url-port (or url-using-proxy url))) (connection (url-http-find-free-connection host port)) - (buffer (generate-new-buffer (format " *http %s:%d*" host port)))) + (buffer (or retry-buffer + (generate-new-buffer (format " *http %s:%d*" host port))))) (if (not connection) ;; Failed to open the connection for some reason (progn @@ -1220,6 +1232,7 @@ url-http-extra-headers url-http-data url-http-target-url + url-http-no-retry url-http-connection-opened url-http-proxy)) (set (make-local-variable var) nil)) @@ -1235,6 +1248,7 @@ url-callback-arguments cbargs url-http-after-change-function 'url-http-wait-for-headers-change-function url-http-target-url url-current-object + url-http-no-retry retry-buffer url-http-connection-opened nil url-http-proxy url-using-proxy) @@ -1261,6 +1275,7 @@ (with-current-buffer (process-buffer proc) (cond (url-http-connection-opened + (setq url-http-no-retry t) (url-http-end-of-document-sentinel proc why)) ((string= (substring why 0 4) "open") (setq url-http-connection-opened t) ------------------------------------------------------------ revno: 107566 committer: martin rudalics branch nick: trunk timestamp: Sun 2012-03-11 14:30:30 +0100 message: In split-window-below fix handling of split-window-keep-point (Bug#10971). * window.el (split-window-below): Fix bug in case where split-window-keep-point is nil (Bug#10971). diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-03-11 10:27:53 +0000 +++ lisp/ChangeLog 2012-03-11 13:30:30 +0000 @@ -1,3 +1,8 @@ +2012-03-11 Martin Rudalics + + * window.el (split-window-below): Fix bug in case where + split-window-keep-point is nil (Bug#10971). + 2012-03-11 Juri Linkov * replace.el (replace-highlight): Set isearch-word to nil === modified file 'lisp/window.el' --- lisp/window.el 2012-02-12 05:10:30 +0000 +++ lisp/window.el 2012-03-11 13:30:30 +0000 @@ -3273,7 +3273,7 @@ amount of redisplay; this is convenient on slow terminals." (interactive "P") (let ((old-window (selected-window)) - (old-point (point)) + (old-point (window-point-1)) (size (and size (prefix-numeric-value size))) moved-by-window-height moved new-window bottom) (when (and size (< size 0) (< (- size) window-min-height)) @@ -3282,22 +3282,27 @@ (setq new-window (split-window nil size)) (unless split-window-keep-point (with-current-buffer (window-buffer) - (goto-char (window-start)) - (setq moved (vertical-motion (window-height))) - (set-window-start new-window (point)) - (when (> (point) (window-point new-window)) - (set-window-point new-window (point))) - (when (= moved (window-height)) - (setq moved-by-window-height t) - (vertical-motion -1)) - (setq bottom (point))) - (and moved-by-window-height - (<= bottom (point)) - (set-window-point old-window (1- bottom))) - (and moved-by-window-height - (<= (window-start new-window) old-point) - (set-window-point new-window old-point) - (select-window new-window))) + ;; Use `save-excursion' around vertical movements below + ;; (Bug#10971). Note: When the selected window's buffer has a + ;; header line, up to two lines of the buffer may not show up + ;; in the resulting configuration. + (save-excursion + (goto-char (window-start)) + (setq moved (vertical-motion (window-height))) + (set-window-start new-window (point)) + (when (> (point) (window-point new-window)) + (set-window-point new-window (point))) + (when (= moved (window-height)) + (setq moved-by-window-height t) + (vertical-motion -1)) + (setq bottom (point))) + (and moved-by-window-height + (<= bottom (point)) + (set-window-point-1 old-window (1- bottom))) + (and moved-by-window-height + (<= (window-start new-window) old-point) + (set-window-point new-window old-point) + (select-window new-window)))) ;; Always copy quit-restore parameter in interactive use. (let ((quit-restore (window-parameter old-window 'quit-restore))) (when quit-restore ------------------------------------------------------------ revno: 107565 committer: Andreas Schwab branch nick: emacs timestamp: Sun 2012-03-11 12:49:59 +0100 message: * emacsclient.c (main): Handle multiple messages in a single datagram. diff: === modified file 'lib-src/ChangeLog' --- lib-src/ChangeLog 2012-03-11 11:15:25 +0000 +++ lib-src/ChangeLog 2012-03-11 11:49:59 +0000 @@ -1,5 +1,8 @@ 2012-03-11 Andreas Schwab + * emacsclient.c (main): Handle multiple messages in a single + datagram. + * emacsclient.c (socket_name): Add const. (get_server_config): Add parameter config_file, use it instead of global server_file. === modified file 'lib-src/emacsclient.c' --- lib-src/emacsclient.c 2012-03-11 11:15:25 +0000 +++ lib-src/emacsclient.c 2012-03-11 11:49:59 +0000 @@ -1768,7 +1768,7 @@ /* Now, wait for an answer and print any messages. */ while (exit_status == EXIT_SUCCESS) { - char *p; + char *p, *end_p; do { errno = 0; @@ -1783,61 +1783,64 @@ string[rl] = '\0'; - p = string + strlen (string) - 1; - while (p > string && *p == '\n') - *p-- = 0; + /* Loop over all NL-terminated messages. */ + for (end_p = p = string; end_p != NULL && *end_p != '\0'; p = end_p) + { + end_p = strchr (p, '\n'); + if (end_p != NULL) + *end_p++ = '\0'; - if (strprefix ("-emacs-pid ", string)) - { - /* -emacs-pid PID: The process id of the Emacs process. */ - emacs_pid = strtol (string + strlen ("-emacs-pid"), NULL, 10); - } - else if (strprefix ("-window-system-unsupported ", string)) - { - /* -window-system-unsupported: Emacs was compiled without X - support. Try again on the terminal. */ - nowait = 0; - tty = 1; - goto retry; - } - else if (strprefix ("-print ", string)) - { - /* -print STRING: Print STRING on the terminal. */ - str = unquote_argument (string + strlen ("-print ")); - if (needlf) - printf ("\n"); - printf ("%s", str); - needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n'; - } - else if (strprefix ("-error ", string)) - { - /* -error DESCRIPTION: Signal an error on the terminal. */ - str = unquote_argument (string + strlen ("-error ")); - if (needlf) - printf ("\n"); - fprintf (stderr, "*ERROR*: %s", str); - needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n'; - exit_status = EXIT_FAILURE; - } + if (strprefix ("-emacs-pid ", p)) + { + /* -emacs-pid PID: The process id of the Emacs process. */ + emacs_pid = strtol (p + strlen ("-emacs-pid"), NULL, 10); + } + else if (strprefix ("-window-system-unsupported ", p)) + { + /* -window-system-unsupported: Emacs was compiled without X + support. Try again on the terminal. */ + nowait = 0; + tty = 1; + goto retry; + } + else if (strprefix ("-print ", p)) + { + /* -print STRING: Print STRING on the terminal. */ + str = unquote_argument (p + strlen ("-print ")); + if (needlf) + printf ("\n"); + printf ("%s", str); + needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n'; + } + else if (strprefix ("-error ", p)) + { + /* -error DESCRIPTION: Signal an error on the terminal. */ + str = unquote_argument (p + strlen ("-error ")); + if (needlf) + printf ("\n"); + fprintf (stderr, "*ERROR*: %s", str); + needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n'; + exit_status = EXIT_FAILURE; + } #ifdef SIGSTOP - else if (strprefix ("-suspend ", string)) - { - /* -suspend: Suspend this terminal, i.e., stop the process. */ - if (needlf) - printf ("\n"); - needlf = 0; - kill (0, SIGSTOP); - } + else if (strprefix ("-suspend ", p)) + { + /* -suspend: Suspend this terminal, i.e., stop the process. */ + if (needlf) + printf ("\n"); + needlf = 0; + kill (0, SIGSTOP); + } #endif - else - { - /* Unknown command. */ - if (needlf) - printf ("\n"); - printf ("*ERROR*: Unknown message: %s", string); - needlf = string[0] - == '\0' ? needlf : string[strlen (string) - 1] != '\n'; - } + else + { + /* Unknown command. */ + if (needlf) + printf ("\n"); + needlf = 0; + printf ("*ERROR*: Unknown message: %s\n", p); + } + } } if (needlf) ------------------------------------------------------------ revno: 107564 committer: Andreas Schwab branch nick: emacs timestamp: Sun 2012-03-11 12:15:25 +0100 message: Don't access freed memory in emacsclient * emacsclient.c (socket_name): Add const. (get_server_config): Add parameter config_file, use it instead of global server_file. (set_tcp_socket): Add parameter local_server_file, pass it down to get_server_config. (set_local_socket): Add parameter local_socket_name, use it instead of global socket_name. (set_socket): Adjust calls to set_local_socket and set_tcp_socket. Don't clobber global server_file or socket_name. (main): No longer reset server_file or socket_name. diff: === modified file 'lib-src/ChangeLog' --- lib-src/ChangeLog 2012-02-09 07:48:22 +0000 +++ lib-src/ChangeLog 2012-03-11 11:15:25 +0000 @@ -1,3 +1,16 @@ +2012-03-11 Andreas Schwab + + * emacsclient.c (socket_name): Add const. + (get_server_config): Add parameter config_file, use it instead of + global server_file. + (set_tcp_socket): Add parameter local_server_file, pass it down to + get_server_config. + (set_local_socket): Add parameter local_socket_name, use it + instead of global socket_name. + (set_socket): Adjust calls to set_local_socket and set_tcp_socket. + Don't clobber global server_file or socket_name. + (main): No longer reset server_file or socket_name. + 2012-01-05 Glenn Morris * ebrowse.c (version) : === modified file 'lib-src/emacsclient.c' --- lib-src/emacsclient.c 2012-01-19 07:21:25 +0000 +++ lib-src/emacsclient.c 2012-03-11 11:15:25 +0000 @@ -152,7 +152,7 @@ const char *alternate_editor = NULL; /* If non-NULL, the filename of the UNIX socket. */ -char *socket_name = NULL; +const char *socket_name = NULL; /* If non-NULL, the filename of the authentication file. */ const char *server_file = NULL; @@ -955,36 +955,37 @@ * the Emacs server: host, port, and authentication string. */ static int -get_server_config (struct sockaddr_in *server, char *authentication) +get_server_config (const char *config_file, struct sockaddr_in *server, + char *authentication) { char dotted[32]; char *port; FILE *config = NULL; - if (file_name_absolute_p (server_file)) - config = fopen (server_file, "rb"); + if (file_name_absolute_p (config_file)) + config = fopen (config_file, "rb"); else { const char *home = egetenv ("HOME"); if (home) { - char *path = xmalloc (strlen (home) + strlen (server_file) + char *path = xmalloc (strlen (home) + strlen (config_file) + EXTRA_SPACE); strcpy (path, home); strcat (path, "/.emacs.d/server/"); - strcat (path, server_file); + strcat (path, config_file); config = fopen (path, "rb"); free (path); } #ifdef WINDOWSNT if (!config && (home = egetenv ("APPDATA"))) { - char *path = xmalloc (strlen (home) + strlen (server_file) + char *path = xmalloc (strlen (home) + strlen (config_file) + EXTRA_SPACE); strcpy (path, home); strcat (path, "/.emacs.d/server/"); - strcat (path, server_file); + strcat (path, config_file); config = fopen (path, "rb"); free (path); } @@ -1019,14 +1020,14 @@ } static HSOCKET -set_tcp_socket (void) +set_tcp_socket (const char *local_server_file) { HSOCKET s; struct sockaddr_in server; struct linger l_arg = {1, 1}; char auth_string[AUTH_KEY_LENGTH + 1]; - if (! get_server_config (&server, auth_string)) + if (! get_server_config (local_server_file, &server, auth_string)) return INVALID_SOCKET; if (server.sin_addr.s_addr != inet_addr ("127.0.0.1") && !quiet) @@ -1236,7 +1237,7 @@ static HSOCKET -set_local_socket (void) +set_local_socket (const char *local_socket_name) { HSOCKET s; struct sockaddr_un server; @@ -1254,27 +1255,20 @@ server.sun_family = AF_UNIX; { - int sock_status = 0; - int default_sock = !socket_name; - int saved_errno = 0; - const char *server_name = "server"; + int sock_status; + int use_tmpdir = 0; + int saved_errno; + const char *server_name = local_socket_name; const char *tmpdir IF_LINT ( = NULL); char *tmpdir_storage = NULL; char *socket_name_storage = NULL; - if (socket_name && !strchr (socket_name, '/') - && !strchr (socket_name, '\\')) + if (!strchr (local_socket_name, '/') && !strchr (local_socket_name, '\\')) { /* socket_name is a file name component. */ - server_name = socket_name; - socket_name = NULL; - default_sock = 1; /* Try both UIDs. */ - } - - if (default_sock) - { long uid = geteuid (); ptrdiff_t tmpdirlen; + use_tmpdir = 1; tmpdir = egetenv ("TMPDIR"); if (!tmpdir) { @@ -1293,26 +1287,27 @@ tmpdir = "/tmp"; } tmpdirlen = strlen (tmpdir); - socket_name = socket_name_storage = + socket_name_storage = xmalloc (tmpdirlen + strlen (server_name) + EXTRA_SPACE); - strcpy (socket_name, tmpdir); - sprintf (socket_name + tmpdirlen, "/emacs%ld/", uid); - strcat (socket_name + tmpdirlen, server_name); + strcpy (socket_name_storage, tmpdir); + sprintf (socket_name_storage + tmpdirlen, "/emacs%ld/", uid); + strcat (socket_name_storage + tmpdirlen, server_name); + local_socket_name = socket_name_storage; } - if (strlen (socket_name) < sizeof (server.sun_path)) - strcpy (server.sun_path, socket_name); + if (strlen (local_socket_name) < sizeof (server.sun_path)) + strcpy (server.sun_path, local_socket_name); else { message (TRUE, "%s: socket-name %s too long\n", - progname, socket_name); + progname, local_socket_name); fail (); } /* See if the socket exists, and if it's owned by us. */ sock_status = socket_status (server.sun_path); saved_errno = errno; - if (sock_status && default_sock) + if (sock_status && use_tmpdir) { /* Failing that, see if LOGNAME or USER exist and differ from our euid. If so, look for a socket based on the UID @@ -1333,21 +1328,21 @@ /* We're running under su, apparently. */ long uid = pw->pw_uid; ptrdiff_t tmpdirlen = strlen (tmpdir); - socket_name = xmalloc (tmpdirlen + strlen (server_name) - + EXTRA_SPACE); - strcpy (socket_name, tmpdir); - sprintf (socket_name + tmpdirlen, "/emacs%ld/", uid); - strcat (socket_name + tmpdirlen, server_name); + char *user_socket_name + = xmalloc (tmpdirlen + strlen (server_name) + EXTRA_SPACE); + strcpy (user_socket_name, tmpdir); + sprintf (user_socket_name + tmpdirlen, "/emacs%ld/", uid); + strcat (user_socket_name + tmpdirlen, server_name); - if (strlen (socket_name) < sizeof (server.sun_path)) - strcpy (server.sun_path, socket_name); + if (strlen (user_socket_name) < sizeof (server.sun_path)) + strcpy (server.sun_path, user_socket_name); else { message (TRUE, "%s: socket-name %s too long\n", - progname, socket_name); + progname, user_socket_name); exit (EXIT_FAILURE); } - free (socket_name); + free (user_socket_name); sock_status = socket_status (server.sun_path); saved_errno = errno; @@ -1401,6 +1396,7 @@ set_socket (int no_exit_if_error) { HSOCKET s; + const char *local_server_file = server_file; INITIALIZE (); @@ -1408,7 +1404,7 @@ /* Explicit --socket-name argument. */ if (socket_name) { - s = set_local_socket (); + s = set_local_socket (socket_name); if ((s != INVALID_SOCKET) || no_exit_if_error) return s; message (TRUE, "%s: error accessing socket \"%s\"\n", @@ -1418,30 +1414,29 @@ #endif /* Explicit --server-file arg or EMACS_SERVER_FILE variable. */ - if (!server_file) - server_file = egetenv ("EMACS_SERVER_FILE"); + if (!local_server_file) + local_server_file = egetenv ("EMACS_SERVER_FILE"); - if (server_file) + if (local_server_file) { - s = set_tcp_socket (); + s = set_tcp_socket (local_server_file); if ((s != INVALID_SOCKET) || no_exit_if_error) return s; message (TRUE, "%s: error accessing server file \"%s\"\n", - progname, server_file); + progname, local_server_file); exit (EXIT_FAILURE); } #ifndef NO_SOCKETS_IN_FILE_SYSTEM /* Implicit local socket. */ - s = set_local_socket (); + s = set_local_socket ("server"); if (s != INVALID_SOCKET) return s; #endif /* Implicit server file. */ - server_file = "server"; - s = set_tcp_socket (); + s = set_tcp_socket ("server"); if ((s != INVALID_SOCKET) || no_exit_if_error) return s; @@ -1573,8 +1568,6 @@ int rl = 0, needlf = 0; char *cwd, *str; char string[BUFSIZ+1]; - int null_socket_name IF_LINT ( = 0); - int null_server_file IF_LINT ( = 0); int start_daemon_if_needed; int exit_status = EXIT_SUCCESS; @@ -1602,14 +1595,6 @@ in case of failure to connect. */ start_daemon_if_needed = (alternate_editor && (alternate_editor[0] == '\0')); - if (start_daemon_if_needed) - { - /* set_socket changes the values for socket_name and - server_file, we need to reset them, if they were NULL before - for the second call to set_socket. */ - null_socket_name = (socket_name == NULL); - null_server_file = (server_file == NULL); - } emacs_socket = set_socket (alternate_editor || start_daemon_if_needed); if (emacs_socket == INVALID_SOCKET) @@ -1617,13 +1602,6 @@ if (! start_daemon_if_needed) fail (); - /* Reset socket_name and server_file if they were NULL - before the set_socket call. */ - if (null_socket_name) - socket_name = NULL; - if (null_server_file) - server_file = NULL; - start_daemon_and_retry_set_socket (); } ------------------------------------------------------------ revno: 107563 fixes bug(s): http://debbugs.gnu.org/10887 committer: Juri Linkov branch nick: trunk timestamp: Sun 2012-03-11 12:27:53 +0200 message: * lisp/replace.el (replace-highlight): Set isearch-word to nil unconditionally. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-03-10 14:36:42 +0000 +++ lisp/ChangeLog 2012-03-11 10:27:53 +0000 @@ -1,3 +1,8 @@ +2012-03-11 Juri Linkov + + * replace.el (replace-highlight): Set isearch-word to nil + unconditionally. (Bug#10887) + 2012-03-10 Eli Zaretskii * net/mairix.el (mairix-replace-invalid-chars): Rename from === modified file 'lisp/replace.el' --- lisp/replace.el 2012-02-23 00:55:30 +0000 +++ lisp/replace.el 2012-03-11 10:27:53 +0000 @@ -2116,13 +2116,13 @@ (if query-replace-lazy-highlight (let ((isearch-string string) (isearch-regexp regexp) + ;; Set isearch-word to nil because word-replace is regexp-based, + ;; so `isearch-search-fun' should not use `word-search-forward'. + (isearch-word nil) (search-whitespace-regexp nil) (isearch-case-fold-search case-fold) (isearch-forward t) (isearch-error nil)) - ;; Set isearch-word to nil because word-replace is regexp-based, - ;; so `isearch-search-fun' should not use `word-search-forward'. - (if (and isearch-word isearch-regexp) (setq isearch-word nil)) (isearch-lazy-highlight-new-loop range-beg range-end)))) (defun replace-dehighlight () ------------------------------------------------------------ revno: 107562 fixes bug(s): http://debbugs.gnu.org/10891 author: Devon Sean McCullough committer: Chong Yidong branch nick: trunk timestamp: Sun 2012-03-11 17:43:01 +0800 message: Bugfix for url-http-find-free-connection. * lisp/url/url-http.el (url-http-find-free-connection): Don't pass a nil argument to url-http-mark-connection-as-busy. diff: === modified file 'lisp/url/ChangeLog' --- lisp/url/ChangeLog 2012-02-20 12:12:48 +0000 +++ lisp/url/ChangeLog 2012-03-11 09:43:01 +0000 @@ -1,3 +1,8 @@ +2012-03-11 Devon Sean McCullough + + * url-http.el (url-http-find-free-connection): Don't pass a nil + argument to url-http-mark-connection-as-busy (bug#10891). + 2012-02-20 Lars Ingebrigtsen * url-queue.el (url-queue-kill-job): Delete the process sentinel === modified file 'lisp/url/url-http.el' --- lisp/url/url-http.el 2012-02-10 17:30:39 +0000 +++ lisp/url/url-http.el 2012-03-11 09:43:01 +0000 @@ -153,38 +153,40 @@ (defun url-http-find-free-connection (host port) (let ((conns (gethash (cons host port) url-http-open-connections)) - (found nil)) - (while (and conns (not found)) + (connection nil)) + (while (and conns (not connection)) (if (not (memq (process-status (car conns)) '(run open connect))) (progn (url-http-debug "Cleaning up dead process: %s:%d %S" host port (car conns)) (url-http-idle-sentinel (car conns) nil)) - (setq found (car conns)) - (url-http-debug "Found existing connection: %s:%d %S" host port found)) + (setq connection (car conns)) + (url-http-debug "Found existing connection: %s:%d %S" host port connection)) (pop conns)) - (if found + (if connection (url-http-debug "Reusing existing connection: %s:%d" host port) (url-http-debug "Contacting host: %s:%d" host port)) (url-lazy-message "Contacting host: %s:%d" host port) - (url-http-mark-connection-as-busy - host port - (or found - (let ((buf (generate-new-buffer " *url-http-temp*"))) - ;; `url-open-stream' needs a buffer in which to do things - ;; like authentication. But we use another buffer afterwards. - (unwind-protect - (let ((proc (url-open-stream host buf host port))) - ;; url-open-stream might return nil. - (when (processp proc) - ;; Drop the temp buffer link before killing the buffer. - (set-process-buffer proc nil)) - proc) - ;; If there was an error on connect, make sure we don't - ;; get queried. - (when (get-buffer-process buf) - (set-process-query-on-exit-flag (get-buffer-process buf) nil)) - (kill-buffer buf))))))) + + (unless connection + (let ((buf (generate-new-buffer " *url-http-temp*"))) + ;; `url-open-stream' needs a buffer in which to do things + ;; like authentication. But we use another buffer afterwards. + (unwind-protect + (let ((proc (url-open-stream host buf host port))) + ;; url-open-stream might return nil. + (when (processp proc) + ;; Drop the temp buffer link before killing the buffer. + (set-process-buffer proc nil) + (setq connection proc))) + ;; If there was an error on connect, make sure we don't + ;; get queried. + (when (get-buffer-process buf) + (set-process-query-on-exit-flag (get-buffer-process buf) nil)) + (kill-buffer buf)))) + + (if connection + (url-http-mark-connection-as-busy host port connection)))) ;; Building an HTTP request (defun url-http-user-agent-string () ------------------------------------------------------------ revno: 107561 committer: Eli Zaretskii branch nick: trunk timestamp: Sat 2012-03-10 16:36:42 +0200 message: Allow ^substr, substr=, ~word in mairix searches via the form widget. lisp/net/mairix.el (mairix-replace-invalid-chars): Rename from mairix-replace-illegal-chars; all callers changed. Don't remove ^, ~, and = characters: they are meaningful in mairix search specs. (mairix-widget-create-query): Add usage information about mairix search forms: negating words, searching for substrings, etc. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-03-10 09:45:06 +0000 +++ lisp/ChangeLog 2012-03-10 14:36:42 +0000 @@ -1,3 +1,12 @@ +2012-03-10 Eli Zaretskii + + * net/mairix.el (mairix-replace-invalid-chars): Rename from + mairix-replace-illegal-chars; all callers changed. Don't remove + ^, ~, and = characters: they are meaningful in mairix search + specs. + (mairix-widget-create-query): Add usage information about mairix + search forms: negating words, searching for substrings, etc. + 2012-03-10 Jae-hyeon Park (tiny change) * international/fontset.el (font-encoding-alist): Add an entry for === modified file 'lisp/net/mairix.el' --- lisp/net/mairix.el 2012-01-19 07:21:25 +0000 +++ lisp/net/mairix.el 2012-03-10 14:36:42 +0000 @@ -570,10 +570,10 @@ mairix-output-buffer))) (zerop rval))) -(defun mairix-replace-illegal-chars (header) - "Replace illegal characters in HEADER for mairix query." +(defun mairix-replace-invalid-chars (header) + "Replace invalid characters in HEADER for mairix query." (when header - (while (string-match "[^-.@/,& [:alnum:]]" header) + (while (string-match "[^-.@/,^=~& [:alnum:]]" header) (setq header (replace-match "" t t header))) (while (string-match "[& ]" header) (setq header (replace-match "," t t header))) @@ -620,7 +620,7 @@ (concat (nth 1 cur) ":" - (mairix-replace-illegal-chars + (mairix-replace-invalid-chars (widget-value (cadr (assoc (concat "e" (car (cddr cur))) widgets))))) query))) @@ -652,9 +652,17 @@ (kill-all-local-variables) (erase-buffer) (widget-insert - "Specify your query for Mairix (check boxes for activating fields):\n\n") - (widget-insert - "(Whitespaces will be converted to ',' (i.e. AND). Use '/' for OR.)\n\n") + "Specify your query for Mairix using check boxes for activating fields.\n\n") + (widget-insert + (concat "Use ~word to match messages " + (propertize "not" 'face 'italic) + " containing the word)\n" + " substring= to match words containing the substring\n" + " substring=N to match words containing the substring, allowing\n" + " up to N errors(mising/extra/different letters)\n" + " ^substring= to match the substring at the beginning of a word.\n")) + (widget-insert + "Whitespace will be converted to ',' (i.e. AND). Use '/' for OR.\n\n") (setq mairix-widgets (mairix-widget-build-editable-fields values)) (when (member 'flags mairix-widget-other) (widget-insert "\nFlags:\n Seen: ") @@ -935,7 +943,7 @@ (lambda (field) (list (car (cddr field)) (if (car field) - (mairix-replace-illegal-chars + (mairix-replace-invalid-chars (funcall get-mail-header (car field))) nil)))) mairix-widget-fields-list)))