------------------------------------------------------------ revno: 114696 author: Paul Eggert committer: Paul Eggert branch nick: trunk timestamp: Wed 2013-10-16 23:42:21 -0700 message: Make some functions static in non-Microsoft builds. On my platform (Fedora 19 x86-64), this shrinks the Emacs executable (text+data) by 0.25%. * dispextern.h (erase_phys_cursor) [!WINDOWSNT]: (load_color) [!MSDOS]: * gnutls.h (emacs_gnutls_transport_set_errno) [!WINDOWSNT]: * keyboard.h (make_ctrl_char) [!WINDOWSNT]: * lisp.h (check_existing): * process.h (conv_sockaddr_to_lisp, network_interface_list) (network_interface_info) [!WINDOWSNT]: * termhooks.h (encode_terminal_code) [!WINDOWSNT]: Remove extern decls. * fileio.c (check_existing): * keyboard.c (make_ctrl_char) [!WINDOWSNT]: * process.c (conv_sockaddr_to_lisp, network_interface_list) (network_interface_info) [!WINDOWSNT]: * term.c (encode_terminal_code) [!WINDOWSNT]: * xdisp.c (erase_phys_cursor) [!WINDOWSNT]: * xfaces.c (load_color) [!MSDOS]: Now static. * fileio.c (check_existing, check_executable, check_writable): * process.c (network_interface_list, network_interface_info): Move earlier, so that we don't need forward decls. * gnutls.c (fn_gnutls_transport_set_errno) (emacs_gnutls_transport_set_errno) [!WINDOWNT]: Remove; unused. * w32.c (init_environment): Use faccessat rather than check_existing, partly for consistency with the rest of the code in this file, partly so that check_existing can be static. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-10-17 03:08:59 +0000 +++ src/ChangeLog 2013-10-17 06:42:21 +0000 @@ -1,5 +1,35 @@ 2013-10-17 Paul Eggert + Make some functions static in non-Microsoft builds. + On my platform (Fedora 19 x86-64), this shrinks the + Emacs executable (text+data) by 0.25%. + * dispextern.h (erase_phys_cursor) [!WINDOWSNT]: + (load_color) [!MSDOS]: + * gnutls.h (emacs_gnutls_transport_set_errno) [!WINDOWSNT]: + * keyboard.h (make_ctrl_char) [!WINDOWSNT]: + * lisp.h (check_existing): + * process.h (conv_sockaddr_to_lisp, network_interface_list) + (network_interface_info) [!WINDOWSNT]: + * termhooks.h (encode_terminal_code) [!WINDOWSNT]: + Remove extern decls. + * fileio.c (check_existing): + * keyboard.c (make_ctrl_char) [!WINDOWSNT]: + * process.c (conv_sockaddr_to_lisp, network_interface_list) + (network_interface_info) [!WINDOWSNT]: + * term.c (encode_terminal_code) [!WINDOWSNT]: + * xdisp.c (erase_phys_cursor) [!WINDOWSNT]: + * xfaces.c (load_color) [!MSDOS]: + Now static. + * fileio.c (check_existing, check_executable, check_writable): + * process.c (network_interface_list, network_interface_info): + Move earlier, so that we don't need forward decls. + * gnutls.c (fn_gnutls_transport_set_errno) + (emacs_gnutls_transport_set_errno) [!WINDOWNT]: + Remove; unused. + * w32.c (init_environment): Use faccessat rather than + check_existing, partly for consistency with the rest of the code + in this file, partly so that check_existing can be static. + Make VALMASK visible to GDB even if clang is used (Bug#15574). * emacs.c (MAIN_PROGRAM): New macro. * lisp.h (DEFINE_GDB_SYMBOL_BEGIN, DEFINE_GDB_SYMBOL_END): New macros. === modified file 'src/dispextern.h' --- src/dispextern.h 2013-10-11 15:42:06 +0000 +++ src/dispextern.h 2013-10-17 06:42:21 +0000 @@ -3229,7 +3229,9 @@ enum draw_glyphs_face); extern void get_phys_cursor_geometry (struct window *, struct glyph_row *, struct glyph *, int *, int *, int *); +#ifdef WINDOWSNT extern void erase_phys_cursor (struct window *); +#endif extern void display_and_set_cursor (struct window *, bool, int, int, int, int); extern void x_update_cursor (struct frame *, bool); extern void x_clear_cursor (struct window *); @@ -3343,8 +3345,10 @@ Lisp_Object); Lisp_Object tty_color_name (struct frame *, int); void clear_face_cache (int); +#ifdef MSDOS unsigned long load_color (struct frame *, struct face *, Lisp_Object, enum lface_attribute_index); +#endif void unload_color (struct frame *, unsigned long); char *choose_face_font (struct frame *, Lisp_Object *, Lisp_Object, int *); === modified file 'src/fileio.c' --- src/fileio.c 2013-10-10 21:42:38 +0000 +++ src/fileio.c 2013-10-17 06:42:21 +0000 @@ -161,6 +161,56 @@ struct coding_system *); +/* Return true if FILENAME exists. */ + +static bool +check_existing (const char *filename) +{ + return faccessat (AT_FDCWD, filename, F_OK, AT_EACCESS) == 0; +} + +/* Return true if file FILENAME exists and can be executed. */ + +static bool +check_executable (char *filename) +{ + return faccessat (AT_FDCWD, filename, X_OK, AT_EACCESS) == 0; +} + +/* Return true if file FILENAME exists and can be accessed + according to AMODE, which should include W_OK. + On failure, return false and set errno. */ + +static bool +check_writable (const char *filename, int amode) +{ +#ifdef MSDOS + /* FIXME: an faccessat implementation should be added to the + DOS/Windows ports and this #ifdef branch should be removed. */ + struct stat st; + if (stat (filename, &st) < 0) + return 0; + errno = EPERM; + return (st.st_mode & S_IWRITE || S_ISDIR (st.st_mode)); +#else /* not MSDOS */ + bool res = faccessat (AT_FDCWD, filename, amode, AT_EACCESS) == 0; +#ifdef CYGWIN + /* faccessat may have returned failure because Cygwin couldn't + determine the file's UID or GID; if so, we return success. */ + if (!res) + { + int faccessat_errno = errno; + struct stat st; + if (stat (filename, &st) < 0) + return 0; + res = (st.st_uid == -1 || st.st_gid == -1); + errno = faccessat_errno; + } +#endif /* CYGWIN */ + return res; +#endif /* not MSDOS */ +} + /* Signal a file-access failure. STRING describes the failure, NAME the file involved, and ERRORNO the errno value. @@ -1733,7 +1783,7 @@ xnm = SSDATA (filename); x = xnm + SBYTES (filename); - + /* If /~ or // appears, discard everything through first slash. */ while ((p = search_embedded_absfilename (xnm, x)) != NULL) /* This time we do not start over because we've already expanded envvars @@ -2440,55 +2490,6 @@ return file_name_absolute_p (SSDATA (filename)) ? Qt : Qnil; } -/* Return true if FILENAME exists. */ -bool -check_existing (const char *filename) -{ - return faccessat (AT_FDCWD, filename, F_OK, AT_EACCESS) == 0; -} - -/* Return true if file FILENAME exists and can be executed. */ - -static bool -check_executable (char *filename) -{ - return faccessat (AT_FDCWD, filename, X_OK, AT_EACCESS) == 0; -} - -/* Return true if file FILENAME exists and can be accessed - according to AMODE, which should include W_OK. - On failure, return false and set errno. */ - -static bool -check_writable (const char *filename, int amode) -{ -#ifdef MSDOS - /* FIXME: an faccessat implementation should be added to the - DOS/Windows ports and this #ifdef branch should be removed. */ - struct stat st; - if (stat (filename, &st) < 0) - return 0; - errno = EPERM; - return (st.st_mode & S_IWRITE || S_ISDIR (st.st_mode)); -#else /* not MSDOS */ - bool res = faccessat (AT_FDCWD, filename, amode, AT_EACCESS) == 0; -#ifdef CYGWIN - /* faccessat may have returned failure because Cygwin couldn't - determine the file's UID or GID; if so, we return success. */ - if (!res) - { - int faccessat_errno = errno; - struct stat st; - if (stat (filename, &st) < 0) - return 0; - res = (st.st_uid == -1 || st.st_gid == -1); - errno = faccessat_errno; - } -#endif /* CYGWIN */ - return res; -#endif /* not MSDOS */ -} - DEFUN ("file-exists-p", Ffile_exists_p, Sfile_exists_p, 1, 1, 0, doc: /* Return t if file FILENAME exists (whether or not you can read it.) See also `file-readable-p' and `file-attributes'. @@ -2514,7 +2515,7 @@ absname = ENCODE_FILE (absname); - return (check_existing (SSDATA (absname))) ? Qt : Qnil; + return check_existing (SSDATA (absname)) ? Qt : Qnil; } DEFUN ("file-executable-p", Ffile_executable_p, Sfile_executable_p, 1, 1, 0, === modified file 'src/gnutls.c' --- src/gnutls.c 2013-10-11 13:47:35 +0000 +++ src/gnutls.c 2013-10-17 06:42:21 +0000 @@ -249,7 +249,9 @@ #define fn_gnutls_record_recv gnutls_record_recv #define fn_gnutls_record_send gnutls_record_send #define fn_gnutls_strerror gnutls_strerror +#ifdef WINDOWSNT #define fn_gnutls_transport_set_errno gnutls_transport_set_errno +#endif #define fn_gnutls_transport_set_ptr2 gnutls_transport_set_ptr2 #define fn_gnutls_x509_crt_check_hostname gnutls_x509_crt_check_hostname #define fn_gnutls_x509_crt_deinit gnutls_x509_crt_deinit @@ -364,11 +366,13 @@ return fn_gnutls_record_check_pending (state); } +#ifdef WINDOWSNT void emacs_gnutls_transport_set_errno (gnutls_session_t state, int err) { fn_gnutls_transport_set_errno (state, err); } +#endif ptrdiff_t emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, ptrdiff_t nbyte) === modified file 'src/gnutls.h' --- src/gnutls.h 2013-07-10 23:23:57 +0000 +++ src/gnutls.h 2013-10-17 06:42:21 +0000 @@ -64,7 +64,9 @@ emacs_gnutls_read (struct Lisp_Process *proc, char *buf, ptrdiff_t nbyte); extern int emacs_gnutls_record_check_pending (gnutls_session_t state); +#ifdef WINDOWSNT extern void emacs_gnutls_transport_set_errno (gnutls_session_t state, int err); +#endif extern Lisp_Object emacs_gnutls_deinit (Lisp_Object); extern void syms_of_gnutls (void); === modified file 'src/keyboard.c' --- src/keyboard.c 2013-10-15 13:57:37 +0000 +++ src/keyboard.c 2013-10-17 06:42:21 +0000 @@ -2097,6 +2097,9 @@ /* Apply the control modifier to CHARACTER. */ +#ifndef WINDOWSNT +static +#endif int make_ctrl_char (int c) { === modified file 'src/keyboard.h' --- src/keyboard.h 2013-10-15 13:57:37 +0000 +++ src/keyboard.h 2013-10-17 06:42:21 +0000 @@ -517,7 +517,9 @@ extern void clear_input_pending (void); extern bool requeued_events_pending_p (void); extern void bind_polling_period (int); +#ifdef WINDOWSNT extern int make_ctrl_char (int) ATTRIBUTE_CONST; +#endif extern void stuff_buffered_input (Lisp_Object); extern void clear_waiting_for_input (void); extern void swallow_events (bool); === modified file 'src/lisp.h' --- src/lisp.h 2013-10-17 03:08:59 +0000 +++ src/lisp.h 2013-10-17 06:42:21 +0000 @@ -3873,7 +3873,6 @@ extern void syms_of_fileio (void); extern Lisp_Object make_temp_name (Lisp_Object, bool); extern Lisp_Object Qdelete_file; -extern bool check_existing (const char *); /* Defined in search.c. */ extern void shrink_regexp_cache (void); === modified file 'src/process.c' --- src/process.c 2013-10-16 15:44:02 +0000 +++ src/process.c 2013-10-17 06:42:21 +0000 @@ -1958,6 +1958,9 @@ /* Convert an internal struct sockaddr to a lisp object (vector or string). The address family of sa is not included in the result. */ +#ifndef WINDOWSNT +static +#endif Lisp_Object conv_sockaddr_to_lisp (struct sockaddr *sa, int len) { @@ -3504,43 +3507,10 @@ } -DEFUN ("network-interface-list", Fnetwork_interface_list, Snetwork_interface_list, 0, 0, 0, - doc: /* Return an alist of all network interfaces and their network address. -Each element is a cons, the car of which is a string containing the -interface name, and the cdr is the network address in internal -format; see the description of ADDRESS in `make-network-process'. - -If the information is not available, return nil. */) - (void) -{ -#if (defined (HAVE_NET_IF_H) && defined (SIOCGIFCONF)) || defined (WINDOWSNT) - return network_interface_list (); -#else - return Qnil; -#endif -} - -DEFUN ("network-interface-info", Fnetwork_interface_info, Snetwork_interface_info, 1, 1, 0, - doc: /* Return information about network interface named IFNAME. -The return value is a list (ADDR BCAST NETMASK HWADDR FLAGS), -where ADDR is the layer 3 address, BCAST is the layer 3 broadcast address, -NETMASK is the layer 3 network mask, HWADDR is the layer 2 address, and -FLAGS is the current flags of the interface. - -Data that is unavailable is returned as nil. */) - (Lisp_Object ifname) -{ -#if (defined (HAVE_NET_IF_H) && (defined (SIOCGIFADDR) || defined (SIOCGIFHWADDR) || defined (SIOCGIFFLAGS))) || defined (WINDOWSNT) - return network_interface_info (ifname); -#else - return Qnil; -#endif -} - -#if defined (HAVE_NET_IF_H) +#ifdef HAVE_NET_IF_H #ifdef SIOCGIFCONF -Lisp_Object +static Lisp_Object network_interface_list (void) { struct ifconf ifconf; @@ -3683,7 +3653,7 @@ { 0, 0 } }; -Lisp_Object +static Lisp_Object network_interface_info (Lisp_Object ifname) { struct ifreq rq; @@ -3829,6 +3799,45 @@ #endif /* !SIOCGIFADDR && !SIOCGIFHWADDR && !SIOCGIFFLAGS */ #endif /* defined (HAVE_NET_IF_H) */ +DEFUN ("network-interface-list", Fnetwork_interface_list, + Snetwork_interface_list, 0, 0, 0, + doc: /* Return an alist of all network interfaces and their network address. +Each element is a cons, the car of which is a string containing the +interface name, and the cdr is the network address in internal +format; see the description of ADDRESS in `make-network-process'. + +If the information is not available, return nil. */) + (void) +{ +#if (defined HAVE_NET_IF_H && defined SIOCGIFCONF) || defined WINDOWSNT + return network_interface_list (); +#else + return Qnil; +#endif +} + +DEFUN ("network-interface-info", Fnetwork_interface_info, + Snetwork_interface_info, 1, 1, 0, + doc: /* Return information about network interface named IFNAME. +The return value is a list (ADDR BCAST NETMASK HWADDR FLAGS), +where ADDR is the layer 3 address, BCAST is the layer 3 broadcast address, +NETMASK is the layer 3 network mask, HWADDR is the layer 2 address, and +FLAGS is the current flags of the interface. + +Data that is unavailable is returned as nil. */) + (Lisp_Object ifname) +{ +#if ((defined HAVE_NET_IF_H \ + && (defined SIOCGIFADDR || defined SIOCGIFHWADDR \ + || defined SIOCGIFFLAGS)) \ + || defined WINDOWSNT) + return network_interface_info (ifname); +#else + return Qnil; +#endif +} + + /* Turn off input and output for process PROC. */ static void === modified file 'src/process.h' --- src/process.h 2013-10-16 17:36:04 +0000 +++ src/process.h 2013-10-17 06:42:21 +0000 @@ -227,7 +227,9 @@ extern void record_deleted_pid (pid_t, Lisp_Object); struct sockaddr; +#ifdef WINDOWSNT extern Lisp_Object conv_sockaddr_to_lisp (struct sockaddr *, int); +#endif extern void hold_keyboard_input (void); extern void unhold_keyboard_input (void); extern bool kbd_on_hold_p (void); @@ -242,8 +244,9 @@ extern void catch_child_signal (void); #endif +#ifdef WINDOWSNT extern Lisp_Object network_interface_list (void); extern Lisp_Object network_interface_info (Lisp_Object); - +#endif INLINE_HEADER_END === modified file 'src/term.c' --- src/term.c 2013-10-14 15:37:12 +0000 +++ src/term.c 2013-10-17 06:42:21 +0000 @@ -500,8 +500,12 @@ Set CODING->produced to the byte-length of the resulting byte sequence, and return a pointer to that byte sequence. */ +#ifndef WINDOWSNT +static +#endif unsigned char * -encode_terminal_code (struct glyph *src, int src_len, struct coding_system *coding) +encode_terminal_code (struct glyph *src, int src_len, + struct coding_system *coding) { struct glyph *src_end = src + src_len; unsigned char *buf; === modified file 'src/termhooks.h' --- src/termhooks.h 2013-10-15 18:38:26 +0000 +++ src/termhooks.h 2013-10-17 06:42:21 +0000 @@ -630,8 +630,10 @@ /* The initial terminal device, created by initial_term_init. */ extern struct terminal *initial_terminal; +#ifdef WINDOWSNT extern unsigned char *encode_terminal_code (struct glyph *, int, struct coding_system *); +#endif #ifdef HAVE_GPM extern void close_gpm (int gpm_fd); === modified file 'src/w32.c' --- src/w32.c 2013-10-16 15:44:02 +0000 +++ src/w32.c 2013-10-17 06:42:21 +0000 @@ -2088,7 +2088,7 @@ /* For backwards compatibility, check if a .emacs file exists in C:/ If not, then we can try to default to the appdata directory under the user's profile, which is more likely to be writable. */ - if (!check_existing ("C:/.emacs")) + if (faccessat (AT_FDCWD, "C:/.emacs", F_OK, AT_EACCESS) != 0) { HRESULT profile_result; /* Dynamically load ShGetFolderPath, as it won't exist on versions @@ -2226,7 +2226,8 @@ strcpy (&fname[pend - pstart + 1], "cmdproxy.exe"); ExpandEnvironmentStrings ((LPSTR) fname, bufc, sizeof (bufc)); - if (check_existing (bufc)) + if (faccessat (AT_FDCWD, bufc, F_OK, AT_EACCESS) + == 0) { lpval = bufc; dwType = REG_SZ; === modified file 'src/xdisp.c' --- src/xdisp.c 2013-10-11 15:42:06 +0000 +++ src/xdisp.c 2013-10-17 06:42:21 +0000 @@ -26410,9 +26410,11 @@ } -/* EXPORT: - Erase the image of a cursor of window W from the screen. */ +/* Erase the image of a cursor of window W from the screen. */ +#ifndef WINDOWSNT +static +#endif void erase_phys_cursor (struct window *w) { === modified file 'src/xfaces.c' --- src/xfaces.c 2013-10-14 10:55:24 +0000 +++ src/xfaces.c 2013-10-17 06:42:21 +0000 @@ -1197,6 +1197,9 @@ record that fact in flags of the face so that we don't try to free these colors. */ +#ifndef MSDOS +static +#endif unsigned long load_color (struct frame *f, struct face *face, Lisp_Object name, enum lface_attribute_index target_index) ------------------------------------------------------------ revno: 114695 committer: Stefan Monnier branch nick: trunk timestamp: Thu 2013-10-17 00:51:05 -0400 message: * lisp/skeleton.el (skeleton-newline): Remove. (skeleton-internal-1): Use (insert "\n") instead. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-10-17 04:49:42 +0000 +++ lisp/ChangeLog 2013-10-17 04:51:05 +0000 @@ -1,5 +1,8 @@ 2013-10-17 Stefan Monnier + * skeleton.el (skeleton-newline): Remove. + (skeleton-internal-1): Use (insert "\n") instead. + * emacs-lisp/lisp.el (lisp-completion-at-point): Complete var names for let-bindings. === modified file 'lisp/skeleton.el' --- lisp/skeleton.el 2013-06-05 19:57:10 +0000 +++ lisp/skeleton.el 2013-10-17 04:51:05 +0000 @@ -356,15 +356,6 @@ (signal 'quit 'recursive) recursive)) -(defun skeleton-newline () - (if (or (eq (point) skeleton-point) - (eq (point) (car skeleton-positions))) - ;; If point is recorded, avoid `newline' since it may do things like - ;; strip trailing spaces, and since recorded points are commonly placed - ;; right after a trailing space, calling `newline' can destroy the - ;; position and renders the recorded position incorrect. - (insert "\n") - (newline))) (defun skeleton-internal-1 (element &optional literal recursive) (cond @@ -384,7 +375,7 @@ (let ((pos (if (eq element '>) (point)))) (cond ((and skeleton-regions (eq (nth 1 skeleton-il) '_)) - (or (eolp) (newline)) + (or (eolp) (insert "\n")) (if pos (save-excursion (goto-char pos) (indent-according-to-mode))) (indent-region (line-beginning-position) (car skeleton-regions) nil)) @@ -393,13 +384,13 @@ (if pos (indent-according-to-mode))) (skeleton-newline-indent-rigidly (let ((pt (point))) - (skeleton-newline) + (insert "\n") (indent-to (save-excursion (goto-char pt) (if pos (indent-according-to-mode)) (current-indentation))))) (t (if pos (reindent-then-newline-and-indent) - (skeleton-newline) + (insert "\n") (indent-according-to-mode)))))) ((eq element '>) (if (and skeleton-regions (eq (nth 1 skeleton-il) '_)) ------------------------------------------------------------ revno: 114694 committer: Stefan Monnier branch nick: trunk timestamp: Thu 2013-10-17 00:49:42 -0400 message: * lisp/emacs-lisp/lisp.el (lisp-completion-at-point): Complete var names for let-bindings. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-10-17 03:56:51 +0000 +++ lisp/ChangeLog 2013-10-17 04:49:42 +0000 @@ -1,5 +1,8 @@ 2013-10-17 Stefan Monnier + * emacs-lisp/lisp.el (lisp-completion-at-point): Complete var names for + let-bindings. + * progmodes/sh-script.el (sh-find-prev-matching): Disable SMIE's forward-sexp-function while we redo its job (bug#15613). === modified file 'lisp/emacs-lisp/lisp.el' --- lisp/emacs-lisp/lisp.el 2013-08-29 19:18:16 +0000 +++ lisp/emacs-lisp/lisp.el 2013-10-17 04:49:42 +0000 @@ -867,6 +867,17 @@ (< (point) beg))))) (list t obarray :predicate (lambda (sym) (get sym 'error-conditions)))) + ((and ?\( + (guard (save-excursion + (goto-char (1- beg)) + (up-list -1) + (forward-symbol -1) + (looking-at "\\_")))) + (list t obarray + :predicate #'boundp + :company-doc-buffer #'lisp--company-doc-buffer + :company-docsig #'lisp--company-doc-string + :company-location #'lisp--company-location)) (_ (list nil obarray :predicate #'fboundp :company-doc-buffer #'lisp--company-doc-buffer ------------------------------------------------------------ revno: 114693 fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15613 committer: Stefan Monnier branch nick: trunk timestamp: Wed 2013-10-16 23:56:51 -0400 message: * lisp/progmodes/sh-script.el (sh-find-prev-matching): Disable SMIE's forward-sexp-function while we redo its job. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-10-17 03:37:05 +0000 +++ lisp/ChangeLog 2013-10-17 03:56:51 +0000 @@ -1,3 +1,8 @@ +2013-10-17 Stefan Monnier + + * progmodes/sh-script.el (sh-find-prev-matching): Disable SMIE's + forward-sexp-function while we redo its job (bug#15613). + 2013-10-17 Jay Belanger * calc/calc-comb.el (math-prime-test): Don't assume large integers are === modified file 'lisp/progmodes/sh-script.el' --- lisp/progmodes/sh-script.el 2013-10-13 23:21:56 +0000 +++ lisp/progmodes/sh-script.el 2013-10-17 03:56:51 +0000 @@ -3097,6 +3097,7 @@ OPEN and CLOSE are regexps denoting the tokens to be matched. Optional parameter DEPTH (usually 1) says how many to look for." (let ((parse-sexp-ignore-comments t) + (forward-sexp-function nil) prev) (setq depth (or depth 1)) (save-excursion === modified file 'test/indent/shell.sh' --- test/indent/shell.sh 2013-01-04 02:53:48 +0000 +++ test/indent/shell.sh 2013-10-17 03:56:51 +0000 @@ -5,6 +5,12 @@ # adsgsdg +if foo; then + if bar; then + toto + fi +fi # bug#15613 + case $X in foo) do_something ------------------------------------------------------------ revno: 114692 committer: Jay Belanger branch nick: trunk timestamp: Wed 2013-10-16 22:37:05 -0500 message: * calc/calc-comb.el (math-prime-test): Don't assume large integers are represented by lists. * doc/misc/calc.el (Data Type Formats): Don't specify the size at which integers begin to be represented by lists. diff: === modified file 'doc/misc/ChangeLog' --- doc/misc/ChangeLog 2013-10-14 22:25:14 +0000 +++ doc/misc/ChangeLog 2013-10-17 03:37:05 +0000 @@ -1,3 +1,8 @@ +2013-10-17 Jay Belanger + + * calc.el (Data Type Formats): Don't specify the size at + which integers begin to be represented by lists. + 2013-10-14 Xue Fuqiao * cl.texi (Argument Lists): Add indexes for &key and &aux. === modified file 'doc/misc/calc.texi' --- doc/misc/calc.texi 2013-03-31 20:27:40 +0000 +++ doc/misc/calc.texi 2013-10-17 03:37:05 +0000 @@ -33306,12 +33306,15 @@ which is not a Lisp list. Large integers are stored as lists of the form @samp{(bigpos @var{d0} -@var{d1} @var{d2} @dots{})} for positive integers 1000000 or more, or -@samp{(bigneg @var{d0} @var{d1} @var{d2} @dots{})} for negative integers -@mathit{-1000000} or less. Each @var{d} is a base-1000 ``digit,'' a Lisp integer -from 0 to 999. The least significant digit is @var{d0}; the last digit, +@var{d1} @var{d2} @dots{})} for sufficiently large positive integers +(where ``sufficiently large'' depends on the machine), or +@samp{(bigneg @var{d0} @var{d1} @var{d2} @dots{})} for negative +integers. Each @var{d} is a base-@expr{10^n} ``digit'' (where again, +@expr{n} depends on the machine), a Lisp integer from 0 to +99@dots{}9. The least significant digit is @var{d0}; the last digit, @var{dn}, which is always nonzero, is the most significant digit. For -example, the integer @mathit{-12345678} is stored as @samp{(bigneg 678 345 12)}. +example, the integer @mathit{-12345678} might be stored as +@samp{(bigneg 678 345 12)}. The distinction between small and large integers is entirely hidden from the user. In @code{defmath} definitions, the Lisp predicate @code{integerp} === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-10-16 18:23:15 +0000 +++ lisp/ChangeLog 2013-10-17 03:37:05 +0000 @@ -1,3 +1,8 @@ +2013-10-17 Jay Belanger + + * calc/calc-comb.el (math-prime-test): Don't assume large integers are + represented by lists. + 2013-10-16 Glenn Morris * tmm.el (tmm--history): New dynamic variable. === modified file 'lisp/calc/calc-comb.el' --- lisp/calc/calc-comb.el 2013-01-01 09:11:05 +0000 +++ lisp/calc/calc-comb.el 2013-10-17 03:37:05 +0000 @@ -815,8 +815,14 @@ (list nil v) '(t)))) ((not (equal n (car math-prime-test-cache))) - (cond ((= (% (nth 1 n) 2) 0) '(nil 2)) - ((= (% (nth 1 n) 5) 0) '(nil 5)) + (cond ((if (consp n) + (= (% (nth 1 n) 2) 0) + (= (% n 2) 0)) + '(nil 2)) + ((if (consp n) + (= (% (nth 1 n) 5) 0) + (= (% n 5) 0)) + '(nil 5)) (t (let ((q n) (sum 0)) (while (not (eq q 0)) (setq sum (% ------------------------------------------------------------ revno: 114691 fixes bug: http://debbugs.gnu.org/15574 committer: Paul Eggert branch nick: trunk timestamp: Wed 2013-10-16 20:08:59 -0700 message: Make VALMASK visible to GDB even if clang is used. * emacs.c (MAIN_PROGRAM): New macro. * lisp.h (DEFINE_GDB_SYMBOL_BEGIN, DEFINE_GDB_SYMBOL_END): New macros. (ARRAY_MARK_FLAG, PSEUDOVECTOR_FLAG, VALMASK): Use them. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-10-17 01:02:32 +0000 +++ src/ChangeLog 2013-10-17 03:08:59 +0000 @@ -1,5 +1,10 @@ 2013-10-17 Paul Eggert + Make VALMASK visible to GDB even if clang is used (Bug#15574). + * emacs.c (MAIN_PROGRAM): New macro. + * lisp.h (DEFINE_GDB_SYMBOL_BEGIN, DEFINE_GDB_SYMBOL_END): New macros. + (ARRAY_MARK_FLAG, PSEUDOVECTOR_FLAG, VALMASK): Use them. + bool vector int width fixes * data.c (bool_vector_spare_mask, Fbool_vector_count_matches) (Fbool_vector_count_matches_at): === modified file 'src/emacs.c' --- src/emacs.c 2013-09-20 15:34:36 +0000 +++ src/emacs.c 2013-10-17 03:08:59 +0000 @@ -30,6 +30,7 @@ #include +#define MAIN_PROGRAM #include "lisp.h" #ifdef WINDOWSNT === modified file 'src/lisp.h' --- src/lisp.h 2013-10-14 07:12:49 +0000 +++ src/lisp.h 2013-10-17 03:08:59 +0000 @@ -35,6 +35,24 @@ INLINE_HEADER_BEGIN +/* Define a TYPE constant ID as an externally visible name. Use like this: + + DEFINE_GDB_SYMBOL_BEGIN (TYPE, ID) + #define ID something + DEFINE_GDB_SYMBOL_END (ID) + + This hack is for the benefit of compilers that do not make macro + definitions visible to the debugger. It's used for symbols that + .gdbinit needs, symbols whose values may not fit in 'int' (where an + enum would suffice). */ +#ifdef MAIN_PROGRAM +# define DEFINE_GDB_SYMBOL_BEGIN(type, id) type const id EXTERNALLY_VISIBLE +# define DEFINE_GDB_SYMBOL_END(id) = id; +#else +# define DEFINE_GDB_SYMBOL_BEGIN(type, id) +# define DEFINE_GDB_SYMBOL_END(val) +#endif + /* The ubiquitous max and min macros. */ #undef min #undef max @@ -533,15 +551,15 @@ /* In the size word of a vector, this bit means the vector has been marked. */ -static ptrdiff_t const ARRAY_MARK_FLAG +DEFINE_GDB_SYMBOL_BEGIN (ptrdiff_t, ARRAY_MARK_FLAG) #define ARRAY_MARK_FLAG PTRDIFF_MIN - = ARRAY_MARK_FLAG; +DEFINE_GDB_SYMBOL_END (ARRAY_MARK_FLAG) /* In the size word of a struct Lisp_Vector, this bit means it's really some other vector-like object. */ -static ptrdiff_t const PSEUDOVECTOR_FLAG +DEFINE_GDB_SYMBOL_BEGIN (ptrdiff_t, PSEUDOVECTOR_FLAG) #define PSEUDOVECTOR_FLAG (PTRDIFF_MAX - PTRDIFF_MAX / 2) - = PSEUDOVECTOR_FLAG; +DEFINE_GDB_SYMBOL_END (PSEUDOVECTOR_FLAG) /* In a pseudovector, the size field actually contains a word with one PSEUDOVECTOR_FLAG bit set, and one of the following values extracted @@ -603,12 +621,13 @@ }; /* These functions extract various sorts of values from a Lisp_Object. - For example, if tem is a Lisp_Object whose type is Lisp_Cons, - XCONS (tem) is the struct Lisp_Cons * pointing to the memory for that cons. */ + For example, if tem is a Lisp_Object whose type is Lisp_Cons, + XCONS (tem) is the struct Lisp_Cons * pointing to the memory for + that cons. */ -static EMACS_INT const VALMASK +DEFINE_GDB_SYMBOL_BEGIN (EMACS_INT, VALMASK) #define VALMASK (USE_LSB_TAG ? - (1 << GCTYPEBITS) : VAL_MAX) - = VALMASK; +DEFINE_GDB_SYMBOL_END (VALMASK) /* Largest and smallest representable fixnum values. These are the C values. They are macros for use in static initializers. */ ------------------------------------------------------------ revno: 114690 committer: Paul Eggert branch nick: trunk timestamp: Wed 2013-10-16 18:02:32 -0700 message: bool vector int width fixes * data.c (bool_vector_spare_mask, Fbool_vector_count_matches) (Fbool_vector_count_matches_at): Use EMACS_INT, not ptrdiff_t, to record bit counts, as a bit count can exceed PTRDIFF_MAX, at least in theory. (Fbool_vector_count_matches_at): Use int, not ptrdiff_t, to record a value that can't exceed INT_MAX. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-10-16 17:36:04 +0000 +++ src/ChangeLog 2013-10-17 01:02:32 +0000 @@ -1,3 +1,13 @@ +2013-10-17 Paul Eggert + + bool vector int width fixes + * data.c (bool_vector_spare_mask, Fbool_vector_count_matches) + (Fbool_vector_count_matches_at): + Use EMACS_INT, not ptrdiff_t, to record bit counts, as a bit count + can exceed PTRDIFF_MAX, at least in theory. + (Fbool_vector_count_matches_at): + Use int, not ptrdiff_t, to record a value that can't exceed INT_MAX. + 2013-10-16 Paul Eggert * process.h (conv_sockaddr_to_lisp): New decl, for newly-extern func. === modified file 'src/data.c' --- src/data.c 2013-10-15 16:38:36 +0000 +++ src/data.c 2013-10-17 01:02:32 +0000 @@ -2980,7 +2980,7 @@ that we don't have to special-case empty bit vectors. */ static bits_word -bool_vector_spare_mask (ptrdiff_t nr_bits) +bool_vector_spare_mask (EMACS_INT nr_bits) { return (((bits_word) 1) << (nr_bits % BITS_PER_BITS_WORD)) - 1; } @@ -3218,7 +3218,7 @@ A must be a bool vector. B is a generalized bool. */) (Lisp_Object a, Lisp_Object b) { - ptrdiff_t count; + EMACS_INT count; EMACS_INT nr_bits; bits_word *adata; bits_word match; @@ -3253,9 +3253,9 @@ index into the vector. */) (Lisp_Object a, Lisp_Object b, Lisp_Object i) { - ptrdiff_t count; + EMACS_INT count; EMACS_INT nr_bits; - ptrdiff_t offset; + int offset; bits_word *adata; bits_word twiddle; bits_word mword; /* Machine word. */ ------------------------------------------------------------ revno: 114689 fixes bug: http://debbugs.gnu.org/15623 committer: Glenn Morris branch nick: trunk timestamp: Wed 2013-10-16 14:23:15 -0400 message: * lisp/tmm.el (tmm--history): New dynamic variable. (tmm-prompt): Use tmm--history in place of `history'. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-10-16 13:16:53 +0000 +++ lisp/ChangeLog 2013-10-16 18:23:15 +0000 @@ -1,3 +1,8 @@ +2013-10-16 Glenn Morris + + * tmm.el (tmm--history): New dynamic variable. + (tmm-prompt): Use tmm--history in place of `history'. (Bug#15623) + 2013-10-16 Michael Albinus * net/tramp-smb.el (tramp-smb-acl-program): New customer option. === modified file 'lisp/tmm.el' --- lisp/tmm.el 2013-10-08 09:01:26 +0000 +++ lisp/tmm.el 2013-10-16 18:23:15 +0000 @@ -149,6 +149,8 @@ '(metadata (display-sort-function . identity)) (complete-with-action action items string pred)))) +(defvar tmm--history nil) + ;;;###autoload (defun tmm-prompt (menu &optional in-popup default-item) "Text-mode emulation of calling the bindings in keymap. @@ -167,7 +169,7 @@ ;; That is used for recursive calls only. (let ((gl-str "Menu bar") ;; The menu bar itself is not a menu keymap ; so it doesn't have a name. - tmm-km-list out history history-len tmm-table-undef tmm-c-prompt + tmm-km-list out history-len tmm-table-undef tmm-c-prompt tmm-old-mb-map tmm-short-cuts chosen-string choice (not-menu (not (keymapp menu)))) @@ -221,16 +223,18 @@ (setq index-of-default (1+ index-of-default))) (setq tail (cdr tail))))) (let ((prompt (concat "^." (regexp-quote tmm-mid-prompt)))) - (setq history + (setq tmm--history (reverse (delq nil (mapcar (lambda (elt) (if (string-match prompt (car elt)) (car elt))) tmm-km-list))))) - (setq history-len (length history)) - (setq history (append history history history history)) - (setq tmm-c-prompt (nth (- history-len 1 index-of-default) history)) + (setq history-len (length tmm--history)) + (setq tmm--history (append tmm--history tmm--history + tmm--history tmm--history)) + (setq tmm-c-prompt (nth (- history-len 1 index-of-default) + tmm--history)) (setq out (if default-item (car (nth index-of-default tmm-km-list)) @@ -239,7 +243,7 @@ (concat gl-str " (up/down to change, PgUp to menu): ") (tmm--completion-table tmm-km-list) nil t nil - (cons 'history + (cons 'tmm--history (- (* 2 history-len) index-of-default)))))))) (setq choice (cdr (assoc out tmm-km-list))) (and (null choice) ------------------------------------------------------------ revno: 114688 committer: Paul Eggert branch nick: trunk timestamp: Wed 2013-10-16 10:36:04 -0700 message: * process.h (conv_sockaddr_to_lisp): New decl, for newly-extern func. (struct sockaddr): Add forward decl, for platforms that lack it. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-10-16 16:55:45 +0000 +++ src/ChangeLog 2013-10-16 17:36:04 +0000 @@ -1,3 +1,8 @@ +2013-10-16 Paul Eggert + + * process.h (conv_sockaddr_to_lisp): New decl, for newly-extern func. + (struct sockaddr): Add forward decl, for platforms that lack it. + 2013-10-16 Jan Djärv * nsselect.m (ns_string_from_pasteboard): Remove Fquit, just return === modified file 'src/process.h' --- src/process.h 2013-10-16 15:44:02 +0000 +++ src/process.h 2013-10-16 17:36:04 +0000 @@ -226,6 +226,8 @@ /* Defined in process.c. */ extern void record_deleted_pid (pid_t, Lisp_Object); +struct sockaddr; +extern Lisp_Object conv_sockaddr_to_lisp (struct sockaddr *, int); extern void hold_keyboard_input (void); extern void unhold_keyboard_input (void); extern bool kbd_on_hold_p (void); ------------------------------------------------------------ revno: 114687 fixes bug: http://debbugs.gnu.org/15628 committer: Jan D. branch nick: trunk timestamp: Wed 2013-10-16 18:55:45 +0200 message: * nsselect.m (ns_string_from_pasteboard): Remove Fquit, just return Qnil. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-10-16 15:44:02 +0000 +++ src/ChangeLog 2013-10-16 16:55:45 +0000 @@ -1,3 +1,8 @@ +2013-10-16 Jan Djärv + + * nsselect.m (ns_string_from_pasteboard): Remove Fquit, just return + Qnil (Bug#15628). + 2013-10-16 Eli Zaretskii * w32.c (network_interface_get_info, network_interface_list) === modified file 'src/nsselect.m' --- src/nsselect.m 2013-07-16 06:39:49 +0000 +++ src/nsselect.m 2013-10-16 16:55:45 +0000 @@ -256,9 +256,7 @@ type = [pb availableTypeFromArray: ns_return_types]; if (type == nil) { - Fsignal (Qquit, - list1 (build_string ("empty or unsupported pasteboard type"))); - return Qnil; + return Qnil; } /* get the string */ @@ -274,9 +272,6 @@ } else { - Fsignal (Qquit, - list1 (build_string ("pasteboard doesn't contain" - " valid data"))); return Qnil; } } ------------------------------------------------------------ revno: 114686 fixes bug: http://debbugs.gnu.org/15610 committer: Eli Zaretskii branch nick: trunk timestamp: Wed 2013-10-16 18:44:02 +0300 message: Implement network-interface-* functions for MS-Windows (bug #15610). src/w32.c (network_interface_get_info, network_interface_list) (network_interface_info): New functions. (GetAdaptersInfo_Proc): New typedef. (get_adapters_info): New wrapper function. (globals_of_w32): Initialize g_b_init_get_adapters_info. src/process.h (network_interface_list, network_interface_info): New prototypes. src/process.c (conv_sockaddr_to_lisp): Now externally-visible. (Fnetwork_interface_list, Fnetwork_interface_info): Define for all systems. Return non-nil for systems that HAVE_NET_IF_H and for WINDOWSNT. Doc fix. (syms_of_process): Defsubr Snetwork_interface_list and Snetwork_interface_info unconditionally. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-10-16 15:07:36 +0000 +++ src/ChangeLog 2013-10-16 15:44:02 +0000 @@ -1,5 +1,21 @@ 2013-10-16 Eli Zaretskii + * w32.c (network_interface_get_info, network_interface_list) + (network_interface_info): New functions. (Bug#15610) + (GetAdaptersInfo_Proc): New typedef. + (get_adapters_info): New wrapper function. + (globals_of_w32): Initialize g_b_init_get_adapters_info. + + * process.h (network_interface_list, network_interface_info): New + prototypes. + + * process.c (conv_sockaddr_to_lisp): Now externally-visible. + (Fnetwork_interface_list, Fnetwork_interface_info): Define for + all systems. Return non-nil for systems that HAVE_NET_IF_H and + for WINDOWSNT. Doc fix. + (syms_of_process): Defsubr Snetwork_interface_list and + Snetwork_interface_info unconditionally. + * menu.c (have_boxes): Fix redundant simulation of radio buttons in NS GUI sessions. (Bug#15629) === modified file 'src/process.c' --- src/process.c 2013-09-24 11:48:53 +0000 +++ src/process.c 2013-10-16 15:44:02 +0000 @@ -1958,7 +1958,7 @@ /* Convert an internal struct sockaddr to a lisp object (vector or string). The address family of sa is not included in the result. */ -static Lisp_Object +Lisp_Object conv_sockaddr_to_lisp (struct sockaddr *sa, int len) { Lisp_Object address; @@ -3504,16 +3504,45 @@ } -#if defined (HAVE_NET_IF_H) - -#ifdef SIOCGIFCONF DEFUN ("network-interface-list", Fnetwork_interface_list, Snetwork_interface_list, 0, 0, 0, doc: /* Return an alist of all network interfaces and their network address. Each element is a cons, the car of which is a string containing the interface name, and the cdr is the network address in internal -format; see the description of ADDRESS in `make-network-process'. */) +format; see the description of ADDRESS in `make-network-process'. + +If the information is not available, return nil. */) (void) { +#if (defined (HAVE_NET_IF_H) && defined (SIOCGIFCONF)) || defined (WINDOWSNT) + return network_interface_list (); +#else + return Qnil; +#endif +} + +DEFUN ("network-interface-info", Fnetwork_interface_info, Snetwork_interface_info, 1, 1, 0, + doc: /* Return information about network interface named IFNAME. +The return value is a list (ADDR BCAST NETMASK HWADDR FLAGS), +where ADDR is the layer 3 address, BCAST is the layer 3 broadcast address, +NETMASK is the layer 3 network mask, HWADDR is the layer 2 address, and +FLAGS is the current flags of the interface. + +Data that is unavailable is returned as nil. */) + (Lisp_Object ifname) +{ +#if (defined (HAVE_NET_IF_H) && (defined (SIOCGIFADDR) || defined (SIOCGIFHWADDR) || defined (SIOCGIFFLAGS))) || defined (WINDOWSNT) + return network_interface_info (ifname); +#else + return Qnil; +#endif +} + +#if defined (HAVE_NET_IF_H) + +#ifdef SIOCGIFCONF +Lisp_Object +network_interface_list (void) +{ struct ifconf ifconf; struct ifreq *ifreq; void *buf = NULL; @@ -3654,13 +3683,8 @@ { 0, 0 } }; -DEFUN ("network-interface-info", Fnetwork_interface_info, Snetwork_interface_info, 1, 1, 0, - doc: /* Return information about network interface named IFNAME. -The return value is a list (ADDR BCAST NETMASK HWADDR FLAGS), -where ADDR is the layer 3 address, BCAST is the layer 3 broadcast address, -NETMASK is the layer 3 network mask, HWADDR is the layer 2 address, and -FLAGS is the current flags of the interface. */) - (Lisp_Object ifname) +Lisp_Object +network_interface_info (Lisp_Object ifname) { struct ifreq rq; Lisp_Object res = Qnil; @@ -3802,7 +3826,7 @@ return unbind_to (count, any ? res : Qnil); } -#endif +#endif /* !SIOCGIFADDR && !SIOCGIFHWADDR && !SIOCGIFFLAGS */ #endif /* defined (HAVE_NET_IF_H) */ /* Turn off input and output for process PROC. */ @@ -7293,14 +7317,8 @@ defsubr (&Sset_network_process_option); defsubr (&Smake_network_process); defsubr (&Sformat_network_address); -#if defined (HAVE_NET_IF_H) -#ifdef SIOCGIFCONF defsubr (&Snetwork_interface_list); -#endif -#if defined (SIOCGIFADDR) || defined (SIOCGIFHWADDR) || defined (SIOCGIFFLAGS) defsubr (&Snetwork_interface_info); -#endif -#endif /* defined (HAVE_NET_IF_H) */ #ifdef DATAGRAM_SOCKETS defsubr (&Sprocess_datagram_address); defsubr (&Sset_process_datagram_address); === modified file 'src/process.h' --- src/process.h 2013-09-20 15:34:36 +0000 +++ src/process.h 2013-10-16 15:44:02 +0000 @@ -240,4 +240,8 @@ extern void catch_child_signal (void); #endif +extern Lisp_Object network_interface_list (void); +extern Lisp_Object network_interface_info (Lisp_Object); + + INLINE_HEADER_END === modified file 'src/w32.c' --- src/w32.c 2013-10-14 16:23:10 +0000 +++ src/w32.c 2013-10-16 15:44:02 +0000 @@ -218,6 +218,8 @@ #undef recvfrom #undef sendto +#include /* should be after winsock2.h */ + #include "w32.h" #include #include "w32common.h" @@ -296,6 +298,7 @@ static BOOL g_b_init_convert_sddl_to_sd; static BOOL g_b_init_is_valid_security_descriptor; static BOOL g_b_init_set_file_security; +static BOOL g_b_init_get_adapters_info; /* BEGIN: Wrapper functions around OpenProcessToken @@ -438,6 +441,9 @@ LPTSTR *StringSecurityDescriptor, PULONG StringSecurityDescriptorLen); typedef BOOL (WINAPI *IsValidSecurityDescriptor_Proc) (PSECURITY_DESCRIPTOR); +typedef DWORD (WINAPI *GetAdaptersInfo_Proc) ( + PIP_ADAPTER_INFO pAdapterInfo, + PULONG pOutBufLen); /* ** A utility function ** */ static BOOL @@ -1130,6 +1136,28 @@ return retval; } +static DWORD WINAPI +get_adapters_info (PIP_ADAPTER_INFO pAdapterInfo, PULONG pOutBufLen) +{ + static GetAdaptersInfo_Proc s_pfn_Get_Adapters_Info = NULL; + HMODULE hm_iphlpapi = NULL; + + if (is_windows_9x () == TRUE) + return ERROR_NOT_SUPPORTED; + + if (g_b_init_get_adapters_info == 0) + { + g_b_init_get_adapters_info = 1; + hm_iphlpapi = LoadLibrary ("Iphlpapi.dll"); + if (hm_iphlpapi) + s_pfn_Get_Adapters_Info = (GetAdaptersInfo_Proc) + GetProcAddress (hm_iphlpapi, "GetAdaptersInfo"); + } + if (s_pfn_Get_Adapters_Info == NULL) + return ERROR_NOT_SUPPORTED; + return s_pfn_Get_Adapters_Info (pAdapterInfo, pOutBufLen); +} + /* Return 1 if P is a valid pointer to an object of size SIZE. Return @@ -7434,6 +7462,269 @@ return nchars; } + +/* Emulation of SIOCGIFCONF and getifaddrs, see process.c. */ + +extern Lisp_Object conv_sockaddr_to_lisp (struct sockaddr *, int); + +/* Return information about network interface IFNAME, or about all + interfaces (if IFNAME is nil). */ +static Lisp_Object +network_interface_get_info (Lisp_Object ifname) +{ + ULONG ainfo_len = sizeof (IP_ADAPTER_INFO); + IP_ADAPTER_INFO *adapter, *ainfo = xmalloc (ainfo_len); + DWORD retval = get_adapters_info (ainfo, &ainfo_len); + Lisp_Object res = Qnil; + + if (retval == ERROR_BUFFER_OVERFLOW) + { + ainfo = xrealloc (ainfo, ainfo_len); + retval = get_adapters_info (ainfo, &ainfo_len); + } + + if (retval == ERROR_SUCCESS) + { + int eth_count = 0, tr_count = 0, fddi_count = 0, ppp_count = 0; + int sl_count = 0, wlan_count = 0, lo_count = 0, ifx_count = 0; + int if_num; + struct sockaddr_in sa; + + /* For the below, we need some winsock functions, so make sure + the winsock DLL is loaded. If we cannot successfully load + it, they will have no use of the information we provide, + anyway, so punt. */ + if (!winsock_lib && !init_winsock (1)) + goto done; + + for (adapter = ainfo; adapter; adapter = adapter->Next) + { + char namebuf[MAX_ADAPTER_NAME_LENGTH + 4]; + u_long ip_addr; + /* Present Unix-compatible interface names, instead of the + Windows names, which are really GUIDs not readable by + humans. */ + static const char *ifmt[] = { + "eth%d", "tr%d", "fddi%d", "ppp%d", "sl%d", "wlan%d", + "lo", "ifx%d" + }; + enum { + NONE = -1, + ETHERNET = 0, + TOKENRING = 1, + FDDI = 2, + PPP = 3, + SLIP = 4, + WLAN = 5, + LOOPBACK = 6, + OTHER_IF = 7 + } ifmt_idx; + + switch (adapter->Type) + { + case MIB_IF_TYPE_ETHERNET: + /* Windows before Vista reports wireless adapters as + Ethernet. Work around by looking at the Description + string. */ + if (strstr (adapter->Description, "Wireless ")) + { + ifmt_idx = WLAN; + if_num = wlan_count++; + } + else + { + ifmt_idx = ETHERNET; + if_num = eth_count++; + } + break; + case MIB_IF_TYPE_TOKENRING: + ifmt_idx = TOKENRING; + if_num = tr_count++; + break; + case MIB_IF_TYPE_FDDI: + ifmt_idx = FDDI; + if_num = fddi_count++; + break; + case MIB_IF_TYPE_PPP: + ifmt_idx = PPP; + if_num = ppp_count++; + break; + case MIB_IF_TYPE_SLIP: + ifmt_idx = SLIP; + if_num = sl_count++; + break; + case IF_TYPE_IEEE80211: + ifmt_idx = WLAN; + if_num = wlan_count++; + break; + case MIB_IF_TYPE_LOOPBACK: + if (lo_count < 0) + { + ifmt_idx = LOOPBACK; + if_num = lo_count++; + } + else + ifmt_idx = NONE; + break; + default: + ifmt_idx = OTHER_IF; + if_num = ifx_count++; + break; + } + if (ifmt_idx == NONE) + continue; + sprintf (namebuf, ifmt[ifmt_idx], if_num); + + sa.sin_family = AF_INET; + ip_addr = sys_inet_addr (adapter->IpAddressList.IpAddress.String); + if (ip_addr == INADDR_NONE) + { + /* Bogus address, skip this interface. */ + continue; + } + sa.sin_addr.s_addr = ip_addr; + sa.sin_port = 0; + if (NILP (ifname)) + res = Fcons (Fcons (build_string (namebuf), + conv_sockaddr_to_lisp ((struct sockaddr*) &sa, + sizeof (struct sockaddr))), + res); + else if (strcmp (namebuf, SSDATA (ifname)) == 0) + { + Lisp_Object hwaddr = Fmake_vector (make_number (6), Qnil); + register struct Lisp_Vector *p = XVECTOR (hwaddr); + Lisp_Object flags = Qnil; + int n; + u_long net_mask; + + /* Flags. We guess most of them by type, since the + Windows flags are different and hard to get by. */ + flags = Fcons (intern ("up"), flags); + if (ifmt_idx == ETHERNET || ifmt_idx == WLAN) + { + flags = Fcons (intern ("broadcast"), flags); + flags = Fcons (intern ("multicast"), flags); + } + flags = Fcons (intern ("running"), flags); + if (ifmt_idx == PPP) + { + flags = Fcons (intern ("pointopoint"), flags); + flags = Fcons (intern ("noarp"), flags); + } + if (adapter->HaveWins) + flags = Fcons (intern ("WINS"), flags); + if (adapter->DhcpEnabled) + flags = Fcons (intern ("dynamic"), flags); + + res = Fcons (flags, res); + + /* Hardware address and its family. */ + for (n = 0; n < adapter->AddressLength; n++) + p->u.contents[n] = make_number ((int) adapter->Address[n]); + /* Windows does not support AF_LINK or AF_PACKET family + of addresses. Use an arbitrary family number that is + identical to what GNU/Linux returns. */ + res = Fcons (Fcons (make_number (1), hwaddr), res); + + /* Network mask. */ + sa.sin_family = AF_INET; + net_mask = sys_inet_addr (adapter->IpAddressList.IpMask.String); + if (net_mask != INADDR_NONE) + { + sa.sin_addr.s_addr = net_mask; + sa.sin_port = 0; + res = Fcons (conv_sockaddr_to_lisp ((struct sockaddr *) &sa, + sizeof (struct sockaddr)), + res); + } + else + res = Fcons (Qnil, res); + + sa.sin_family = AF_INET; + if (ip_addr != INADDR_NONE) + { + /* Broadcast address is only reported by + GetAdaptersAddresses, which is of limited + availability. Generate it on our own. */ + u_long bcast_addr = (ip_addr & net_mask) | ~net_mask; + + sa.sin_addr.s_addr = bcast_addr; + sa.sin_port = 0; + res = Fcons (conv_sockaddr_to_lisp ((struct sockaddr *) &sa, + sizeof (struct sockaddr)), + res); + + /* IP address. */ + sa.sin_addr.s_addr = ip_addr; + sa.sin_port = 0; + res = Fcons (conv_sockaddr_to_lisp ((struct sockaddr *) &sa, + sizeof (struct sockaddr)), + res); + } + else + res = Fcons (Qnil, Fcons (Qnil, res)); + } + } + /* GetAdaptersInfo is documented to not report loopback + interfaces, so we generate one out of thin air. */ + if (!lo_count) + { + sa.sin_family = AF_INET; + sa.sin_port = 0; + if (NILP (ifname)) + { + sa.sin_addr.s_addr = sys_inet_addr ("127.0.0.1"); + res = Fcons (Fcons (build_string ("lo"), + conv_sockaddr_to_lisp ((struct sockaddr*) &sa, + sizeof (struct sockaddr))), + res); + } + else if (strcmp (SSDATA (ifname), "lo") == 0) + { + res = Fcons (Fcons (intern ("running"), + Fcons (intern ("loopback"), + Fcons (intern ("up"), Qnil))), Qnil); + /* 772 is what 3 different GNU/Linux systems report for + the loopback interface. */ + res = Fcons (Fcons (make_number (772), + Fmake_vector (make_number (6), + make_number (0))), + res); + sa.sin_addr.s_addr = sys_inet_addr ("255.0.0.0"); + res = Fcons (conv_sockaddr_to_lisp ((struct sockaddr *) &sa, + sizeof (struct sockaddr)), + res); + sa.sin_addr.s_addr = sys_inet_addr ("0.0.0.0"); + res = Fcons (conv_sockaddr_to_lisp ((struct sockaddr *) &sa, + sizeof (struct sockaddr)), + res); + sa.sin_addr.s_addr = sys_inet_addr ("127.0.0.1"); + res = Fcons (conv_sockaddr_to_lisp ((struct sockaddr *) &sa, + sizeof (struct sockaddr)), + res); + } + + } + } + + done: + xfree (ainfo); + return res; +} + +Lisp_Object +network_interface_list (void) +{ + return network_interface_get_info (Qnil); +} + +Lisp_Object +network_interface_info (Lisp_Object ifname) +{ + return network_interface_get_info (ifname); +} + + /* The Windows CRT functions are "optimized for speed", so they don't check for timezone and DST changes if they were last called less than 1 minute ago (see http://support.microsoft.com/kb/821231). So @@ -7735,6 +8026,7 @@ g_b_init_convert_sddl_to_sd = 0; g_b_init_is_valid_security_descriptor = 0; g_b_init_set_file_security = 0; + g_b_init_get_adapters_info = 0; num_of_processors = 0; /* The following sets a handler for shutdown notifications for console apps. This actually applies to Emacs in both console and ------------------------------------------------------------ revno: 114685 fixes bug: http://debbugs.gnu.org/15629 committer: Eli Zaretskii branch nick: trunk timestamp: Wed 2013-10-16 18:07:36 +0300 message: Fix bug #15629 with GUI menus on NS. src/menu.c (have_boxes): Fix redundant simulation of radio buttons in NS GUI sessions. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-10-16 09:30:30 +0000 +++ src/ChangeLog 2013-10-16 15:07:36 +0000 @@ -1,3 +1,8 @@ +2013-10-16 Eli Zaretskii + + * menu.c (have_boxes): Fix redundant simulation of radio buttons + in NS GUI sessions. (Bug#15629) + 2013-10-16 Dmitry Antipov * fns.c (Fstring_as_unibyte): Use xlispstrdup. === modified file 'src/menu.c' --- src/menu.c 2013-10-10 10:06:17 +0000 +++ src/menu.c 2013-10-16 15:07:36 +0000 @@ -55,7 +55,7 @@ static bool have_boxes (void) { -#if defined (USE_X_TOOLKIT) || defined (USE_GTK) || defined (HAVE_NTGUI) +#if defined (USE_X_TOOLKIT) || defined (USE_GTK) || defined (HAVE_NTGUI) || defined(HAVE_NS) if (FRAME_WINDOW_P (XFRAME (Vmenu_updating_frame))) return 1; #endif ------------------------------------------------------------ revno: 114684 committer: Xue Fuqiao branch nick: trunk timestamp: Wed 2013-10-16 21:46:01 +0800 message: Add an index for explicit selective display. * doc/lispref/display.texi (Selective Display): Add an index for explicit selective display. diff: === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2013-10-15 08:43:56 +0000 +++ doc/lispref/ChangeLog 2013-10-16 13:46:01 +0000 @@ -1,3 +1,8 @@ +2013-10-16 Xue Fuqiao + + * display.texi (Selective Display): Add an index for explicit + selective display. + 2013-10-15 Xue Fuqiao * display.texi (Warning Basics): Mention the ‘*Warnings*’ buffer. === modified file 'doc/lispref/display.texi' --- doc/lispref/display.texi 2013-10-15 08:43:56 +0000 +++ doc/lispref/display.texi 2013-10-16 13:46:01 +0000 @@ -961,6 +961,7 @@ @dfn{Selective display} refers to a pair of related features for hiding certain lines on the screen. +@cindex explicit selective display The first variant, explicit selective display, is designed for use in a Lisp program: it controls which lines are hidden by altering the text. This kind of hiding in some ways resembles the effect of the ------------------------------------------------------------ revno: 114683 committer: Michael Albinus branch nick: trunk timestamp: Wed 2013-10-16 15:16:53 +0200 message: * net/tramp-smb.el (tramp-smb-acl-program): New customer option. (tramp-smb-errors): Add error messages. (tramp-smb-actions-with-acl): New defconst. (tramp-smb-file-name-handler-alist) [set-file-acl]: Add handler. (tramp-smb-action-with-acl, tramp-smb-handle-set-file-acl): New defuns. (tramp-smb-handle-file-acl): Rewrite, using "smbcacls". (tramp-smb-handle-file-attributes): Simplify test for "stat" capability. (tramp-smb-get-stat-capability): Fix tests. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-10-16 03:02:40 +0000 +++ lisp/ChangeLog 2013-10-16 13:16:53 +0000 @@ -1,3 +1,14 @@ +2013-10-16 Michael Albinus + + * net/tramp-smb.el (tramp-smb-acl-program): New customer option. + (tramp-smb-errors): Add error messages. + (tramp-smb-actions-with-acl): New defconst. + (tramp-smb-file-name-handler-alist) [set-file-acl]: Add handler. + (tramp-smb-action-with-acl, tramp-smb-handle-set-file-acl): New defuns. + (tramp-smb-handle-file-acl): Rewrite, using "smbcacls". + (tramp-smb-handle-file-attributes): Simplify test for "stat" capability. + (tramp-smb-get-stat-capability): Fix tests. + 2013-10-16 Dima Kogan (tiny change) * progmodes/subword.el (subword-capitalize): Fix Stefan's mess === modified file 'lisp/net/tramp-smb.el' --- lisp/net/tramp-smb.el 2013-09-13 06:03:06 +0000 +++ lisp/net/tramp-smb.el 2013-10-16 13:16:53 +0000 @@ -75,6 +75,12 @@ :group 'tramp :type 'string) +(defcustom tramp-smb-acl-program "smbcacls" + "Name of SMB acls to run." + :group 'tramp + :type 'string + :version "24.4") + (defcustom tramp-smb-conf "/dev/null" "Path of the smb.conf file. If it is nil, no smb.conf will be added to the `tramp-smb-program' @@ -129,11 +135,14 @@ "NT_STATUS_DIRECTORY_NOT_EMPTY" "NT_STATUS_DUPLICATE_NAME" "NT_STATUS_FILE_IS_A_DIRECTORY" + "NT_STATUS_HOST_UNREACHABLE" "NT_STATUS_IMAGE_ALREADY_LOADED" + "NT_STATUS_INVALID_LEVEL" "NT_STATUS_IO_TIMEOUT" "NT_STATUS_LOGON_FAILURE" "NT_STATUS_NETWORK_ACCESS_DENIED" "NT_STATUS_NOT_IMPLEMENTED" + "NT_STATUS_NO_LOGON_SERVERS" "NT_STATUS_NO_SUCH_FILE" "NT_STATUS_NO_SUCH_USER" "NT_STATUS_OBJECT_NAME_COLLISION" @@ -178,6 +187,16 @@ See `tramp-actions-before-shell' for more info.") +(defconst tramp-smb-actions-with-acl + '((tramp-password-prompt-regexp tramp-action-password) + (tramp-wrong-passwd-regexp tramp-action-permission-denied) + (tramp-smb-errors tramp-action-permission-denied) + (tramp-process-alive-regexp tramp-smb-action-with-acl)) + "List of pattern/action pairs. +This list is used for smbcacls actions. + +See `tramp-actions-before-shell' for more info.") + ;; New handlers should be added here. (defconst tramp-smb-file-name-handler-alist '(;; `access-file' performed by default handler. @@ -235,7 +254,7 @@ (make-symbolic-link . tramp-smb-handle-make-symbolic-link) (process-file . tramp-smb-handle-process-file) (rename-file . tramp-smb-handle-rename-file) - (set-file-acl . ignore) + (set-file-acl . tramp-smb-handle-set-file-acl) (set-file-modes . tramp-smb-handle-set-file-modes) (set-file-selinux-context . ignore) (set-file-times . ignore) @@ -648,22 +667,83 @@ method user host (tramp-run-real-handler 'expand-file-name (list localname)))))) +(defun tramp-smb-action-with-acl (proc vec) + "Read ACL data from connection buffer." + (when (not (memq (process-status proc) '(run open))) + ;; Accept pending output. + (while (tramp-accept-process-output proc 0.1)) + (with-current-buffer (tramp-get-connection-buffer vec) + ;; There might be a hidden password prompt. + (widen) + (tramp-message vec 10 "\n%s" (buffer-string)) + (goto-char (point-min)) + (while (and (not (eobp)) (not (looking-at "^REVISION:"))) + (forward-line) + (delete-region (point-min) (point))) + (while (and (not (eobp)) (looking-at "^.+:.+")) + (forward-line)) + (delete-region (point) (point-max)) + (throw 'tramp-action 'ok)))) + (defun tramp-smb-handle-file-acl (filename) "Like `file-acl' for Tramp files." (with-parsed-tramp-file-name filename nil (with-tramp-file-property v localname "file-acl" - (when (tramp-smb-send-command - v (format "getfacl \"%s\"" (tramp-smb-get-localname v))) - (with-current-buffer (tramp-get-connection-buffer v) - (goto-char (point-min)) - (while (looking-at "^#") - (forward-line) - (delete-region (point-min) (point))) - (goto-char (point-max)) - (delete-blank-lines) - (when (> (point-max) (point-min)) - (tramp-compat-funcall - 'substring-no-properties (buffer-string)))))))) + (when (executable-find tramp-smb-acl-program) + + (setq tramp-current-method (tramp-file-name-method v) + tramp-current-user (tramp-file-name-user v) + tramp-current-host (tramp-file-name-real-host v)) + + (let* ((real-user (tramp-file-name-real-user v)) + (real-host (tramp-file-name-real-host v)) + (domain (tramp-file-name-domain v)) + (port (tramp-file-name-port v)) + (share (tramp-smb-get-share v)) + (localname (tramp-compat-replace-regexp-in-string + "\\\\" "/" (tramp-smb-get-localname v))) + (args (list (concat "//" real-host "/" share) "-E"))) + + (if (not (zerop (length real-user))) + (setq args (append args (list "-U" real-user))) + (setq args (append args (list "-N")))) + + (when domain (setq args (append args (list "-W" domain)))) + (when port (setq args (append args (list "-p" port)))) + (when tramp-smb-conf + (setq args (append args (list "-s" tramp-smb-conf)))) + (setq + args + (append args (list (shell-quote-argument localname) "2>/dev/null"))) + + (unwind-protect + (with-temp-buffer + ;; Set the transfer process properties. + (tramp-set-connection-property + v "process-name" (buffer-name (current-buffer))) + (tramp-set-connection-property + v "process-buffer" (current-buffer)) + + ;; Use an asynchronous processes. By this, password + ;; can be handled. + (let ((p (apply + 'start-process + (tramp-get-connection-name v) + (tramp-get-connection-buffer v) + tramp-smb-acl-program args))) + + (tramp-message + v 6 "%s" (mapconcat 'identity (process-command p) " ")) + (tramp-compat-set-process-query-on-exit-flag p nil) + (tramp-process-actions p v nil tramp-smb-actions-with-acl) + (tramp-message v 6 "\n%s" (buffer-string)) + (when (> (point-max) (point-min)) + (tramp-compat-funcall + 'substring-no-properties (buffer-string))))) + + ;; Reset the transfer process properties. + (tramp-set-connection-property v "process-name" nil) + (tramp-set-connection-property v "process-buffer" nil))))))) (defun tramp-smb-handle-file-attributes (filename &optional id-format) "Like `file-attributes' for Tramp files." @@ -672,7 +752,7 @@ (with-parsed-tramp-file-name filename nil (with-tramp-file-property v localname (format "file-attributes-%s" id-format) - (if (and (tramp-smb-get-share v) (tramp-smb-get-stat-capability v)) + (if (tramp-smb-get-stat-capability v) (tramp-smb-do-file-attributes-with-stat v id-format) ;; Reading just the filename entry via "dir localname" is not ;; possible, because when filename is a directory, some @@ -1180,6 +1260,68 @@ (tramp-compat-delete-directory filename 'recursive) (delete-file filename))))) +(defun tramp-smb-handle-set-file-acl (filename acl-string) + "Like `set-file-acl' for Tramp files." + (with-parsed-tramp-file-name filename nil + (when (and (stringp acl-string) (executable-find tramp-smb-acl-program)) + + (setq tramp-current-method (tramp-file-name-method v) + tramp-current-user (tramp-file-name-user v) + tramp-current-host (tramp-file-name-real-host v)) + (tramp-set-file-property v localname "file-acl" 'undef) + + (let* ((real-user (tramp-file-name-real-user v)) + (real-host (tramp-file-name-real-host v)) + (domain (tramp-file-name-domain v)) + (port (tramp-file-name-port v)) + (share (tramp-smb-get-share v)) + (localname (tramp-compat-replace-regexp-in-string + "\\\\" "/" (tramp-smb-get-localname v))) + (args (list (concat "//" real-host "/" share) "-E" "-S" + (tramp-compat-replace-regexp-in-string + "\n" "," acl-string)))) + + (if (not (zerop (length real-user))) + (setq args (append args (list "-U" real-user))) + (setq args (append args (list "-N")))) + + (when domain (setq args (append args (list "-W" domain)))) + (when port (setq args (append args (list "-p" port)))) + (when tramp-smb-conf + (setq args (append args (list "-s" tramp-smb-conf)))) + (setq + args + (append args (list (shell-quote-argument localname) "2>/dev/null"))) + + (unwind-protect + (with-temp-buffer + ;; Set the transfer process properties. + (tramp-set-connection-property + v "process-name" (buffer-name (current-buffer))) + (tramp-set-connection-property + v "process-buffer" (current-buffer)) + + ;; Use an asynchronous processes. By this, password can + ;; be handled. + (let ((p (apply + 'start-process + (tramp-get-connection-name v) + (tramp-get-connection-buffer v) + tramp-smb-acl-program args))) + + (tramp-message + v 6 "%s" (mapconcat 'identity (process-command p) " ")) + (tramp-compat-set-process-query-on-exit-flag p nil) + (tramp-process-actions p v nil tramp-smb-actions-with-acl) + (tramp-message v 6 "\n%s" (buffer-string)) + ;; Success. + (tramp-set-file-property v localname "file-acl" acl-string) + t)) + + ;; Reset the transfer process properties. + (tramp-set-connection-property v "process-name" nil) + (tramp-set-connection-property v "process-buffer" nil)))))) + (defun tramp-smb-handle-set-file-modes (filename mode) "Like `set-file-modes' for Tramp files." (with-parsed-tramp-file-name filename nil @@ -1543,11 +1685,12 @@ (defun tramp-smb-get-stat-capability (vec) "Check, whether the SMB server supports the STAT command." ;; When we are not logged in yet, we return nil. - (if (let ((p (tramp-get-connection-process vec))) - (and p (processp p) (memq (process-status p) '(run open)))) + (if (and (tramp-smb-get-share vec) + (let ((p (tramp-get-connection-process vec))) + p (processp p) (memq (process-status p) '(run open)))) (with-tramp-connection-property (tramp-get-connection-process vec) "stat-capability" - (tramp-smb-send-command vec "stat .")))) + (tramp-smb-send-command vec "stat \"/\"")))) ;; Connection functions. ------------------------------------------------------------ revno: 114682 committer: Dmitry Antipov branch nick: trunk timestamp: Wed 2013-10-16 13:56:36 +0400 message: * fns.c (Fstring_as_unibyte): Fix last change. diff: === modified file 'src/fns.c' --- src/fns.c 2013-10-16 09:30:30 +0000 +++ src/fns.c 2013-10-16 09:56:36 +0000 @@ -1009,7 +1009,7 @@ if (STRING_MULTIBYTE (string)) { - unsigned char *str = xlispstrdup (string); + unsigned char *str = (unsigned char *) xlispstrdup (string); ptrdiff_t bytes = str_as_unibyte (str, SBYTES (string)); string = make_unibyte_string ((char *) str, bytes); ------------------------------------------------------------ revno: 114681 committer: Dmitry Antipov branch nick: trunk timestamp: Wed 2013-10-16 13:30:30 +0400 message: * fns.c (Fstring_as_unibyte): Use xlispstrdup. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-10-15 21:03:00 +0000 +++ src/ChangeLog 2013-10-16 09:30:30 +0000 @@ -1,3 +1,7 @@ +2013-10-16 Dmitry Antipov + + * fns.c (Fstring_as_unibyte): Use xlispstrdup. + 2013-10-15 Paul Eggert * print.c (print_object): Print " ..." when truncating bool vectors. === modified file 'src/fns.c' --- src/fns.c 2013-10-14 07:12:49 +0000 +++ src/fns.c 2013-10-16 09:30:30 +0000 @@ -1009,11 +1009,9 @@ if (STRING_MULTIBYTE (string)) { - ptrdiff_t bytes = SBYTES (string); - unsigned char *str = xmalloc (bytes); + unsigned char *str = xlispstrdup (string); + ptrdiff_t bytes = str_as_unibyte (str, SBYTES (string)); - memcpy (str, SDATA (string), bytes); - bytes = str_as_unibyte (str, bytes); string = make_unibyte_string ((char *) str, bytes); xfree (str); } ------------------------------------------------------------ revno: 114680 fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15580 author: Dima Kogan committer: Stefan Monnier branch nick: trunk timestamp: Tue 2013-10-15 23:02:40 -0400 message: * lisp/progmodes/subword.el (subword-capitalize): Fix Stefan's mess. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-10-16 01:38:12 +0000 +++ lisp/ChangeLog 2013-10-16 03:02:40 +0000 @@ -1,3 +1,8 @@ +2013-10-16 Dima Kogan (tiny change) + + * progmodes/subword.el (subword-capitalize): Fix Stefan's mess + (bug#15580). + 2013-10-16 Glenn Morris * ansi-color.el (ansi-color-drop-regexp): === modified file 'lisp/progmodes/subword.el' --- lisp/progmodes/subword.el 2013-10-14 19:20:29 +0000 +++ lisp/progmodes/subword.el 2013-10-16 03:02:40 +0000 @@ -257,25 +257,26 @@ See the command `subword-mode' for a description of subwords. Optional argument ARG is the same as for `capitalize-word'." (interactive "p") - (catch 'search-failed - (let ((count (abs arg)) - (start (point)) - (advance (>= arg 0))) + (condition-case nil + (let ((count (abs arg)) + (start (point)) + (advance (>= arg 0))) - (dotimes (i count) - (if advance - (progn - (search-forward "[[:alpha:]]") - (goto-char (match-beginning 0))) - (subword-backward)) - (let* ((p (point)) - (pp (1+ p)) - (np (subword-forward))) - (upcase-region p pp) - (downcase-region pp np) - (goto-char (if advance np p)))) - (unless advance - (goto-char start))))) + (dotimes (i count) + (if advance + (progn + (re-search-forward "[[:alpha:]]") + (goto-char (match-beginning 0))) + (subword-backward)) + (let* ((p (point)) + (pp (1+ p)) + (np (subword-forward))) + (upcase-region p pp) + (downcase-region pp np) + (goto-char (if advance np p)))) + (unless advance + (goto-char start))) + (search-failed nil)))