------------------------------------------------------------ revno: 115353 fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16029 committer: Stefan Monnier branch nick: trunk timestamp: Mon 2013-12-02 14:05:47 -0500 message: * lisp/epa-file.el (epa-file-insert-file-contents): Ensure we insert text in current-buffer. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-12-02 14:45:22 +0000 +++ lisp/ChangeLog 2013-12-02 19:05:47 +0000 @@ -1,3 +1,8 @@ +2013-12-02 Stefan Monnier + + * epa-file.el (epa-file-insert-file-contents): Ensure we insert text + in current-buffer (bug#16029). + 2013-12-02 Helmut Eller * emacs-lisp/debug.el (debugger-toggle-locals): New command. === modified file 'lisp/epa-file.el' --- lisp/epa-file.el 2013-10-28 08:04:48 +0000 +++ lisp/epa-file.el 2013-12-02 19:05:47 +0000 @@ -132,6 +132,7 @@ (error))) (local-file (or local-copy file)) (context (epg-make-context)) + (buf (current-buffer)) string length entry) (if visit (setq buffer-file-name file)) @@ -157,16 +158,16 @@ ;; where `find-file-not-found-functions' are called in ;; `find-file-noselect-1'. (when (file-exists-p local-file) - (make-local-variable 'epa-file-error) - (setq epa-file-error error) + (setq-local epa-file-error error) (add-hook 'find-file-not-found-functions 'epa-file--find-file-not-found-function nil t)) (signal 'file-error (cons "Opening input file" (cdr error))))) - (make-local-variable 'epa-file-encrypt-to) - (setq epa-file-encrypt-to - (mapcar #'car (epg-context-result-for context 'encrypted-to))) + (set-buffer buf) ;In case timer/filter changed/killed it (bug#16029)! + (setq-local epa-file-encrypt-to + (mapcar #'car (epg-context-result-for + context 'encrypted-to))) (if (or beg end) (setq string (substring string (or beg 0) end))) (save-excursion @@ -268,14 +269,13 @@ (defun epa-file-select-keys () "Select recipients for encryption." (interactive) - (make-local-variable 'epa-file-encrypt-to) - (setq epa-file-encrypt-to - (mapcar - (lambda (key) - (epg-sub-key-id (car (epg-key-sub-key-list key)))) - (epa-select-keys - (epg-make-context) - "Select recipients for encryption. + (setq-local epa-file-encrypt-to + (mapcar + (lambda (key) + (epg-sub-key-id (car (epg-key-sub-key-list key)))) + (epa-select-keys + (epg-make-context) + "Select recipients for encryption. If no one is selected, symmetric encryption will be performed. ")))) ;;;###autoload ------------------------------------------------------------ revno: 115352 committer: Paul Eggert branch nick: trunk timestamp: Mon 2013-12-02 09:55:40 -0800 message: * emacs-lisp-intro.texi (Counting Words): Don't use ':' in xref titles, as this isn't supported by Texinfo. diff: === modified file 'doc/lispintro/ChangeLog' --- doc/lispintro/ChangeLog 2013-11-30 18:34:58 +0000 +++ doc/lispintro/ChangeLog 2013-12-02 17:55:40 +0000 @@ -1,3 +1,8 @@ +2013-12-02 Paul Eggert + + * emacs-lisp-intro.texi (Counting Words): Don't use ':' in xref + titles, as this isn't supported by Texinfo. + 2013-11-30 Glenn Morris * Makefile.in (distclean): Remove Makefile. === modified file 'doc/lispintro/emacs-lisp-intro.texi' --- doc/lispintro/emacs-lisp-intro.texi 2013-09-01 01:23:06 +0000 +++ doc/lispintro/emacs-lisp-intro.texi 2013-12-02 17:55:40 +0000 @@ -13544,7 +13544,7 @@ @end itemize @node Counting Words -@chapter Counting: Repetition and Regexps +@chapter Counting via Repetition and Regexps @cindex Repetition for word counting @cindex Regular expressions for word counting @@ -14428,7 +14428,7 @@ Our next project is to count the number of words in a function definition. Clearly, this can be done using some variant of -@code{@value{COUNT-WORDS}}. @xref{Counting Words, , Counting Words: +@code{@value{COUNT-WORDS}}. @xref{Counting Words, , Counting via Repetition and Regexps}. If we are just going to count the words in one definition, it is easy enough to mark the definition with the @kbd{C-M-h} (@code{mark-defun}) command, and then call @@ -15602,7 +15602,7 @@ directory, checking what needs to be done; and we will use a recursive call to repeat the actions on each sub-directory. The recursive pattern is `accumulate' -(@pxref{Accumulate, , Recursive Pattern: @emph{accumulate}}), +(@pxref{Accumulate}), using @code{append} as the combiner. @ignore ------------------------------------------------------------ revno: 115351 fixes bug: http://debbugs.gnu.org/15994 committer: Eli Zaretskii branch nick: trunk timestamp: Mon 2013-12-02 19:28:17 +0200 message: Improve reporting of fatal exception on MS-Windows, to aid debugging #15994. src/w32fns.c (my_exception_handler): New function. (globals_of_w32fns): Set it up as the unhandled exception handler. Initialize exception code and address to zeros. (emacs_abort): If the exception code and address are available, print them at the beginning of the backtrace. Fix the format of printing addresses (was producing 0x0x12345678 on XP). diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-12-02 14:45:22 +0000 +++ src/ChangeLog 2013-12-02 17:28:17 +0000 @@ -1,3 +1,14 @@ +2013-12-02 Eli Zaretskii + + Improve reporting of fatal exception on MS-Windows. + * w32fns.c (my_exception_handler): New function. + (globals_of_w32fns): Set it up as the unhandled exception + handler. Initialize exception code and address to zeros. + (emacs_abort): If the exception code and address are available, + print them at the beginning of the backtrace. Fix the format of + printing addresses (was producing 0x0x12345678 on XP). + (Bug#15994) + 2013-12-02 Helmut Eller * eval.c (Fbacktrace__locals): New function. === modified file 'src/w32fns.c' --- src/w32fns.c 2013-12-01 22:33:13 +0000 +++ src/w32fns.c 2013-12-02 17:28:17 +0000 @@ -7969,61 +7969,35 @@ #endif } - -/* - globals_of_w32fns is used to initialize those global variables that - must always be initialized on startup even when the global variable - initialized is non zero (see the function main in emacs.c). - globals_of_w32fns is called from syms_of_w32fns when the global - variable initialized is 0 and directly from main when initialized - is non zero. - */ -void -globals_of_w32fns (void) + + +/* Crashing and reporting backtrace. */ + +#ifndef CYGWIN +static LONG CALLBACK my_exception_handler (EXCEPTION_POINTERS *); +static LPTOP_LEVEL_EXCEPTION_FILTER prev_exception_handler; +#endif +static DWORD except_code; +static PVOID except_addr; + +#ifndef CYGWIN +/* This handler records the exception code and the address where it + was triggered so that this info could be included in the backtrace. + Without that, the backtrace in some cases has no information + whatsoever about the offending code, and looks as if the top-level + exception handler in the MinGW startup code di the one that + crashed. */ +static LONG CALLBACK +my_exception_handler (EXCEPTION_POINTERS * exception_data) { - HMODULE user32_lib = GetModuleHandle ("user32.dll"); - /* - TrackMouseEvent not available in all versions of Windows, so must load - it dynamically. Do it once, here, instead of every time it is used. - */ - track_mouse_event_fn = (TrackMouseEvent_Proc) - GetProcAddress (user32_lib, "TrackMouseEvent"); - - monitor_from_point_fn = (MonitorFromPoint_Proc) - GetProcAddress (user32_lib, "MonitorFromPoint"); - get_monitor_info_fn = (GetMonitorInfo_Proc) - GetProcAddress (user32_lib, "GetMonitorInfoA"); - monitor_from_window_fn = (MonitorFromWindow_Proc) - GetProcAddress (user32_lib, "MonitorFromWindow"); - enum_display_monitors_fn = (EnumDisplayMonitors_Proc) - GetProcAddress (user32_lib, "EnumDisplayMonitors"); - - { - HMODULE imm32_lib = GetModuleHandle ("imm32.dll"); - get_composition_string_fn = (ImmGetCompositionString_Proc) - GetProcAddress (imm32_lib, "ImmGetCompositionStringW"); - get_ime_context_fn = (ImmGetContext_Proc) - GetProcAddress (imm32_lib, "ImmGetContext"); - release_ime_context_fn = (ImmReleaseContext_Proc) - GetProcAddress (imm32_lib, "ImmReleaseContext"); - set_ime_composition_window_fn = (ImmSetCompositionWindow_Proc) - GetProcAddress (imm32_lib, "ImmSetCompositionWindow"); - } - DEFVAR_INT ("w32-ansi-code-page", - w32_ansi_code_page, - doc: /* The ANSI code page used by the system. */); - w32_ansi_code_page = GetACP (); - - if (os_subtype == OS_NT) - w32_unicode_gui = 1; - else - w32_unicode_gui = 0; - - /* MessageBox does not work without this when linked to comctl32.dll 6.0. */ - InitCommonControls (); - - syms_of_w32uniscribe (); + except_code = exception_data->ExceptionRecord->ExceptionCode; + except_addr = exception_data->ExceptionRecord->ExceptionAddress; + + if (prev_exception_handler) + return prev_exception_handler (exception_data); + return EXCEPTION_EXECUTE_HANDLER; } +#endif typedef USHORT (WINAPI * CaptureStackBackTrace_proc) (ULONG, ULONG, PVOID *, PULONG); @@ -8080,21 +8054,32 @@ if (i) { + int errfile_fd = -1; + int j; + char buf[sizeof ("\r\nException at this address:\r\n\r\n") + + 2 * INT_BUFSIZE_BOUND (void *)]; #ifdef CYGWIN int stderr_fd = 2; #else HANDLE errout = GetStdHandle (STD_ERROR_HANDLE); int stderr_fd = -1; -#endif - int errfile_fd = -1; - int j; -#ifndef CYGWIN if (errout && errout != INVALID_HANDLE_VALUE) stderr_fd = _open_osfhandle ((intptr_t)errout, O_APPEND | O_BINARY); #endif + + /* We use %p, not 0x%p, as %p produces a leading "0x" on XP, + but not on Windows 7. addr2line doesn't mind a missing + "0x", but will be confused by an extra one. */ + if (except_addr) + sprintf (buf, "\r\nException 0x%lx at this address:\r\n%p\r\n", + except_code, except_addr); if (stderr_fd >= 0) - write (stderr_fd, "\r\nBacktrace:\r\n", 14); + { + if (except_addr) + write (stderr_fd, buf, strlen (buf)); + write (stderr_fd, "\r\nBacktrace:\r\n", 14); + } #ifdef CYGWIN #define _open open #endif @@ -8102,17 +8087,17 @@ if (errfile_fd >= 0) { lseek (errfile_fd, 0L, SEEK_END); + if (except_addr) + write (errfile_fd, buf, strlen (buf)); write (errfile_fd, "\r\nBacktrace:\r\n", 14); } for (j = 0; j < i; j++) { - char buf[INT_BUFSIZE_BOUND (void *)]; - /* stack[] gives the return addresses, whereas we want the address of the call, so decrease each address by approximate size of 1 CALL instruction. */ - sprintf (buf, "0x%p\r\n", (char *)stack[j] - sizeof(void *)); + sprintf (buf, "%p\r\n", (char *)stack[j] - sizeof(void *)); if (stderr_fd >= 0) write (stderr_fd, buf, strlen (buf)); if (errfile_fd >= 0) @@ -8134,6 +8119,72 @@ } } + + +/* Initialization. */ + +/* + globals_of_w32fns is used to initialize those global variables that + must always be initialized on startup even when the global variable + initialized is non zero (see the function main in emacs.c). + globals_of_w32fns is called from syms_of_w32fns when the global + variable initialized is 0 and directly from main when initialized + is non zero. + */ +void +globals_of_w32fns (void) +{ + HMODULE user32_lib = GetModuleHandle ("user32.dll"); + /* + TrackMouseEvent not available in all versions of Windows, so must load + it dynamically. Do it once, here, instead of every time it is used. + */ + track_mouse_event_fn = (TrackMouseEvent_Proc) + GetProcAddress (user32_lib, "TrackMouseEvent"); + + monitor_from_point_fn = (MonitorFromPoint_Proc) + GetProcAddress (user32_lib, "MonitorFromPoint"); + get_monitor_info_fn = (GetMonitorInfo_Proc) + GetProcAddress (user32_lib, "GetMonitorInfoA"); + monitor_from_window_fn = (MonitorFromWindow_Proc) + GetProcAddress (user32_lib, "MonitorFromWindow"); + enum_display_monitors_fn = (EnumDisplayMonitors_Proc) + GetProcAddress (user32_lib, "EnumDisplayMonitors"); + + { + HMODULE imm32_lib = GetModuleHandle ("imm32.dll"); + get_composition_string_fn = (ImmGetCompositionString_Proc) + GetProcAddress (imm32_lib, "ImmGetCompositionStringW"); + get_ime_context_fn = (ImmGetContext_Proc) + GetProcAddress (imm32_lib, "ImmGetContext"); + release_ime_context_fn = (ImmReleaseContext_Proc) + GetProcAddress (imm32_lib, "ImmReleaseContext"); + set_ime_composition_window_fn = (ImmSetCompositionWindow_Proc) + GetProcAddress (imm32_lib, "ImmSetCompositionWindow"); + } + + except_code = 0; + except_addr = 0; +#ifndef CYGWIN + prev_exception_handler = SetUnhandledExceptionFilter (my_exception_handler); +#endif + + DEFVAR_INT ("w32-ansi-code-page", + w32_ansi_code_page, + doc: /* The ANSI code page used by the system. */); + w32_ansi_code_page = GetACP (); + + if (os_subtype == OS_NT) + w32_unicode_gui = 1; + else + w32_unicode_gui = 0; + + /* MessageBox does not work without this when linked to comctl32.dll 6.0. */ + InitCommonControls (); + + syms_of_w32uniscribe (); +} + #ifdef NTGUI_UNICODE Lisp_Object ------------------------------------------------------------ revno: 115350 author: Helmut Eller committer: Stefan Monnier branch nick: trunk timestamp: Mon 2013-12-02 09:45:22 -0500 message: * lisp/emacs-lisp/debug.el (debugger-toggle-locals): New command. (debugger-mode-map): Bind it. (debugger--backtrace-base): New function. (debugger-eval-expression): Use it. (debugger-frame-number): Skip local vars when present. (debugger--locals-visible-p, debugger--insert-locals) (debugger--show-locals, debugger--hide-locals): New functions. * src/eval.c (Fbacktrace__locals): New function. (syms_of_eval): Defsubr it. diff: === modified file 'etc/NEWS' --- etc/NEWS 2013-11-29 18:36:31 +0000 +++ etc/NEWS 2013-12-02 14:45:22 +0000 @@ -247,6 +247,8 @@ * Changes in Specialized Modes and Packages in Emacs 24.4 +** The backtrace debugger can display local vars with `v'. + ** prolog-use-smie has been removed, along with the non-SMIE indentation code. ** SMIE indentation can be customized via `smie-config'. === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-12-02 13:52:23 +0000 +++ lisp/ChangeLog 2013-12-02 14:45:22 +0000 @@ -1,3 +1,13 @@ +2013-12-02 Helmut Eller + + * emacs-lisp/debug.el (debugger-toggle-locals): New command. + (debugger-mode-map): Bind it. + (debugger--backtrace-base): New function. + (debugger-eval-expression): Use it. + (debugger-frame-number): Skip local vars when present. + (debugger--locals-visible-p, debugger--insert-locals) + (debugger--show-locals, debugger--hide-locals): New functions. + 2013-12-02 Michael Albinus * net/tramp-sh.el (tramp-remote-process-environment): Do not set === modified file 'lisp/emacs-lisp/debug.el' --- lisp/emacs-lisp/debug.el 2013-11-30 09:25:31 +0000 +++ lisp/emacs-lisp/debug.el 2013-12-02 14:45:22 +0000 @@ -494,9 +494,13 @@ (forward-line 1) (while (progn (forward-char 2) - (if (= (following-char) ?\() - (forward-sexp 1) - (forward-sexp 2)) + (cond ((debugger--locals-visible-p) + (goto-char (next-single-char-property-change + (point) 'locals-visible))) + ((= (following-char) ?\() + (forward-sexp 1)) + (t + (forward-sexp 2))) (forward-line 1) (<= (point) opoint)) (if (looking-at " *;;;") @@ -541,6 +545,14 @@ (progn ,@body) (setq debugger-outer-match-data (match-data))))) +(defun debugger--backtrace-base () + "Return the function name that marks the top of the backtrace. +See `backtrace-frame'." + (cond ((eq 'debug--implement-debug-on-entry + (cadr (backtrace-frame 1 'debug))) + 'debug--implement-debug-on-entry) + (t 'debug))) + (defun debugger-eval-expression (exp &optional nframe) "Eval an expression, in an environment like that outside the debugger. The environment used is the one when entering the activation frame at point." @@ -549,15 +561,70 @@ (let ((nframe (or nframe (condition-case nil (1+ (debugger-frame-number 'skip-base)) (error 0)))) ;; If on first line. - (base (if (eq 'debug--implement-debug-on-entry - (cadr (backtrace-frame 1 'debug))) - 'debug--implement-debug-on-entry 'debug))) + (base (debugger--backtrace-base))) (debugger-env-macro (let ((val (backtrace-eval exp nframe base))) (prog1 (prin1 val t) (let ((str (eval-expression-print-format val))) (if str (princ str t)))))))) + +(defun debugger--locals-visible-p () + "Are the local variables of the current stack frame visible?" + (save-excursion + (move-to-column 2) + (get-text-property (point) 'locals-visible))) + +(defun debugger--insert-locals (locals) + "Insert the local variables LOCALS at point." + (cond ((null locals) + (insert "\n [no locals]")) + (t + (let ((print-escape-newlines t)) + (dolist (s+v locals) + (let ((symbol (car s+v)) + (value (cdr s+v))) + (insert "\n ") + (prin1 symbol (current-buffer)) + (insert " = ") + (prin1 value (current-buffer)))))))) + +(defun debugger--show-locals () + "For the frame at point, insert locals and add text properties." + (let* ((nframe (1+ (debugger-frame-number 'skip-base))) + (base (debugger--backtrace-base)) + (locals (backtrace--locals nframe base)) + (inhibit-read-only t)) + (save-excursion + (let ((start (progn + (move-to-column 2) + (point)))) + (end-of-line) + (debugger--insert-locals locals) + (add-text-properties start (point) '(locals-visible t)))))) + +(defun debugger--hide-locals () + "Delete local variables and remove the text property." + (let* ((col (current-column)) + (end (progn + (move-to-column 2) + (next-single-char-property-change (point) 'locals-visible))) + (start (previous-single-char-property-change end 'locals-visible)) + (inhibit-read-only t)) + (remove-text-properties start end '(locals-visible)) + (goto-char start) + (end-of-line) + (delete-region (point) end) + (move-to-column col))) + +(defun debugger-toggle-locals () + "Show or hide local variables of the current stack frame." + (interactive) + (cond ((debugger--locals-visible-p) + (debugger--hide-locals)) + (t + (debugger--show-locals)))) + (defvar debugger-mode-map (let ((map (make-keymap)) @@ -575,6 +642,7 @@ (define-key map "h" 'describe-mode) (define-key map "q" 'top-level) (define-key map "e" 'debugger-eval-expression) + (define-key map "v" 'debugger-toggle-locals) ;"v" is for "v"ariables. (define-key map " " 'next-line) (define-key map "R" 'debugger-record-expression) (define-key map "\C-m" 'debug-help-follow) === modified file 'src/ChangeLog' --- src/ChangeLog 2013-12-02 13:35:53 +0000 +++ src/ChangeLog 2013-12-02 14:45:22 +0000 @@ -1,3 +1,8 @@ +2013-12-02 Helmut Eller + + * eval.c (Fbacktrace__locals): New function. + (syms_of_eval): Defsubr it. + 2013-12-02 Dmitry Antipov * font.h (FONT_WIDTH, FONT_HEIGHT, FONT_BASE, FONT_DESCENT): === modified file 'src/eval.c' --- src/eval.c 2013-11-05 16:29:58 +0000 +++ src/eval.c 2013-12-02 14:45:22 +0000 @@ -3576,6 +3576,73 @@ from the debugger. */ return unbind_to (count, eval_sub (exp)); } + +DEFUN ("backtrace--locals", Fbacktrace__locals, Sbacktrace__locals, 1, 2, NULL, + doc: /* Return names and values of local variables of a stack frame. +NFRAMES and BASE specify the activation frame to use, as in `backtrace-frame'. */) + (Lisp_Object nframes, Lisp_Object base) +{ + union specbinding *frame = get_backtrace_frame (nframes, base); + union specbinding *prevframe + = get_backtrace_frame (make_number (XFASTINT (nframes) - 1), base); + ptrdiff_t distance = specpdl_ptr - frame; + Lisp_Object result = Qnil; + eassert (distance >= 0); + + if (!backtrace_p (prevframe)) + error ("Activation frame not found!"); + if (!backtrace_p (frame)) + error ("Activation frame not found!"); + + /* The specpdl entries normally contain the symbol being bound along with its + `old_value', so it can be restored. The new value to which it is bound is + available in one of two places: either in the current value of the + variable (if it hasn't been rebount yet) or in the `old_value' slot of the + next specpdl entry for it. + `backtrace_eval_unrewind' happens to swap the role of `old_value' + and "new value", so we abuse it here, to fetch the new value. + It's ugly (we'd rather not modify global data) and a bit inefficient, + but it does the job for now. */ + backtrace_eval_unrewind (distance); + + /* Grab values. */ + { + union specbinding *tmp = prevframe; + for (; tmp > frame; tmp--) + { + switch (tmp->kind) + { + case SPECPDL_LET: + case SPECPDL_LET_DEFAULT: + case SPECPDL_LET_LOCAL: + { + Lisp_Object sym = specpdl_symbol (tmp); + Lisp_Object val = specpdl_old_value (tmp); + if (EQ (sym, Qinternal_interpreter_environment)) + { + Lisp_Object env = val; + for (; CONSP (env); env = XCDR (env)) + { + Lisp_Object binding = XCAR (env); + if (CONSP (binding)) + result = Fcons (Fcons (XCAR (binding), + XCDR (binding)), + result); + } + } + else + result = Fcons (Fcons (sym, val), result); + } + } + } + } + + /* Restore values from specpdl to original place. */ + backtrace_eval_unrewind (-distance); + + return result; +} + void mark_specpdl (void) @@ -3824,6 +3891,7 @@ defsubr (&Sbacktrace); defsubr (&Sbacktrace_frame); defsubr (&Sbacktrace_eval); + defsubr (&Sbacktrace__locals); defsubr (&Sspecial_variable_p); defsubr (&Sfunctionp); } ------------------------------------------------------------ revno: 115349 committer: Michael Albinus branch nick: trunk timestamp: Mon 2013-12-02 14:52:23 +0100 message: * net/tramp-sh.el (tramp-remote-process-environment): Do not set "LC_ALL". (tramp-get-remote-locale): New defun. (tramp-open-connection-setup-interactive-shell): Use it. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-12-02 07:13:01 +0000 +++ lisp/ChangeLog 2013-12-02 13:52:23 +0000 @@ -1,3 +1,10 @@ +2013-12-02 Michael Albinus + + * net/tramp-sh.el (tramp-remote-process-environment): Do not set + "LC_ALL". + (tramp-get-remote-locale): New defun. + (tramp-open-connection-setup-interactive-shell): Use it. + 2013-12-02 Leo Liu * subr.el (process-live-p): Return nil for non-process. (Bug#16023) === modified file 'lisp/net/tramp-sh.el' --- lisp/net/tramp-sh.el 2013-11-26 15:07:10 +0000 +++ lisp/net/tramp-sh.el 2013-12-02 13:52:23 +0000 @@ -419,8 +419,7 @@ ;;;###tramp-autoload (defcustom tramp-remote-process-environment - `("HISTFILE=$HOME/.tramp_history" "HISTSIZE=1" "TMOUT=0" - "LC_ALL=en_US.utf8" "LC_CTYPE=''" + `("HISTFILE=$HOME/.tramp_history" "HISTSIZE=1" "TMOUT=0" "LC_CTYPE=''" ,(format "TERM=%s" tramp-terminal-type) "EMACS=t" ;; Deprecated. ,(format "INSIDE_EMACS='%s,tramp:%s'" emacs-version tramp-version) @@ -3889,7 +3888,8 @@ ;; Set the environment. (tramp-message vec 5 "Setting default environment") - (let ((env (copy-sequence tramp-remote-process-environment)) + (let ((env (append `(,(tramp-get-remote-locale vec)) + (copy-sequence tramp-remote-process-environment))) unset item) (while env (setq item (tramp-compat-split-string (car env) "=")) @@ -4827,6 +4827,21 @@ x)) remote-path))))) +(defun tramp-get-remote-locale (vec) + (with-tramp-connection-property vec "locale" + (tramp-send-command vec "locale -a") + (let ((candidates '("en_US.utf8" "C.utf8" "C")) + locale) + (with-current-buffer (tramp-get-connection-buffer vec) + (while candidates + (goto-char (point-min)) + (if (string-match (concat "^" (car candidates) "$") (buffer-string)) + (setq locale (car candidates) + candidates nil) + (setq candidates (cdr candidates))))) + ;; Return value. + (when locale (format "LC_ALL=%s" locale))))) + (defun tramp-get-ls-command (vec) (with-tramp-connection-property vec "ls" (tramp-message vec 5 "Finding a suitable `ls' command") ------------------------------------------------------------ revno: 115348 committer: Dmitry Antipov branch nick: trunk timestamp: Mon 2013-12-02 17:35:53 +0400 message: * font.h (FONT_WIDTH, FONT_HEIGHT, FONT_BASE, FONT_DESCENT): Define here to unify between... * nsterm.h, w32term.h, xterm.h: ...port-specific headers. * w32term.h (CHECK_W32_FRAME): Remove unused macro. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-12-02 01:05:57 +0000 +++ src/ChangeLog 2013-12-02 13:35:53 +0000 @@ -1,3 +1,10 @@ +2013-12-02 Dmitry Antipov + + * font.h (FONT_WIDTH, FONT_HEIGHT, FONT_BASE, FONT_DESCENT): + Define here to unify between... + * nsterm.h, w32term.h, xterm.h: ...port-specific headers. + * w32term.h (CHECK_W32_FRAME): Remove unused macro. + 2013-12-02 YAMAMOTO Mitsuharu * xterm.h (struct scroll_bar): Remove member `fringe_extended_p'. === modified file 'src/font.h' --- src/font.h 2013-10-25 07:28:16 +0000 +++ src/font.h 2013-12-02 13:35:53 +0000 @@ -234,6 +234,11 @@ #define FONT_SET_STYLE(font, prop, val) \ ASET ((font), prop, make_number (font_style_to_value (prop, val, 1))) +#define FONT_WIDTH(f) ((f)->max_width) +#define FONT_HEIGHT(f) ((f)->height) +#define FONT_BASE(f) ((f)->ascent) +#define FONT_DESCENT(f) ((f)->descent) + extern Lisp_Object QCspacing, QCdpi, QCscalable, QCotf, QClang, QCscript; extern Lisp_Object QCavgwidth, QCantialias, QCfont_entity; extern Lisp_Object Qp; === modified file 'src/nsterm.h' --- src/nsterm.h 2013-11-30 09:25:31 +0000 +++ src/nsterm.h 2013-12-02 13:35:53 +0000 @@ -720,11 +720,6 @@ #define FRAME_NS_TITLEBAR_HEIGHT(f) ((f)->output_data.ns->titlebar_height) #define FRAME_TOOLBAR_HEIGHT(f) ((f)->output_data.ns->toolbar_height) -#define FONT_WIDTH(f) ((f)->max_width) -#define FONT_HEIGHT(f) ((f)->height) -#define FONT_BASE(f) ((f)->ascent) -#define FONT_DESCENT(f) ((f)->descent) - #define FRAME_DEFAULT_FACE(f) FACE_FROM_ID (f, DEFAULT_FACE_ID) #define FRAME_NS_VIEW(f) ((f)->output_data.ns->view) === modified file 'src/w32term.h' --- src/w32term.h 2013-11-30 09:25:31 +0000 +++ src/w32term.h 2013-12-02 13:35:53 +0000 @@ -26,23 +26,8 @@ #define BLACK_PIX_DEFAULT(f) PALETTERGB(0,0,0) #define WHITE_PIX_DEFAULT(f) PALETTERGB(255,255,255) -#define FONT_WIDTH(f) ((f)->max_width) -#define FONT_HEIGHT(f) ((f)->height) -#define FONT_BASE(f) ((f)->ascent) -#define FONT_DESCENT(f) ((f)->descent) - #define CP_DEFAULT 1004 -#define CHECK_W32_FRAME(f, frame) \ - if (NILP (frame)) \ - f = SELECTED_FRAME (); \ - else \ - { \ - CHECK_LIVE_FRAME (frame, 0); \ - f = XFRAME (frame); \ - } \ - if (! FRAME_W32_P (f)) - /* Indicates whether we are in the readsocket call and the message we are processing in the current loop */ === modified file 'src/xterm.h' --- src/xterm.h 2013-12-02 01:05:57 +0000 +++ src/xterm.h 2013-12-02 13:35:53 +0000 @@ -84,11 +84,6 @@ #define WHITE_PIX_DEFAULT(f) \ WhitePixel (FRAME_X_DISPLAY (f), FRAME_X_SCREEN_NUMBER (f)) -#define FONT_WIDTH(f) ((f)->max_width) -#define FONT_HEIGHT(f) ((f)->ascent + (f)->descent) -#define FONT_BASE(f) ((f)->ascent) -#define FONT_DESCENT(f) ((f)->descent) - /* The mask of events that text windows always want to receive. This includes mouse movement events, since handling the mouse-font text property means that we must track mouse motion all the time. */ ------------------------------------------------------------ revno: 115347 fixes bug: http://debbugs.gnu.org/16023 committer: Leo Liu branch nick: trunk timestamp: Mon 2013-12-02 15:13:01 +0800 message: * subr.el (process-live-p): Return nil for non-process. * progmodes/sh-script.el (sh-shell-process): * progmodes/octave.el (inferior-octave-process-live-p): * progmodes/gdb-mi.el (gdb-delchar-or-quit) (gdb-inferior-io-sentinel): * emacs-lock.el (emacs-lock-live-process-p): All uses changed. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-12-02 03:03:40 +0000 +++ lisp/ChangeLog 2013-12-02 07:13:01 +0000 @@ -1,3 +1,13 @@ +2013-12-02 Leo Liu + + * subr.el (process-live-p): Return nil for non-process. (Bug#16023) + + * progmodes/sh-script.el (sh-shell-process): + * progmodes/octave.el (inferior-octave-process-live-p): + * progmodes/gdb-mi.el (gdb-delchar-or-quit) + (gdb-inferior-io-sentinel): + * emacs-lock.el (emacs-lock-live-process-p): All uses changed. + 2013-12-02 Dmitry Gutov * vc/log-edit.el (log-edit-kill-buffer): Move the use of === modified file 'lisp/emacs-lock.el' --- lisp/emacs-lock.el 2013-06-22 02:33:33 +0000 +++ lisp/emacs-lock.el 2013-12-02 07:13:01 +0000 @@ -109,8 +109,7 @@ (defun emacs-lock-live-process-p (buffer-or-name) "Return t if BUFFER-OR-NAME is associated with a live process." - (let ((proc (get-buffer-process buffer-or-name))) - (and proc (process-live-p proc)))) + (process-live-p (get-buffer-process buffer-or-name))) (defun emacs-lock--can-auto-unlock (action) "Return t if the current buffer can auto-unlock for ACTION. === modified file 'lisp/progmodes/gdb-mi.el' --- lisp/progmodes/gdb-mi.el 2013-11-17 23:01:23 +0000 +++ lisp/progmodes/gdb-mi.el 2013-12-02 07:13:01 +0000 @@ -981,7 +981,8 @@ (eq gud-minor-mode 'gdbmi)) (error "Not in a GDB-MI buffer")) (let ((proc (get-buffer-process gud-comint-buffer))) - (if (and (eobp) proc (process-live-p proc) + (if (and (eobp) + (process-live-p proc) (not gud-running) (= (point) (marker-position (process-mark proc)))) ;; Sending an EOF does not work with GDB-MI; submit an @@ -1584,9 +1585,8 @@ ;; read from the pty, and stops listening to it. If the gdb ;; process is still running, remove the pty, make a new one, and ;; pass it to gdb. - (let ((gdb-proc (get-buffer-process gud-comint-buffer)) - (io-buffer (process-buffer proc))) - (when (and gdb-proc (process-live-p gdb-proc) + (let ((io-buffer (process-buffer proc))) + (when (and (process-live-p (get-buffer-process gud-comint-buffer)) (buffer-live-p io-buffer)) ;; `comint-exec' deletes the original process as a side effect. (comint-exec io-buffer "gdb-inferior" nil nil nil) === modified file 'lisp/progmodes/octave.el' --- lisp/progmodes/octave.el 2013-11-22 14:17:48 +0000 +++ lisp/progmodes/octave.el 2013-12-02 07:13:01 +0000 @@ -700,7 +700,7 @@ (declare-function compilation-forget-errors "compile" ()) (defun inferior-octave-process-live-p () - (and inferior-octave-process (process-live-p inferior-octave-process))) + (process-live-p inferior-octave-process)) (define-derived-mode inferior-octave-mode comint-mode "Inferior Octave" "Major mode for interacting with an inferior Octave process." === modified file 'lisp/progmodes/sh-script.el' --- lisp/progmodes/sh-script.el 2013-11-09 10:49:42 +0000 +++ lisp/progmodes/sh-script.el 2013-12-02 07:13:01 +0000 @@ -1478,7 +1478,7 @@ (defun sh-shell-process (force) "Get a shell process for interaction. If FORCE is non-nil and no process found, create one." - (if (and sh-shell-process (process-live-p sh-shell-process)) + (if (process-live-p sh-shell-process) sh-shell-process (setq sh-shell-process (let ((found nil) proc === modified file 'lisp/subr.el' --- lisp/subr.el 2013-11-24 08:49:44 +0000 +++ lisp/subr.el 2013-12-02 07:13:01 +0000 @@ -1885,9 +1885,11 @@ (defun process-live-p (process) "Returns non-nil if PROCESS is alive. A process is considered alive if its status is `run', `open', -`listen', `connect' or `stop'." - (memq (process-status process) - '(run open listen connect stop))) +`listen', `connect' or `stop'. Value is nil if PROCESS is not a +process." + (and (processp process) + (memq (process-status process) + '(run open listen connect stop)))) ;; compatibility