------------------------------------------------------------ revno: 117355 committer: Dmitry Antipov branch nick: trunk timestamp: Tue 2014-06-17 07:40:29 +0400 message: * eval.c (toplevel): Remove redundant #include directives. * xterm.c (x_initialize): Add static to match prototype. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-06-17 03:14:00 +0000 +++ src/ChangeLog 2014-06-17 03:40:29 +0000 @@ -5,6 +5,8 @@ * lisp.h (Fread_file_name): Do not EXFUN it. * composite.c (CHAR_COMPOSABLE_P): Replace unsafe macro with ... (char_composable_p): ... static function. All users changed. + * eval.c (toplevel): Remove redundant #include directives. + * xterm.c (x_initialize): Add static to match prototype. 2014-06-16 Paul Eggert === modified file 'src/eval.c' --- src/eval.c 2014-02-10 09:48:17 +0000 +++ src/eval.c 2014-06-17 03:40:29 +0000 @@ -27,11 +27,6 @@ #include "commands.h" #include "keyboard.h" #include "dispextern.h" -#include "frame.h" /* For XFRAME. */ - -#if HAVE_X_WINDOWS -#include "xterm.h" -#endif /* Chain of condition and catch handlers currently in effect. */ === modified file 'src/xterm.c' --- src/xterm.c 2014-06-16 08:49:09 +0000 +++ src/xterm.c 2014-06-17 03:40:29 +0000 @@ -10568,7 +10568,7 @@ return terminal; } -void +static void x_initialize (void) { baud_rate = 19200; ------------------------------------------------------------ revno: 117354 committer: Dmitry Antipov branch nick: trunk timestamp: Tue 2014-06-17 07:14:00 +0400 message: * fileio.c (Fread_file_name): Do not pass redundant args and ... * callint.c (read_file_name): ... convert to static here. * lisp.h (Fread_file_name): Do not EXFUN it. * composite.c (CHAR_COMPOSABLE_P): Replace unsafe macro with ... (char_composable_p): ... static function. All users changed. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-06-16 22:38:17 +0000 +++ src/ChangeLog 2014-06-17 03:14:00 +0000 @@ -1,3 +1,11 @@ +2014-06-17 Dmitry Antipov + + * fileio.c (Fread_file_name): Do not pass redundant args and ... + * callint.c (read_file_name): ... convert to static here. + * lisp.h (Fread_file_name): Do not EXFUN it. + * composite.c (CHAR_COMPOSABLE_P): Replace unsafe macro with ... + (char_composable_p): ... static function. All users changed. + 2014-06-16 Paul Eggert * Makefile.in (ns-app): Fix typo that broke build on OS X. === modified file 'src/callint.c' --- src/callint.c 2014-06-01 16:25:19 +0000 +++ src/callint.c 2014-06-17 03:14:00 +0000 @@ -233,6 +233,26 @@ } } +/* Helper function to call `read-file-name' from C. */ + +static Lisp_Object +read_file_name (Lisp_Object default_filename, Lisp_Object mustmatch, + Lisp_Object initial, Lisp_Object predicate) +{ + struct gcpro gcpro1; + Lisp_Object args[7]; + + GCPRO1 (default_filename); + args[0] = intern ("read-file-name"); + args[1] = callint_message; + args[2] = Qnil; + args[3] = default_filename; + args[4] = mustmatch; + args[5] = initial; + args[6] = predicate; + RETURN_UNGCPRO (Ffuncall (7, args)); +} + /* BEWARE: Calling this directly from C would defeat the purpose! */ DEFUN ("funcall-interactively", Ffuncall_interactively, Sfuncall_interactively, 1, MANY, 0, doc: /* Like `funcall' but marks the call as interactive. @@ -574,25 +594,21 @@ break; case 'D': /* Directory name. */ - args[i] = Fread_file_name (callint_message, Qnil, - BVAR (current_buffer, directory), Qlambda, Qnil, - Qfile_directory_p); + args[i] = read_file_name (BVAR (current_buffer, directory), Qlambda, Qnil, + Qfile_directory_p); break; case 'f': /* Existing file name. */ - args[i] = Fread_file_name (callint_message, - Qnil, Qnil, Qlambda, Qnil, Qnil); + args[i] = read_file_name (Qnil, Qlambda, Qnil, Qnil); break; case 'F': /* Possibly nonexistent file name. */ - args[i] = Fread_file_name (callint_message, - Qnil, Qnil, Qnil, Qnil, Qnil); + args[i] = read_file_name (Qnil, Qnil, Qnil, Qnil); break; case 'G': /* Possibly nonexistent file name, default to directory alone. */ - args[i] = Fread_file_name (callint_message, - Qnil, Qnil, Qnil, empty_unibyte_string, Qnil); + args[i] = read_file_name (Qnil, Qnil, empty_unibyte_string, Qnil); break; case 'i': /* Ignore an argument -- Does not do I/O. */ === modified file 'src/composite.c' --- src/composite.c 2014-02-13 12:16:42 +0000 +++ src/composite.c 2014-06-17 03:14:00 +0000 @@ -921,17 +921,18 @@ return unbind_to (count, lgstring); } -static Lisp_Object _work_val; - /* 1 iff the character C is composable. Characters of general category Z? or C? are not composable except for ZWNJ and ZWJ. */ -#define CHAR_COMPOSABLE_P(C) \ - ((C) > ' ' \ - && ((C) == 0x200C || (C) == 0x200D \ - || (_work_val = CHAR_TABLE_REF (Vunicode_category_table, (C)), \ - (INTEGERP (_work_val) \ - && (XINT (_work_val) <= UNICODE_CATEGORY_So))))) +static bool +char_composable_p (int c) +{ + Lisp_Object val; + return (c > ' ' + && (c == 0x200C || c == 0x200D + || (val = CHAR_TABLE_REF (Vunicode_category_table, c), + (INTEGERP (val) && (XINT (val) <= UNICODE_CATEGORY_So))))); +} /* Update cmp_it->stop_pos to the next position after CHARPOS (and BYTEPOS) where character composition may happen. If BYTEPOS is @@ -1067,7 +1068,7 @@ p = SDATA (string) + bytepos; c = STRING_CHAR_AND_LENGTH (p, len); limit = bytepos + len; - while (CHAR_COMPOSABLE_P (c)) + while (char_composable_p (c)) { val = CHAR_TABLE_REF (Vcomposition_function_table, c); if (! NILP (val)) @@ -1144,7 +1145,7 @@ /* Skip all uncomposable characters. */ if (NILP (string)) { - while (charpos - 1 > endpos && ! CHAR_COMPOSABLE_P (c)) + while (charpos - 1 > endpos && ! char_composable_p (c)) { DEC_BOTH (charpos, bytepos); c = FETCH_MULTIBYTE_CHAR (bytepos); @@ -1152,7 +1153,7 @@ } else { - while (charpos - 1 > endpos && ! CHAR_COMPOSABLE_P (c)) + while (charpos - 1 > endpos && ! char_composable_p (c)) { p--; while (! CHAR_HEAD_P (*p)) @@ -1486,7 +1487,7 @@ |-B-|-C-|--D--| Here, it is known that characters after positions 1 and 9 can - never be composed (i.e. ! CHAR_COMPOSABLE_P (CH)), and + never be composed (i.e. ! char_composable_p (CH)), and composition A is an invalid one because it's partially covered by the valid composition C. And to know whether a composition is valid or not, the only way is to start searching forward from a @@ -1510,7 +1511,7 @@ while (1) { c = STRING_CHAR (cur.p); - if (! CHAR_COMPOSABLE_P (c)) + if (! char_composable_p (c)) { if (limit <= pos) /* case (1) */ { @@ -1519,7 +1520,7 @@ return 0; BACKWARD_CHAR (cur, stop); c = STRING_CHAR (cur.p); - } while (! CHAR_COMPOSABLE_P (c)); + } while (! char_composable_p (c)); fore_check_limit = cur.pos + 1; } else /* case (2) */ @@ -1535,7 +1536,7 @@ prev = cur; BACKWARD_CHAR (cur, stop); c = STRING_CHAR (cur.p); - if (! CHAR_COMPOSABLE_P (c)) + if (! char_composable_p (c)) { cur = prev; break; === modified file 'src/fileio.c' --- src/fileio.c 2014-06-08 23:41:43 +0000 +++ src/fileio.c 2014-06-17 03:14:00 +0000 @@ -5762,24 +5762,6 @@ return Qnil; } -Lisp_Object -Fread_file_name (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object initial, Lisp_Object predicate) -{ - struct gcpro gcpro1; - Lisp_Object args[7]; - - GCPRO1 (default_filename); - args[0] = intern ("read-file-name"); - args[1] = prompt; - args[2] = dir; - args[3] = default_filename; - args[4] = mustmatch; - args[5] = initial; - args[6] = predicate; - RETURN_UNGCPRO (Ffuncall (7, args)); -} - - void init_fileio (void) { === modified file 'src/lisp.h' --- src/lisp.h 2014-06-13 15:55:48 +0000 +++ src/lisp.h 2014-06-17 03:14:00 +0000 @@ -4015,7 +4015,6 @@ extern Lisp_Object write_region (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, int); -EXFUN (Fread_file_name, 6); /* Not a normal DEFUN. */ extern void close_file_unwind (int); extern void fclose_unwind (void *); extern void restore_point_unwind (Lisp_Object); ------------------------------------------------------------ revno: 117353 committer: Paul Eggert branch nick: trunk timestamp: Mon 2014-06-16 15:38:17 -0700 message: * Makefile.in (ns-app): Fix typo that broke build on OS X. Reported by David Caldwell in: http://lists.gnu.org/archive/html/emacs-devel/2014-06/msg00251.html diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-06-16 08:49:09 +0000 +++ src/ChangeLog 2014-06-16 22:38:17 +0000 @@ -1,3 +1,9 @@ +2014-06-16 Paul Eggert + + * Makefile.in (ns-app): Fix typo that broke build on OS X. + Reported by David Caldwell in: + http://lists.gnu.org/archive/html/emacs-devel/2014-06/msg00251.html + 2014-06-16 Dmitry Antipov Do not ask for XRender extension each time XFT font is opened. === modified file 'src/Makefile.in' --- src/Makefile.in 2014-06-15 00:34:22 +0000 +++ src/Makefile.in 2014-06-16 22:38:17 +0000 @@ -519,7 +519,7 @@ -o $@ $(ntsource)/emacs.rc ns-app: emacs$(EXEEXT) - $(MAKE) -C ./nextstep all + $(MAKE) -C ../nextstep all .PHONY: mostlyclean clean bootstrap-clean distclean maintainer-clean .PHONY: versionclean extraclean ------------------------------------------------------------ revno: 117352 committer: Dmitry Antipov branch nick: trunk timestamp: Mon 2014-06-16 12:49:09 +0400 message: Do not ask for XRender extension each time XFT font is opened. * xftfont.c (xftfont_open): Move call to XRenderQueryExtension ... * xterm.c (x_term_init) [HAVE_XFT]: ... to here. Adjust comment. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-06-15 00:34:22 +0000 +++ src/ChangeLog 2014-06-16 08:49:09 +0000 @@ -1,3 +1,9 @@ +2014-06-16 Dmitry Antipov + + Do not ask for XRender extension each time XFT font is opened. + * xftfont.c (xftfont_open): Move call to XRenderQueryExtension ... + * xterm.c (x_term_init) [HAVE_XFT]: ... to here. Adjust comment. + 2014-06-15 Glenn Morris * Makefile.in: Use `make -C' rather than `cd && make' throughout. === modified file 'src/xftfont.c' --- src/xftfont.c 2014-06-10 03:32:36 +0000 +++ src/xftfont.c 2014-06-16 08:49:09 +0000 @@ -322,16 +322,6 @@ block_input (); - /* Make sure that the Xrender extension is added before the Xft one. - Otherwise, the close-display hook set by Xft is called after the - one for Xrender, and the former tries to re-add the latter. This - results in inconsistency of internal states and leads to X - protocol error when one reconnects to the same X server. - (Bug#1696) */ - { - int event_base, error_base; - XRenderQueryExtension (display, &event_base, &error_base); - } /* Substitute in values from X resources and XftDefaultSet. */ XftDefaultSubstitute (display, FRAME_X_SCREEN_NUMBER (f), pat); === modified file 'src/xterm.c' --- src/xterm.c 2014-06-10 04:55:03 +0000 +++ src/xterm.c 2014-06-16 08:49:09 +0000 @@ -37,6 +37,11 @@ #include #endif +/* Using Xft implies that XRender is available. */ +#ifdef HAVE_XFT +#include +#endif + /* Load sys/types.h if not already loaded. In some systems loading it twice is suicidal. */ #ifndef makedev @@ -10086,14 +10091,27 @@ #ifdef HAVE_XFT { - /* If we are using Xft, check dpi value in X resources. - It is better we use it as well, since Xft will use it, as will all - Gnome applications. If our real DPI is smaller or larger than the - one Xft uses, our font will look smaller or larger than other - for other applications, even if it is the same font name (monospace-10 - for example). */ - char *v = XGetDefault (dpyinfo->display, "Xft", "dpi"); + /* If we are using Xft, the following precautions should be made: + + 1. Make sure that the Xrender extension is added before the Xft one. + Otherwise, the close-display hook set by Xft is called after the one + for Xrender, and the former tries to re-add the latter. This results + in inconsistency of internal states and leads to X protocol error when + one reconnects to the same X server (Bug#1696). + + 2. Check dpi value in X resources. It is better we use it as well, + since Xft will use it, as will all Gnome applications. If our real DPI + is smaller or larger than the one Xft uses, our font will look smaller + or larger than other for other applications, even if it is the same + font name (monospace-10 for example). */ + + int event_base, error_base; + char *v; double d; + + XRenderQueryExtension (dpyinfo->display, &event_base, &error_base); + + v = XGetDefault (dpyinfo->display, "Xft", "dpi"); if (v != NULL && sscanf (v, "%lf", &d) == 1) dpyinfo->resy = dpyinfo->resx = d; } ------------------------------------------------------------ revno: 117351 author: Andrea Rossetti committer: martin rudalics branch nick: trunk timestamp: Mon 2014-06-16 08:37:37 +0200 message: In ruler-mode fix calculation of column from mouse position (Bug#17768). * ruler-mode.el (ruler-mode-window-col) (ruler-mode-mouse-set-left-margin) (ruler-mode-mouse-set-right-margin): Fix calculation of column from mouse position (Bug#17768). diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-06-16 05:05:05 +0000 +++ lisp/ChangeLog 2014-06-16 06:37:37 +0000 @@ -1,4 +1,9 @@ -<<<<<<< TREE +2014-06-16 Andrea Rossetti (tiny change) + + * ruler-mode.el (ruler-mode-window-col) + (ruler-mode-mouse-set-left-margin) + (ruler-mode-mouse-set-right-margin): Fix calculation of column + from mouse position (Bug#17768). 2014-06-16 Ron Schnell @@ -7,10 +12,6 @@ * play/dunnet.el (dun-unix-verbs): Added ssh as alias to rlogin, because nobody knows what rlogin is anymore. * play/dunnet.el (dun-help): Bumped version number, updated contact info. -2014-06-14 Ron Schnell - * play/dunnet.el If a lamp is in the room, you won't be eaten by a grue. - -======= 2014-06-15 Michael Albinus Sync with Tramp 2.2.10. @@ -145,7 +146,6 @@ * play/dunnet.el (dun-describe-room, dun-mode): If a lamp is in the room, you won't be eaten by a grue. ->>>>>>> MERGE-SOURCE 2014-06-13 Glenn Morris * Makefile.in ($(lisp)/cus-load.el, $(lisp)/finder-inf.el) === modified file 'lisp/ruler-mode.el' --- lisp/ruler-mode.el 2014-01-01 07:43:34 +0000 +++ lisp/ruler-mode.el 2014-06-16 06:37:37 +0000 @@ -306,7 +306,6 @@ "Return a column number relative to the selected window. N is a column number relative to selected frame." (- n - (car (window-edges)) (or (car (window-margins)) 0) (fringe-columns 'left) (scroll-bar-columns 'left))) @@ -321,7 +320,7 @@ (when (eq start end) ;; mouse click (save-selected-window (select-window (posn-window start)) - (setq col (- (car (posn-col-row start)) (car (window-edges)) + (setq col (- (car (posn-col-row start)) (scroll-bar-columns 'left)) w (- (ruler-mode-full-window-width) (scroll-bar-columns 'left) @@ -343,7 +342,7 @@ (when (eq start end) ;; mouse click (save-selected-window (select-window (posn-window start)) - (setq col (- (car (posn-col-row start)) (car (window-edges)) + (setq col (- (car (posn-col-row start)) (scroll-bar-columns 'left)) w (- (ruler-mode-full-window-width) (scroll-bar-columns 'left) ------------------------------------------------------------ revno: 117350 committer: Ron Schnell branch nick: trunk timestamp: Mon 2014-06-16 01:05:05 -0400 message: * play/dunnet.el (dun-doassign): Fixed bug where UNIX variable assignment without varname or rhs causes crash. * play/dunnet.el (dun-ftp): Fixed bug where blank ftp password is allowed, making it impossible to win endgame. * play/dunnet.el (dun-unix-verbs): Added ssh as alias to rlogin, because nobody knows what rlogin is anymore. * play/dunnet.el (dun-help): Bumped version number, updated contact info. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-06-15 17:45:38 +0000 +++ lisp/ChangeLog 2014-06-16 05:05:05 +0000 @@ -1,3 +1,16 @@ +<<<<<<< TREE + +2014-06-16 Ron Schnell + + * play/dunnet.el (dun-doassign): Fixed bug where UNIX variable assignment without varname or rhs causes crash. + * play/dunnet.el (dun-ftp): Fixed bug where blank ftp password is allowed, making it impossible to win endgame. + * play/dunnet.el (dun-unix-verbs): Added ssh as alias to rlogin, because nobody knows what rlogin is anymore. + * play/dunnet.el (dun-help): Bumped version number, updated contact info. + +2014-06-14 Ron Schnell + * play/dunnet.el If a lamp is in the room, you won't be eaten by a grue. + +======= 2014-06-15 Michael Albinus Sync with Tramp 2.2.10. @@ -132,6 +145,7 @@ * play/dunnet.el (dun-describe-room, dun-mode): If a lamp is in the room, you won't be eaten by a grue. +>>>>>>> MERGE-SOURCE 2014-06-13 Glenn Morris * Makefile.in ($(lisp)/cus-load.el, $(lisp)/finder-inf.el) === modified file 'lisp/play/dunnet.el' --- lisp/play/dunnet.el 2014-06-14 20:57:34 +0000 +++ lisp/play/dunnet.el 2014-06-16 05:05:05 +0000 @@ -898,7 +898,7 @@ (defun dun-help (args) (dun-mprincl -"Welcome to dunnet (2.01), by Ron Schnell (ronnie@driver-aces.com). +"Welcome to dunnet (2.02), by Ron Schnell (ronnie@driver-aces.com - @RonnieSchnell). Here is some useful information (read carefully because there are one or more clues in here): - If you have a key that can open a door, you do not need to explicitly @@ -1387,8 +1387,8 @@ (setq dungeon-mode 'dungeon) (setq dun-unix-verbs '((ls . dun-ls) (ftp . dun-ftp) (echo . dun-echo) (exit . dun-uexit) (cd . dun-cd) (pwd . dun-pwd) - (rlogin . dun-rlogin) (uncompress . dun-uncompress) - (cat . dun-cat))) + (rlogin . dun-rlogin) (ssh . dun-rlogin) + (uncompress . dun-uncompress) (cat . dun-cat))) (setq dun-dos-verbs '((dir . dun-dos-dir) (type . dun-dos-type) (exit . dun-dos-exit) (command . dun-dos-spawn) @@ -2539,25 +2539,31 @@ (dun-mprincl "Incorrect."))) (let (varname epoint afterq i value) - (setq varname (substring line 0 esign)) - (if (not (setq epoint (string-match ")" line))) - (if (string= (substring line (1+ esign) (+ esign 2)) - "\"") - (progn - (setq afterq (substring line (+ esign 2))) - (setq epoint (+ - (string-match "\"" afterq) - (+ esign 3)))) - - (if (not (setq epoint (string-match " " line))) - (setq epoint (length line)))) - (setq epoint (1+ epoint)) - (while (and - (not (= epoint (length line))) - (setq i (string-match ")" (substring line epoint)))) - (setq epoint (+ epoint i 1)))) - (setq value (substring line (1+ esign) epoint)) - (dun-eval varname value)))) + (setq varname (replace-regexp-in-string " " "" (substring line 0 esign))) + + (if (or (= (length varname) 0) (< (- (length line) esign) 2)) + (progn + (dun-mprinc line) + (dun-mprincl " : not found.")) + + (if (not (setq epoint (string-match ")" line))) + (if (string= (substring line (1+ esign) (+ esign 2)) + "\"") + (progn + (setq afterq (substring line (+ esign 2))) + (setq epoint (+ + (string-match "\"" afterq) + (+ esign 3)))) + + (if (not (setq epoint (string-match " " line))) + (setq epoint (length line)))) + (setq epoint (1+ epoint)) + (while (and + (not (= epoint (length line))) + (setq i (string-match ")" (substring line epoint)))) + (setq epoint (+ epoint i 1)))) + (setq value (substring line (1+ esign) epoint)) + (dun-eval varname value))))) (defun dun-eval (varname value) (let (eval-error) @@ -2741,16 +2747,20 @@ (if dun-batch-mode (dun-mprincl "Login failed.") (dun-mprincl "\nLogin failed.")) - (if dun-batch-mode - (dun-mprincl - "Guest login okay, user access restrictions apply.") - (dun-mprincl - "\nGuest login okay, user access restrictions apply.")) - (dun-ftp-commands) - (setq newlist + (if (= (length ident) 0) + (if dun-batch-mode + (dun-mprincl "Password is required.") + (dun-mprincl "\nPassword is required.")) + (if dun-batch-mode + (dun-mprincl + "Guest login okay, user access restrictions apply.") + (dun-mprincl + "\nGuest login okay, user access restrictions apply.")) + (dun-ftp-commands) + (setq newlist '("What password did you use during anonymous ftp to gamma?")) - (setq newlist (append newlist (list ident))) - (rplaca (nthcdr 1 dun-endgame-questions) newlist))))))))) + (setq newlist (append newlist (list ident))) + (rplaca (nthcdr 1 dun-endgame-questions) newlist)))))))))) (defun dun-ftp-commands () (setq dun-exitf nil) ------------------------------------------------------------ revno: 117349 committer: Glenn Morris branch nick: trunk timestamp: Sun 2014-06-15 15:42:31 -0700 message: Makefile comments diff: === modified file 'lib-src/Makefile.in' --- lib-src/Makefile.in 2014-06-15 17:45:38 +0000 +++ lib-src/Makefile.in 2014-06-15 22:42:31 +0000 @@ -194,8 +194,8 @@ -I. -I../src -I../lib \ -I${srcdir} -I${srcdir}/../src -I${srcdir}/../lib -## FIXME? What is LDFLAGS doing here? ALL_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS} +## Unused. LINK_CFLAGS = ${BASE_CFLAGS} ${LDFLAGS} ${CFLAGS} CPP_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${CPPFLAGS} ${CFLAGS} === modified file 'nt/Makefile.in' --- nt/Makefile.in 2014-06-15 17:45:38 +0000 +++ nt/Makefile.in 2014-06-15 22:42:31 +0000 @@ -143,9 +143,10 @@ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ -I. -I${srcdir} -## FIXME? What is LDFLAGS doing here? ALL_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS} +## Unused. LINK_CFLAGS = ${BASE_CFLAGS} ${LDFLAGS} ${CFLAGS} +## Unused. CPP_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${CPPFLAGS} ${CFLAGS} all: ${EXE_FILES} ------------------------------------------------------------ revno: 117348 committer: Michael Albinus branch nick: trunk timestamp: Sun 2014-06-15 22:49:10 +0200 message: * NEWS: New Tramp method "nc". diff: === modified file 'etc/ChangeLog' --- etc/ChangeLog 2014-06-08 23:41:43 +0000 +++ etc/ChangeLog 2014-06-15 20:49:10 +0000 @@ -1,3 +1,7 @@ +2014-06-15 Michael Albinus + + * NEWS: New Tramp method "nc". + 2014-06-08 Leo Liu * themes/deeper-blue-theme.el: Use another fix. (Bug#17695) === modified file 'etc/NEWS' --- etc/NEWS 2014-06-15 00:06:30 +0000 +++ etc/NEWS 2014-06-15 20:49:10 +0000 @@ -102,6 +102,10 @@ When `url-handler-mode' is enabled, file operations for these protocols as well as for "telnet" and "ftp" are passed to Tramp. +** Tramp + +*** New connection method "nc", which allows to access dumb busyboxes. + ** Obsolete packages --- ------------------------------------------------------------ revno: 117347 committer: Glenn Morris branch nick: trunk timestamp: Sun 2014-06-15 10:59:30 -0700 message: * oldXMenu/Makefile.in (CPPFLAGS): Explicitly set via configure. diff: === modified file 'oldXMenu/ChangeLog' --- oldXMenu/ChangeLog 2014-06-15 00:17:21 +0000 +++ oldXMenu/ChangeLog 2014-06-15 17:59:30 +0000 @@ -1,5 +1,7 @@ 2014-06-15 Glenn Morris + * Makefile.in (CPPFLAGS): Explicitly set via configure. + * Makefile.in (mostlyclean, clean, distclean, maintainer-clean, tags): Declare as PHONY. (boostrap-clean): New. === modified file 'oldXMenu/Makefile.in' --- oldXMenu/Makefile.in 2014-06-15 01:16:35 +0000 +++ oldXMenu/Makefile.in 2014-06-15 17:59:30 +0000 @@ -56,6 +56,8 @@ EXTRA=insque.o CC=@CC@ CFLAGS=@CFLAGS@ +CPPFLAGS = @CPPFLAGS@ + TAGS = etags RM = rm -f RANLIB = @RANLIB@ ------------------------------------------------------------ revno: 117346 committer: Glenn Morris branch nick: trunk timestamp: Sun 2014-06-15 10:45:38 -0700 message: Explicitly set LDFLAGS in some sub-Makefiles * lib-src/Makefile.in (LDFLAGS): Explicitly set via configure. * nt/Makefile.in (LDFLAGS): Explicitly set via configure. diff: === modified file 'lib-src/ChangeLog' --- lib-src/ChangeLog 2014-06-15 17:36:04 +0000 +++ lib-src/ChangeLog 2014-06-15 17:45:38 +0000 @@ -1,3 +1,7 @@ +2014-06-15 Glenn Morris + + * Makefile.in (LDFLAGS): Explicitly set via configure. + 2014-06-15 Eli Zaretskii * Makefile.in (CPPFLAGS): Define. === modified file 'lib-src/Makefile.in' --- lib-src/Makefile.in 2014-06-15 17:36:04 +0000 +++ lib-src/Makefile.in 2014-06-15 17:45:38 +0000 @@ -28,7 +28,9 @@ CC=@CC@ CFLAGS=@CFLAGS@ -CPPFLAGS=@CPPFLAGS@ +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ + version=@version@ ## Used in $archlibdir. configuration=@configuration@ @@ -192,6 +194,7 @@ -I. -I../src -I../lib \ -I${srcdir} -I${srcdir}/../src -I${srcdir}/../lib +## FIXME? What is LDFLAGS doing here? ALL_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS} LINK_CFLAGS = ${BASE_CFLAGS} ${LDFLAGS} ${CFLAGS} CPP_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${CPPFLAGS} ${CFLAGS} === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-06-15 15:57:47 +0000 +++ lisp/ChangeLog 2014-06-15 17:45:38 +0000 @@ -129,7 +129,8 @@ 2014-06-14 Ron Schnell - * play/dunnet.el If a lamp is in the room, you won't be eaten by a grue. + * play/dunnet.el (dun-describe-room, dun-mode): + If a lamp is in the room, you won't be eaten by a grue. 2014-06-13 Glenn Morris === modified file 'nt/ChangeLog' --- nt/ChangeLog 2014-06-15 17:36:04 +0000 +++ nt/ChangeLog 2014-06-15 17:45:38 +0000 @@ -1,3 +1,7 @@ +2014-06-15 Glenn Morris + + * Makefile.in (LDFLAGS): Explicitly set via configure. + 2014-06-15 Eli Zaretskii * Makefile.in (CPPFLAGS): Define. === modified file 'nt/Makefile.in' --- nt/Makefile.in 2014-06-15 17:36:04 +0000 +++ nt/Makefile.in 2014-06-15 17:45:38 +0000 @@ -25,7 +25,9 @@ CC=@CC@ CFLAGS=@CFLAGS@ -CPPFLAGS=@CPPFLAGS@ +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ + version=@version@ ## Used in $archlibdir. configuration=@configuration@ @@ -141,6 +143,7 @@ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ -I. -I${srcdir} +## FIXME? What is LDFLAGS doing here? ALL_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS} LINK_CFLAGS = ${BASE_CFLAGS} ${LDFLAGS} ${CFLAGS} CPP_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${CPPFLAGS} ${CFLAGS} ------------------------------------------------------------ revno: 117345 committer: Eli Zaretskii branch nick: trunk timestamp: Sun 2014-06-15 20:36:04 +0300 message: Fix MS-Windows build broken by latest Makefile.in changes. nt/Makefile.in (CPPFLAGS): Define. lib-src/Makefile.in (CPPFLAGS): Define. diff: === modified file 'lib-src/ChangeLog' --- lib-src/ChangeLog 2014-06-15 00:34:22 +0000 +++ lib-src/ChangeLog 2014-06-15 17:36:04 +0000 @@ -1,3 +1,7 @@ +2014-06-15 Eli Zaretskii + + * Makefile.in (CPPFLAGS): Define. + 2014-06-15 Glenn Morris * Makefile.in (../lib/libgnu.a): === modified file 'lib-src/Makefile.in' --- lib-src/Makefile.in 2014-06-15 00:34:22 +0000 +++ lib-src/Makefile.in 2014-06-15 17:36:04 +0000 @@ -28,6 +28,7 @@ CC=@CC@ CFLAGS=@CFLAGS@ +CPPFLAGS=@CPPFLAGS@ version=@version@ ## Used in $archlibdir. configuration=@configuration@ === modified file 'nt/ChangeLog' --- nt/ChangeLog 2014-06-15 00:17:21 +0000 +++ nt/ChangeLog 2014-06-15 17:36:04 +0000 @@ -1,3 +1,7 @@ +2014-06-15 Eli Zaretskii + + * Makefile.in (CPPFLAGS): Define. + 2014-06-15 Glenn Morris * Makefile.in (bootstrap-clean): New. === modified file 'nt/Makefile.in' --- nt/Makefile.in 2014-06-15 00:17:21 +0000 +++ nt/Makefile.in 2014-06-15 17:36:04 +0000 @@ -25,6 +25,7 @@ CC=@CC@ CFLAGS=@CFLAGS@ +CPPFLAGS=@CPPFLAGS@ version=@version@ ## Used in $archlibdir. configuration=@configuration@ ------------------------------------------------------------ revno: 117344 committer: Michael Albinus branch nick: trunk timestamp: Sun 2014-06-15 17:57:47 +0200 message: Sync with Tramp 2.2.10. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-06-15 04:10:40 +0000 +++ lisp/ChangeLog 2014-06-15 15:57:47 +0000 @@ -1,3 +1,64 @@ +2014-06-15 Michael Albinus + + Sync with Tramp 2.2.10. + + * net/tramp.el (tramp-methods): Tweak docstring. + (tramp-handle-file-accessible-directory-p): Check for + `file-readable-p' instead of `file-executable-p'. + (tramp-check-cached-permissions): Use + `tramp-compat-file-attributes'. + (tramp-call-process): Add new argument VEC. Adapt callees in all + tramp*.el files. + + * net/tramp-adb.el (tramp-adb-handle-write-region): Improve messages. + (tramp-adb-maybe-open-connection): Don't set + `tramp-current-*' variables. + + * net/tramp-cache.el (tramp-flush-file-function): Do not flush + file properties of temporary buffers. + + * net/tramp-ftp.el (top): Remove special handling for URL syntax. + + * net/tramp-gvfs.el (tramp-gvfs-methods) : Add. + (tramp-gvfs-handle-delete-file): Flush file + properties, not directory properties. + (tramp-gvfs-handle-file-attributes): Use `string-to-number' when + reading "unix::mode". + (tramp-gvfs-handle-file-name-all-completions): + Use "-h" option for "gvfs-ls". + (tramp-gvfs-url-file-name): `user' and `localname' could be nil. + (tramp-gvfs-send-command): Simplify traces. + + * net/tramp-sh.el (vc-handled-backends, vc-bzr-program) + (vc-git-program, vc-hg-program): Declare. + (tramp-methods) : Remove. It has never worked satisfactorily. + (tramp-methods) : Add new method. + (tramp-methods) : Redirect stderr to "/dev/null". + (tramp-methods) : Improve + `tramp-login-args'. + (tramp-default-user-alist): Add "nc". + (top): Remove completion function for "sftp". Add completion + functions for "nc" and "psftp". + (tramp-do-copy-or-rename-file-out-of-band): Tweak docstring. + Implement support for "nc" method. + (tramp-sh-handle-expand-file-name, tramp-local-coding-commands) + (tramp-remote-coding-commands, tramp-call-local-coding-command): + Tweak docstring. + (tramp-sh-handle-write-region): Tweak error message. + (tramp-sh-handle-vc-registered): Remove backends when the remote + binary does not exist. + (tramp-find-inline-encoding): Do not raise an error. + (tramp-make-copy-program-file-name): Tweak docstring. Handle also + the "nc" case. Quote result also locally. + + * net/tramp-smb.el (tramp-smb-handle-copy-directory) + (tramp-smb-handle-set-file-acl): Use `start-process'. + (tramp-smb-handle-insert-directory): Use progress reporter. + (tramp-smb-handle-rename-file): Flush also file properties of + FILENAME. + + * net/trampver.el: Update release number. + 2014-06-15 Stefan Monnier * ses.el: Miscellaneous cleanups; use lexical-binding; avoid ------------------------------------------------------------ revno: 117343 committer: Michael Albinus branch nick: trunk timestamp: Sun 2014-06-15 17:56:58 +0200 message: Sync with Tramp 2.2.10. * test/automated/tramp-tests.el (tramp--test-enabled): Ignore errors. (tramp--instrument-test-case): Extend docstring. (tramp-test15-copy-directory): Skip for tramp-smb.el. (tramp-test21-file-links): Use `file-truename' for directories. (tramp-test27-start-file-process, tramp-test28-shell-command): Retrieve process output more robustly. (tramp--test-check-files): Extend test. (tramp-test30-special-characters): Skip for tramp-adb.el, tramp-gvfs.el and tramp-smb.el. Add further file names. diff: === modified file 'test/ChangeLog' --- test/ChangeLog 2014-06-13 23:05:00 +0000 +++ test/ChangeLog 2014-06-15 15:56:58 +0000 @@ -1,3 +1,17 @@ +2014-06-15 Michael Albinus + + Sync with Tramp 2.2.10. + + * automated/tramp-tests.el (tramp--test-enabled): Ignore errors. + (tramp--instrument-test-case): Extend docstring. + (tramp-test15-copy-directory): Skip for tramp-smb.el. + (tramp-test21-file-links): Use `file-truename' for directories. + (tramp-test27-start-file-process, tramp-test28-shell-command): + Retrieve process output more robustly. + (tramp--test-check-files): Extend test. + (tramp-test30-special-characters): Skip for tramp-adb.el, + tramp-gvfs.el and tramp-smb.el. Add further file names. + 2014-06-13 Glenn Morris * automated/Makefile.in (compile-main): === modified file 'test/automated/tramp-tests.el' --- test/automated/tramp-tests.el 2014-06-02 18:38:22 +0000 +++ test/automated/tramp-tests.el 2014-06-15 15:56:58 +0000 @@ -93,9 +93,10 @@ (when (cdr tramp--test-enabled-checked) ;; Cleanup connection. - (tramp-cleanup-connection - (tramp-dissect-file-name tramp-test-temporary-file-directory) - nil 'keep-password)) + (ignore-errors + (tramp-cleanup-connection + (tramp-dissect-file-name tramp-test-temporary-file-directory) + nil 'keep-password))) ;; Return result. (cdr tramp--test-enabled-checked)) @@ -109,17 +110,14 @@ (defmacro tramp--instrument-test-case (verbose &rest body) "Run BODY with `tramp-verbose' equal VERBOSE. Print the the content of the Tramp debug buffer, if BODY does not -eval properly in `should', `should-not' or `should-error'." +eval properly in `should', `should-not' or `should-error'. BODY +shall not contain a timeout." (declare (indent 1) (debug (natnump body))) `(let ((tramp-verbose ,verbose) (tramp-message-show-message t) (tramp-debug-on-error t)) (condition-case err - ;; In general, we cannot use a timeout here: this would - ;; prevent traces when the test runs into an error. -; (with-timeout (10 (ert-fail "`tramp--instrument-test-case' timed out")) - (progn - ,@body) + (progn ,@body) (ert-test-skipped (signal (car err) (cdr err))) ((error quit) @@ -868,6 +866,11 @@ (ert-deftest tramp-test15-copy-directory () "Check `copy-directory'." (skip-unless (tramp--test-enabled)) + (skip-unless + (not + (eq + (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) + 'tramp-smb-file-name-handler))) (let* ((tmp-name1 (tramp--test-make-temp-name)) (tmp-name2 (tramp--test-make-temp-name)) @@ -1074,9 +1077,14 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (skip-unless (tramp--test-enabled)) - (let ((tmp-name1 (tramp--test-make-temp-name)) - (tmp-name2 (tramp--test-make-temp-name)) - (tmp-name3 (tramp--test-make-temp-name 'local))) + ;; We must use `file-truename' for the temporary directory, because + ;; it could be located on a symlinked directory. This would let the + ;; test fail. + (let* ((tramp-test-temporary-file-directory + (file-truename tramp-test-temporary-file-directory)) + (tmp-name1 (tramp--test-make-temp-name)) + (tmp-name2 (tramp--test-make-temp-name)) + (tmp-name3 (tramp--test-make-temp-name 'local))) (unwind-protect (progn (write-region "foo" nil tmp-name1) @@ -1285,7 +1293,10 @@ (should (equal (process-status proc) 'run)) (process-send-string proc "foo") (process-send-eof proc) - (accept-process-output proc 1) + ;; Read output. + (with-timeout (10 (ert-fail "`start-file-process' timed out")) + (while (< (- (point-max) (point-min)) (length "foo")) + (accept-process-output proc 1))) (should (string-equal (buffer-string) "foo"))) (ignore-errors (delete-process proc))) @@ -1298,22 +1309,30 @@ "test2" (current-buffer) "cat" (file-name-nondirectory tmp-name))) (should (processp proc)) - (accept-process-output proc 1) + ;; Read output. + (with-timeout (10 (ert-fail "`start-file-process' timed out")) + (while (< (- (point-max) (point-min)) (length "foo")) + (accept-process-output proc 1))) (should (string-equal (buffer-string) "foo"))) (ignore-errors (delete-process proc) (delete-file tmp-name))) (unwind-protect - (progn - (setq proc (start-file-process "test3" nil "cat")) + (with-temp-buffer + (setq proc (start-file-process "test3" (current-buffer) "cat")) (should (processp proc)) (should (equal (process-status proc) 'run)) (set-process-filter - proc (lambda (_p s) (should (string-equal s "foo")))) + proc + (lambda (p s) (with-current-buffer (process-buffer p) (insert s)))) (process-send-string proc "foo") (process-send-eof proc) - (accept-process-output proc 1)) + ;; Read output. + (with-timeout (10 (ert-fail "`start-file-process' timed out")) + (while (< (- (point-max) (point-min)) (length "foo")) + (accept-process-output proc 1))) + (should (string-equal (buffer-string) "foo"))) (ignore-errors (delete-process proc))))) (ert-deftest tramp-test28-shell-command () @@ -1351,17 +1370,20 @@ (should (file-exists-p tmp-name)) (async-shell-command (format "ls %s" (file-name-nondirectory tmp-name)) (current-buffer)) - (accept-process-output (get-buffer-process (current-buffer)) 1) + (set-process-sentinel (get-buffer-process (current-buffer)) nil) + ;; Read output. (with-timeout (10 (ert-fail "`async-shell-command' timed out")) - (while - (ignore-errors - (memq (process-status (get-buffer-process (current-buffer))) - '(run open))) + (while (< (- (point-max) (point-min)) + (1+ (length (file-name-nondirectory tmp-name)))) (accept-process-output (get-buffer-process (current-buffer)) 1))) ;; `ls' could produce colorized output. (goto-char (point-min)) (while (re-search-forward tramp-color-escape-sequence-regexp nil t) (replace-match "" nil nil)) + ;; There might be a nasty "Process *Async Shell* finished" message. + (goto-char (point-min)) + (forward-line) + (narrow-to-region (point-min) (point)) (should (string-equal (format "%s\n" (file-name-nondirectory tmp-name)) (buffer-string)))) @@ -1372,16 +1394,23 @@ (write-region "foo" nil tmp-name) (should (file-exists-p tmp-name)) (async-shell-command "read line; ls $line" (current-buffer)) + (set-process-sentinel (get-buffer-process (current-buffer)) nil) (process-send-string (get-buffer-process (current-buffer)) (format "%s\n" (file-name-nondirectory tmp-name))) - (accept-process-output (get-buffer-process (current-buffer)) 1) + ;; Read output. (with-timeout (10 (ert-fail "`async-shell-command' timed out")) - (while - (ignore-errors - (memq (process-status (get-buffer-process (current-buffer))) - '(run open))) + (while (< (- (point-max) (point-min)) + (1+ (length (file-name-nondirectory tmp-name)))) (accept-process-output (get-buffer-process (current-buffer)) 1))) + ;; `ls' could produce colorized output. + (goto-char (point-min)) + (while (re-search-forward tramp-color-escape-sequence-regexp nil t) + (replace-match "" nil nil)) + ;; There might be a nasty "Process *Async Shell* finished" message. + (goto-char (point-min)) + (forward-line) + (narrow-to-region (point-min) (point)) (should (string-equal (format "%s\n" (file-name-nondirectory tmp-name)) (buffer-string)))) @@ -1465,13 +1494,34 @@ (should-not (file-exists-p file1)) (copy-file file2 tmp-name1) (should (file-exists-p file1)))) + ;; Check file names. (should (equal (directory-files tmp-name1 nil directory-files-no-dot-files-regexp) (sort (copy-sequence files) 'string-lessp))) (should (equal (directory-files tmp-name2 nil directory-files-no-dot-files-regexp) - (sort files 'string-lessp)))) + (sort (copy-sequence files) 'string-lessp))) + + ;; `substitute-in-file-name' could return different values. + ;; For `adb', there could be strange file permissions + ;; preventing overwriting a file. We don't care in this + ;; testcase. + (dolist (elt files) + (let ((file1 + (substitute-in-file-name (expand-file-name elt tmp-name1))) + (file2 + (substitute-in-file-name (expand-file-name elt tmp-name2)))) + (ignore-errors (write-region elt nil file1)) + (should (file-exists-p file1)) + (ignore-errors (write-region elt nil file2 nil 'nomessage)) + (should (file-exists-p file2)))) + + (should (equal (directory-files + tmp-name1 nil directory-files-no-dot-files-regexp) + (directory-files + tmp-name2 nil directory-files-no-dot-files-regexp)))) + (ignore-errors (delete-directory tmp-name1 'recursive)) (ignore-errors (delete-directory tmp-name2 'recursive))))) @@ -1479,6 +1529,13 @@ (ert-deftest tramp-test30-special-characters () "Check special characters in file names." (skip-unless (tramp--test-enabled)) + (skip-unless + (not + (memq + (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) + '(tramp-adb-file-name-handler + tramp-gvfs-file-name-handler + tramp-smb-file-name-handler)))) ;; Newlines, slashes and backslashes in file names are not supported. ;; So we don't test. @@ -1491,11 +1548,13 @@ "?foo?bar?baz?" "*foo*bar*baz*" "'foo\"bar'baz\"" - "#foo#bar#baz#" + "#foo~bar#baz~" "!foo|bar!baz|" ":foo;bar:baz;" "bar" - "(foo)bar(baz)")) + "(foo)bar(baz)" + "[foo]bar[baz]" + "{foo}bar{baz}")) (ert-deftest tramp-test31-utf8 () "Check UTF8 encoding in file names and file contents." @@ -1667,8 +1726,13 @@ ;; * set-file-acl ;; * set-file-selinux-context -;; * Fix `tramp-test27-start-file-process' on MS Windows (`process-send-eof'?). +;; * Work on skipped tests. Make a comment, when it is impossible. +;; * Fix `tramp-test15-copy-directory' for `smb'. Using tar in a pipe +;; doesn't work well when an interactive password must be provided. +;; * Fix `tramp-test27-start-file-process' for `nc' and on MS +;; Windows (`process-send-eof'?). ;; * Fix `tramp-test28-shell-command' on MS Windows (nasty plink message). +;; * Fix `tramp-test30-special-characters' for `adb', `nc' and `smb'. ;; * Fix `tramp-test31-utf8' for MS Windows and `nc'/`telnet' (when ;; target is a dumb busybox). Seems to be in `directory-files'. ;; * Fix Bug#16928. Set expected error of `tramp-test32-asynchronous-requests'. ------------------------------------------------------------ revno: 117342 committer: Michael Albinus branch nick: trunk timestamp: Sun 2014-06-15 17:47:35 +0200 message: Sync with Tramp 2.2.10. * lisp/net/tramp-adb.el (tramp-adb-handle-write-region): Improve messages. (tramp-adb-maybe-open-connection): Don't set `tramp-current-*' variables. * lisp/net/tramp-cache.el (tramp-flush-file-function): Do not flush file properties of temporary buffers. * lisp/net/tramp-ftp.el (top): Remove special handling for URL syntax. * lisp/net/tramp-gvfs.el (tramp-gvfs-methods) : Add. (tramp-gvfs-handle-delete-file): Flush file properties, not directory properties. (tramp-gvfs-handle-file-attributes): Use `string-to-number' when reading "unix::mode". (tramp-gvfs-handle-file-name-all-completions): Use "-h" option for "gvfs-ls". (tramp-gvfs-url-file-name): `user' and `localname' could be nil. (tramp-gvfs-send-command): Simplify traces. * lisp/net/tramp-sh.el (vc-handled-backends, vc-bzr-program) (vc-git-program, vc-hg-program): Declare. (tramp-methods) : Remove. It has never worked satisfactorily. (tramp-methods) : Add new method. (tramp-methods) : Redirect stderr to "/dev/null". (tramp-methods) : Improve `tramp-login-args'. (tramp-default-user-alist): Add "nc". (top): Remove completion function for "sftp". Add completion functions for "nc" and "psftp". (tramp-do-copy-or-rename-file-out-of-band): Tweak docstring. Implement support for "nc" method. (tramp-sh-handle-expand-file-name, tramp-local-coding-commands) (tramp-remote-coding-commands, tramp-call-local-coding-command): Tweak docstring. (tramp-sh-handle-write-region): Tweak error message. (tramp-sh-handle-vc-registered): Remove backends when the remote binary does not exist. (tramp-find-inline-encoding): Do not raise an error. (tramp-make-copy-program-file-name): Tweak docstring. Handle also the "nc" case. Quote result also locally. * lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory) (tramp-smb-handle-set-file-acl): Use `start-process'. (tramp-smb-handle-insert-directory): Use progress reporter. (tramp-smb-handle-rename-file): Flush also file properties of FILENAME. * lisp/net/tramp.el (tramp-methods): Tweak docstring. (tramp-handle-file-accessible-directory-p): Check for `file-readable-p' instead of `file-executable-p'. (tramp-check-cached-permissions): Use `tramp-compat-file-attributes'. (tramp-call-process): Add new argument VEC. Adapt callees in all tramp*.el files. * lisp/net/trampver.el: Update release number. diff: === modified file 'lisp/net/tramp-adb.el' --- lisp/net/tramp-adb.el 2014-04-18 18:57:04 +0000 +++ lisp/net/tramp-adb.el 2014-06-15 15:47:35 +0000 @@ -609,10 +609,10 @@ 'write-region (list start end tmpfile append 'no-message lockname confirm)) (with-tramp-progress-reporter - v 3 (format "Moving tmp file %s to %s" tmpfile filename) + v 3 (format "Moving tmp file `%s' to `%s'" tmpfile filename) (unwind-protect (when (tramp-adb-execute-adb-command v "push" tmpfile localname) - (tramp-error v 'file-error "Cannot write: `%s' filename")) + (tramp-error v 'file-error "Cannot write: `%s'" filename)) (delete-file tmpfile))) (when (or (eq visit t) (stringp visit)) @@ -998,7 +998,8 @@ (with-temp-buffer (prog1 (unless - (zerop (apply 'tramp-call-process tramp-adb-program nil t nil args)) + (zerop + (apply 'tramp-call-process vec tramp-adb-program nil t nil args)) (buffer-string)) (tramp-message vec 6 "%s" (buffer-string))))) @@ -1107,10 +1108,7 @@ (and p (processp p) (memq (process-status p) '(run open))) (save-match-data (when (and p (processp p)) (delete-process p)) - (setq tramp-current-method (tramp-file-name-method vec) - tramp-current-user (tramp-file-name-user vec) - tramp-current-host (tramp-file-name-host vec) - devices (mapcar 'cadr (tramp-adb-parse-device-names nil))) + (setq devices (mapcar 'cadr (tramp-adb-parse-device-names nil))) (if (not devices) (tramp-error vec 'file-error "No device connected")) (if (and (> (length host) 0) (not (member host devices))) === modified file 'lisp/net/tramp-cache.el' --- lisp/net/tramp-cache.el 2014-02-28 08:41:24 +0000 +++ lisp/net/tramp-cache.el 2014-06-15 15:47:35 +0000 @@ -203,13 +203,15 @@ ;; not show proper directory contents when a file has been copied or ;; deleted before. (defun tramp-flush-file-function () - "Flush all Tramp cache properties from `buffer-file-name'." - (let ((bfn (if (stringp (buffer-file-name)) - (buffer-file-name) - default-directory))) - (when (tramp-tramp-file-p bfn) - (with-parsed-tramp-file-name bfn nil - (tramp-flush-file-property v localname))))) + "Flush all Tramp cache properties from `buffer-file-name'. +This is suppressed for temporary buffers." + (unless (string-match "^ \\*temp\\*" (or (buffer-name) "")) + (let ((bfn (if (stringp (buffer-file-name)) + (buffer-file-name) + default-directory))) + (when (tramp-tramp-file-p bfn) + (with-parsed-tramp-file-name bfn nil + (tramp-flush-file-property v localname)))))) (add-hook 'before-revert-hook 'tramp-flush-file-function) (add-hook 'eshell-pre-command-hook 'tramp-flush-file-function) === modified file 'lisp/net/tramp-ftp.el' --- lisp/net/tramp-ftp.el 2014-01-01 07:43:34 +0000 +++ lisp/net/tramp-ftp.el 2014-06-15 15:47:35 +0000 @@ -120,17 +120,6 @@ tramp-ftp-method '((tramp-parse-netrc "~/.netrc")))) -;; If there is URL syntax, `substitute-in-file-name' needs special -;; handling. -(put 'substitute-in-file-name 'ange-ftp 'tramp-handle-substitute-in-file-name) -(add-hook 'tramp-ftp-unload-hook - (lambda () - (setplist 'substitute-in-file-name - (delete 'ange-ftp - (delete 'tramp-handle-substitute-in-file-name - (symbol-plist - 'substitute-in-file-name)))))) - ;;;###tramp-autoload (defun tramp-ftp-file-name-handler (operation &rest args) "Invoke the Ange-FTP handler for OPERATION. === modified file 'lisp/net/tramp-gvfs.el' --- lisp/net/tramp-gvfs.el 2014-03-06 13:23:04 +0000 +++ lisp/net/tramp-gvfs.el 2014-06-15 15:47:35 +0000 @@ -49,14 +49,14 @@ ;; The customer option `tramp-gvfs-methods' contains the list of ;; supported connection methods. Per default, these are "dav", -;; "davs", "obex" and "synce". Note that with "obex" it might be -;; necessary to pair with the other bluetooth device, if it hasn't +;; "davs", "obex", "sftp" and "synce". Note that with "obex" it might +;; be necessary to pair with the other bluetooth device, if it hasn't ;; been done already. There might be also some few seconds delay in ;; discovering available bluetooth devices. -;; Other possible connection methods are "ftp", "sftp" and "smb". -;; When one of these methods is added to the list, the remote access -;; for that method is performed via GVFS instead of the native Tramp +;; Other possible connection methods are "ftp" and "smb". When one of +;; these methods is added to the list, the remote access for that +;; method is performed via GVFS instead of the native Tramp ;; implementation. ;; GVFS offers even more connection methods. The complete list of @@ -110,7 +110,7 @@ (require 'custom)) ;;;###tramp-autoload -(defcustom tramp-gvfs-methods '("dav" "davs" "obex" "synce") +(defcustom tramp-gvfs-methods '("dav" "davs" "obex" "sftp" "synce") "List of methods for remote files, accessed with GVFS." :group 'tramp :version "23.2" @@ -661,7 +661,7 @@ "Like `delete-file' for Tramp files." (with-parsed-tramp-file-name filename nil (tramp-flush-file-property v (file-name-directory localname)) - (tramp-flush-directory-property v localname) + (tramp-flush-file-property v localname) (unless (tramp-gvfs-send-command v (if (and trash delete-by-moving-to-trash) "gvfs-trash" "gvfs-rm") @@ -794,7 +794,8 @@ (goto-char (point-min)) (setq res-filemodes (if (re-search-forward "unix::mode:\\s-+\\([0-9]+\\)" nil t) - (tramp-file-mode-from-int (match-string 1)) + (tramp-file-mode-from-int + (string-to-number (match-string 1))) (if dirp "drwx------" "-rwx------"))) ;; ... inode and device (goto-char (point-min)) @@ -899,7 +900,7 @@ entry) ;; Get a list of directories and files. (tramp-gvfs-send-command - v "gvfs-ls" (tramp-gvfs-url-file-name directory)) + v "gvfs-ls" "-h" (tramp-gvfs-url-file-name directory)) ;; Now grab the output. (with-temp-buffer @@ -1118,9 +1119,9 @@ (setq user (concat (match-string 2 user) ";" (match-string 1 user)))) (url-parse-make-urlobj - method (url-hexify-string user) nil + method (and user (url-hexify-string user)) nil (tramp-file-name-real-host v) (tramp-file-name-port v) - (url-hexify-string localname) nil nil t)) + (and localname (url-hexify-string localname)) nil nil t)) (url-parse-make-urlobj "file" nil nil nil nil (url-hexify-string (file-truename filename)) nil nil t)))) @@ -1555,14 +1556,10 @@ "Send the COMMAND with its ARGS to connection VEC. COMMAND is usually a command from the gvfs-* utilities. `call-process' is applied, and it returns `t' if the return code is zero." - (let (result) - (with-current-buffer (tramp-get-connection-buffer vec) - (tramp-gvfs-maybe-open-connection vec) - (erase-buffer) - (tramp-message vec 6 "%s %s" command (mapconcat 'identity args " ")) - (setq result (apply 'tramp-call-process command nil t nil args)) - (tramp-message vec 6 "\n%s" (buffer-string)) - (zerop result)))) + (with-current-buffer (tramp-get-connection-buffer vec) + (tramp-gvfs-maybe-open-connection vec) + (erase-buffer) + (zerop (apply 'tramp-call-process vec command nil t nil args)))) ;; D-Bus BLUEZ functions. @@ -1671,7 +1668,7 @@ (list user host))) (zeroconf-list-services "_webdav._tcp"))) -;; Add completion function for DAV and DAVS methods. +;; Add completion function for SFTP, DAV and DAVS methods. (when (and tramp-gvfs-enabled (member zeroconf-service-avahi (dbus-list-known-names :system))) (zeroconf-init tramp-gvfs-zeroconf-domain) === modified file 'lisp/net/tramp-sh.el' --- lisp/net/tramp-sh.el 2014-05-17 09:00:54 +0000 +++ lisp/net/tramp-sh.el 2014-06-15 15:47:35 +0000 @@ -35,6 +35,10 @@ (defvar directory-sep-char) (defvar tramp-gw-tunnel-method) (defvar tramp-gw-socks-method) +(defvar vc-handled-backends) +(defvar vc-bzr-program) +(defvar vc-git-program) +(defvar vc-hg-program) (defcustom tramp-inline-compress-start-size 4096 "The minimum size of compressing where inline transfer. @@ -142,17 +146,6 @@ (tramp-default-port 22))) ;;;###tramp-autoload (add-to-list 'tramp-methods - '("sftp" - (tramp-login-program "ssh") - (tramp-login-args (("-l" "%u") ("-p" "%p") ("%c") - ("-e" "none") ("%h"))) - (tramp-async-args (("-q"))) - (tramp-remote-shell "/bin/sh") - (tramp-remote-shell-args ("-c")) - (tramp-copy-program "sftp") - (tramp-copy-args ("%c")))) - ;;;###tramp-autoload -(add-to-list 'tramp-methods '("rsync" (tramp-login-program "ssh") (tramp-login-args (("-l" "%u") ("-p" "%p") ("%c") @@ -210,9 +203,23 @@ (add-to-list 'tramp-methods '("telnet" (tramp-login-program "telnet") - (tramp-login-args (("%h") ("%p"))) - (tramp-remote-shell "/bin/sh") - (tramp-remote-shell-args ("-c")) + (tramp-login-args (("%h") ("%p") ("2>/dev/null"))) + (tramp-remote-shell "/bin/sh") + (tramp-remote-shell-args ("-c")) + (tramp-default-port 23))) +;;;###tramp-autoload +(add-to-list 'tramp-methods + '("nc" + (tramp-login-program "telnet") + (tramp-login-args (("%h") ("%p") ("2>/dev/null"))) + (tramp-remote-shell "/bin/sh") + (tramp-remote-shell-args ("-c")) + (tramp-copy-program "nc") + ;; We use "-v" for better error tracking. + (tramp-copy-args (("-w" "1") ("-v") ("%h") ("%r"))) + (tramp-remote-copy-program "nc") + ;; We use "-p" as required for busyboxes. + (tramp-remote-copy-args (("-l") ("-p" "%r"))) (tramp-default-port 23))) ;;;###tramp-autoload (add-to-list 'tramp-methods @@ -249,9 +256,16 @@ (tramp-remote-shell-args ("-c")))) ;;;###tramp-autoload (add-to-list 'tramp-methods - '("plink" + `("plink" (tramp-login-program "plink") - (tramp-login-args (("-l" "%u") ("-P" "%p") ("-ssh") ("%h"))) + ;; ("%h") must be a single element, see `tramp-compute-multi-hops'. + (tramp-login-args (("-l" "%u") ("-P" "%p") ("-ssh") ("-t") + ("%h") ("\"") + (,(format + "env 'TERM=%s' 'PROMPT_COMMAND=' 'PS1=%s'" + tramp-terminal-type + tramp-initial-end-of-output)) + ("/bin/sh") ("\""))) (tramp-remote-shell "/bin/sh") (tramp-remote-shell-args ("-c")) (tramp-default-port 22))) @@ -259,21 +273,25 @@ (add-to-list 'tramp-methods `("plinkx" (tramp-login-program "plink") - ;; ("%h") must be a single element, see - ;; `tramp-compute-multi-hops'. - (tramp-login-args (("-load") ("%h") ("-t") + (tramp-login-args (("-load") ("%h") ("-t") ("\"") (,(format "env 'TERM=%s' 'PROMPT_COMMAND=' 'PS1=%s'" tramp-terminal-type tramp-initial-end-of-output)) - ("/bin/sh"))) + ("/bin/sh") ("\""))) (tramp-remote-shell "/bin/sh") (tramp-remote-shell-args ("-c")))) ;;;###tramp-autoload (add-to-list 'tramp-methods - '("pscp" + `("pscp" (tramp-login-program "plink") - (tramp-login-args (("-l" "%u") ("-P" "%p") ("-ssh") ("%h"))) + (tramp-login-args (("-l" "%u") ("-P" "%p") ("-ssh") ("-t") + ("%h") ("\"") + (,(format + "env 'TERM=%s' 'PROMPT_COMMAND=' 'PS1=%s'" + tramp-terminal-type + tramp-initial-end-of-output)) + ("/bin/sh") ("\""))) (tramp-remote-shell "/bin/sh") (tramp-remote-shell-args ("-c")) (tramp-copy-program "pscp") @@ -284,9 +302,15 @@ (tramp-default-port 22))) ;;;###tramp-autoload (add-to-list 'tramp-methods - '("psftp" + `("psftp" (tramp-login-program "plink") - (tramp-login-args (("-l" "%u") ("-P" "%p") ("-ssh") ("%h"))) + (tramp-login-args (("-l" "%u") ("-P" "%p") ("-ssh") ("-t") + ("%h") ("\"") + (,(format + "env 'TERM=%s' 'PROMPT_COMMAND=' 'PS1=%s'" + tramp-terminal-type + tramp-initial-end-of-output)) + ("/bin/sh") ("\""))) (tramp-remote-shell "/bin/sh") (tramp-remote-shell-args ("-c")) (tramp-copy-program "pscp") @@ -319,7 +343,8 @@ (add-to-list 'tramp-default-user-alist `(,(concat "\\`" - (regexp-opt '("rcp" "remcp" "rsh" "telnet" "krlogin" "fcp")) + (regexp-opt + '("rcp" "remcp" "rsh" "telnet" "nc" "krlogin" "fcp")) "\\'") nil ,(user-login-name))) @@ -370,7 +395,6 @@ (tramp-set-completion-function "remcp" tramp-completion-function-alist-rsh) (tramp-set-completion-function "scp" tramp-completion-function-alist-ssh) (tramp-set-completion-function "scpx" tramp-completion-function-alist-ssh) - (tramp-set-completion-function "sftp" tramp-completion-function-alist-ssh) (tramp-set-completion-function "rsync" tramp-completion-function-alist-ssh) (tramp-set-completion-function "rsh" tramp-completion-function-alist-rsh) (tramp-set-completion-function "remsh" tramp-completion-function-alist-rsh) @@ -378,6 +402,7 @@ (tramp-set-completion-function "sshx" tramp-completion-function-alist-ssh) (tramp-set-completion-function "telnet" tramp-completion-function-alist-telnet) + (tramp-set-completion-function "nc" tramp-completion-function-alist-telnet) (tramp-set-completion-function "su" tramp-completion-function-alist-su) (tramp-set-completion-function "sudo" tramp-completion-function-alist-su) (tramp-set-completion-function "ksu" tramp-completion-function-alist-su) @@ -387,6 +412,7 @@ (tramp-set-completion-function "plinkx" tramp-completion-function-alist-putty) (tramp-set-completion-function "pscp" tramp-completion-function-alist-ssh) + (tramp-set-completion-function "psftp" tramp-completion-function-alist-ssh) (tramp-set-completion-function "fcp" tramp-completion-function-alist-ssh))) ;; "getconf PATH" yields: @@ -1346,7 +1372,7 @@ ;; We are local, so we don't need the UTC settings. (zerop (tramp-call-process - "touch" nil nil nil "-t" + nil "touch" nil nil nil "-t" (format-time-string "%Y%m%d%H%M.%S" time) (tramp-shell-quote-argument filename))))) @@ -1380,7 +1406,7 @@ (let ((uid (or (and (natnump uid) uid) (tramp-get-local-uid 'integer))) (gid (or (and (natnump gid) gid) (tramp-get-local-gid 'integer)))) (tramp-call-process - "chown" nil nil nil + nil "chown" nil nil nil (format "%d:%d" uid gid) (tramp-shell-quote-argument filename)))))) (defun tramp-remote-selinux-p (vec) @@ -1542,7 +1568,7 @@ (defun tramp-sh-handle-file-directory-p (filename) "Like `file-directory-p' for Tramp files." (with-parsed-tramp-file-name filename nil - ;; `file-directory-p' is used as predicate for filename completion. + ;; `file-directory-p' is used as predicate for file name completion. ;; Sometimes, when a connection is not established yet, it is ;; desirable to return t immediately for "/method:foo:". It can ;; be expected that this is always a directory. @@ -1644,10 +1670,10 @@ vec (format (concat - ;; We must care about filenames with spaces, or starting with + ;; We must care about file names with spaces, or starting with ;; "-"; this would confuse xargs. "ls -aQ" might be a solution, ;; but it does not work on all remote systems. Therefore, we - ;; quote the filenames via sed. + ;; quote the file names via sed. "cd %s; echo \"(\"; (%s -a | sed -e s/\\$/\\\"/g -e s/^/\\\"/g | " "xargs %s -c " "'(\"%%n\" (\"%%N\") %%h %s %s %%Xe0 %%Ye0 %%Ze0 %%se0 \"%%A\" t %%ie0 -1)'" @@ -1670,15 +1696,15 @@ (mapcar 'list (or - ;; Try cache entries for filename, filename with last - ;; character removed, filename with last two characters + ;; Try cache entries for `filename', `filename' with last + ;; character removed, `filename' with last two characters ;; removed, ..., and finally the empty string - all ;; concatenated to the local directory name. (let ((remote-file-name-inhibit-cache (or remote-file-name-inhibit-cache tramp-completion-reread-directory-timeout))) - ;; This is inefficient for very long filenames, pity + ;; This is inefficient for very long file names, pity ;; `reduce' is not available... (car (apply @@ -1742,7 +1768,7 @@ (tramp-shell-quote-argument localname) (tramp-get-ls-command v) ;; When `filename' is empty, just `ls' without - ;; filename argument is more efficient than `ls *' + ;; `filename' argument is more efficient than `ls *' ;; for very large directories and might avoid the ;; `Argument list too long' error. ;; @@ -1981,7 +2007,7 @@ ;; create a new buffer, insert the contents of the ;; source file into it, then write out the buffer to ;; the target file. The advantage is that it doesn't - ;; matter which filename handlers are used for the + ;; matter which file name handlers are used for the ;; source and target file. (t (tramp-do-copy-or-rename-file-via-buffer @@ -2212,19 +2238,19 @@ (set-file-modes newname file-modes)))))) (defun tramp-do-copy-or-rename-file-out-of-band (op filename newname keep-date) - "Invoke rcp program to copy. + "Invoke `scp' program to copy. The method used must be an out-of-band method." (let* ((t1 (tramp-tramp-file-p filename)) (t2 (tramp-tramp-file-p newname)) (orig-vec (tramp-dissect-file-name (if t1 filename newname))) - copy-program copy-args copy-env copy-keep-date port spec - options source target) + copy-program copy-args copy-env copy-keep-date port listener spec + options source target remote-copy-program remote-copy-args) (with-parsed-tramp-file-name (if t1 filename newname) nil (if (and t1 t2) ;; Both are Tramp files. We shall optimize it when the - ;; methods for filename and newname are the same. + ;; methods for FILENAME and NEWNAME are the same. (let* ((dir-flag (file-directory-p filename)) (tmpfile (tramp-compat-make-temp-file localname dir-flag))) (if dir-flag @@ -2285,6 +2311,13 @@ (setq user (or (tramp-file-name-user v) (tramp-get-connection-property v "login-as" nil))) + ;; Check for listener port. + (when (tramp-get-method-parameter method 'tramp-remote-copy-args) + (setq listener (number-to-string (+ 50000 (random 10000)))) + (while + (zerop (tramp-call-process v "nc" nil nil nil "-z" host listener)) + (setq listener (number-to-string (+ 50000 (random 10000)))))) + ;; Compose copy command. (setq host (or host "") user (or user "") @@ -2297,7 +2330,7 @@ tramp-ssh-controlmaster-options "") spec) spec (format-spec-make - ?h host ?u user ?p port ?c options + ?h host ?u user ?p port ?r listener ?c options ?k (if keep-date " " "")) copy-program (tramp-get-method-parameter method 'tramp-copy-program) @@ -2325,12 +2358,57 @@ (lambda (x) (setq x (mapcar (lambda (y) (format-spec y spec)) x)) (unless (member "" x) (mapconcat 'identity x " "))) - (tramp-get-method-parameter method 'tramp-copy-env)))) + (tramp-get-method-parameter method 'tramp-copy-env))) + remote-copy-program (tramp-get-method-parameter + method 'tramp-remote-copy-program) + remote-copy-args + (delete + ;; " " has either been a replacement of "%k" (when + ;; keep-date argument is non-nil), or a replacement + ;; for the whole keep-date sublist. + " " + (dolist + (x + (tramp-get-method-parameter method 'tramp-remote-copy-args) + remote-copy-args) + (setq remote-copy-args + (append + remote-copy-args + (let ((y (mapcar (lambda (z) (format-spec z spec)) x))) + (if (member "" y) '(" ") y))))))) - ;; Check for program. + ;; Check for local copy program. (unless (executable-find copy-program) (tramp-error - v 'file-error "Cannot find copy program: %s" copy-program)) + v 'file-error "Cannot find local copy program: %s" copy-program)) + + ;; Install listener on the remote side. The prompt must be + ;; consumed later on, when the process does not listen anymore. + (when remote-copy-program + (unless (with-tramp-connection-property + v (concat "remote-copy-program-" remote-copy-program) + (tramp-find-executable + v remote-copy-program (tramp-get-remote-path v))) + (tramp-error + v 'file-error + "Cannot find remote listener: %s" remote-copy-program)) + (setq remote-copy-program + (mapconcat + 'identity + (append + (list remote-copy-program) remote-copy-args + (list (if t1 (concat "<" source) (concat ">" target)) "&")) + " ")) + (tramp-send-command v remote-copy-program) + (with-timeout + (1 (tramp-error + v 'file-error + "Listener process not running on remote host: `%s'" + remote-copy-program)) + (tramp-send-command v (format "netstat -l | grep -q :%s" listener)) + (while (not (tramp-send-command-and-check v nil)) + (tramp-send-command + v (format "netstat -l | grep -q :%s" listener))))) (with-temp-buffer (unwind-protect @@ -2347,24 +2425,26 @@ (tramp-message orig-vec 6 "%s=\"%s\"" (car copy-env) (cadr copy-env)) (setenv (pop copy-env) (pop copy-env))) + (setq + copy-args + (append + copy-args + (if remote-copy-program + (list (if t1 (concat ">" target) (concat "<" source))) + (list source target)))) ;; Use an asynchronous process. By this, password can - ;; be handled. The default directory must be local, in - ;; order to apply the correct `copy-program'. We don't - ;; set a timeout, because the copying of large files can - ;; last longer than 60 secs. - (let ((p (let ((default-directory - (tramp-compat-temporary-file-directory))) - (apply 'start-process-shell-command - (tramp-get-connection-name v) - (tramp-get-connection-buffer v) - copy-program - (append - copy-args - (list - source target - "&&" "echo" "tramp_exit_status" "0" - "||" "echo" "tramp_exit_status" "1")))))) + ;; be handled. We don't set a timeout, because the + ;; copying of large files can last longer than 60 + ;; secs. + (let ((p (apply 'start-process-shell-command + (tramp-get-connection-name v) + (tramp-get-connection-buffer v) + copy-program + (append + copy-args + (list "&&" "echo" "tramp_exit_status" "0" + "||" "echo" "tramp_exit_status" "1"))))) (tramp-message orig-vec 6 "%s" (mapconcat 'identity (process-command p) " ")) @@ -2391,7 +2471,14 @@ ;; Reset the transfer process properties. (tramp-set-connection-property v "process-name" nil) - (tramp-set-connection-property v "process-buffer" nil))) + (tramp-set-connection-property v "process-buffer" nil) + ;; Clear the remote prompt. + (when (and remote-copy-program + (not (tramp-send-command-and-check v nil))) + ;; Houston, we have a problem! Likely, the listener is + ;; still running, so let's clear everything (but the + ;; cached password). + (tramp-cleanup-connection v 'keep-debug 'keep-password)))) ;; Handle KEEP-DATE argument. (when (and keep-date (not copy-keep-date)) @@ -2621,7 +2708,8 @@ (delete-region (match-beginning 0) (point))) ;; Some busyboxes are reluctant to discard colors. - (unless (string-match "color" (tramp-get-connection-property v "ls" "")) + (unless + (string-match "color" (tramp-get-connection-property v "ls" "")) (goto-char beg) (while (re-search-forward tramp-color-escape-sequence-regexp nil t) (replace-match ""))) @@ -2651,9 +2739,9 @@ (defun tramp-sh-handle-expand-file-name (name &optional dir) "Like `expand-file-name' for Tramp files. -If the localname part of the given filename starts with \"/../\" then -the result will be a local, non-Tramp, filename." - ;; If DIR is not given, use DEFAULT-DIRECTORY or "/". +If the localname part of the given file name starts with \"/../\" then +the result will be a local, non-Tramp, file name." + ;; If DIR is not given, use `default-directory' or "/". (setq dir (or dir default-directory "/")) ;; Unless NAME is absolute, concat DIR and NAME. (unless (file-name-absolute-p name) @@ -3133,7 +3221,7 @@ (symbol-value 'last-coding-system-used)))) ;; The permissions of the temporary file should be set. If - ;; filename does not exist (eq modes nil) it has been + ;; FILENAME does not exist (eq modes nil) it has been ;; renamed to the backup file. This case `save-buffer' ;; handles permissions. ;; Ensure that it is still readable. @@ -3144,7 +3232,7 @@ ;; This is a bit lengthy due to the different methods ;; possible for file transfer. First, we check whether the - ;; method uses an rcp program. If so, we call it. + ;; method uses an scp program. If so, we call it. ;; Otherwise, both encoding and decoding command must be ;; specified. However, if the method _also_ specifies an ;; encoding function, then that is used for encoding the @@ -3238,7 +3326,7 @@ (erase-buffer) (and ;; cksum runs locally, if possible. - (zerop (tramp-call-process "cksum" tmpfile t)) + (zerop (tramp-call-process v "cksum" tmpfile t)) ;; cksum runs remotely. (tramp-send-command-and-check v @@ -3264,7 +3352,7 @@ (tramp-error v 'file-error (concat "Method `%s' should specify both encoding and " - "decoding command or an rcp program") + "decoding command or an scp program") method)))) ;; Make `last-coding-system-used' have the right value. @@ -3281,7 +3369,7 @@ (when (or (eq visit t) (stringp visit)) (let ((file-attr (tramp-compat-file-attributes filename 'integer))) (set-visited-file-modtime - ;; We must pass modtime explicitly, because filename can + ;; We must pass modtime explicitly, because FILENAME can ;; be different from (buffer-file-name), f.e. if ;; `file-precious-flag' is set. (nth 5 file-attr)) @@ -3369,7 +3457,28 @@ ;; calls shall be answered from the file cache. We unset ;; `process-file-side-effects' and `remote-file-name-inhibit-cache' ;; in order to keep the cache. - (let (remote-file-name-inhibit-cache process-file-side-effects) + (let ((vc-handled-backends vc-handled-backends) + remote-file-name-inhibit-cache process-file-side-effects) + ;; Reduce `vc-handled-backends' in order to minimize process calls. + (when (and (memq 'Bzr vc-handled-backends) + (boundp 'vc-bzr-program) + (not (with-tramp-connection-property v vc-bzr-program + (tramp-find-executable + v vc-bzr-program (tramp-get-remote-path v))))) + (setq vc-handled-backends (delq 'Bzr vc-handled-backends))) + (when (and (memq 'Git vc-handled-backends) + (boundp 'vc-git-program) + (not (with-tramp-connection-property v vc-git-program + (tramp-find-executable + v vc-git-program (tramp-get-remote-path v))))) + (setq vc-handled-backends (delq 'Git vc-handled-backends))) + (when (and (memq 'Hg vc-handled-backends) + (boundp 'vc-hg-program) + (not (with-tramp-connection-property v vc-hg-program + (tramp-find-executable + v vc-hg-program (tramp-get-remote-path v))))) + (setq vc-handled-backends (delq 'Hg vc-handled-backends))) + ;; Run. (ignore-errors (tramp-run-real-handler 'vc-registered (list file)))))))) @@ -4010,7 +4119,7 @@ ENCODING and DECODING can be strings, giving commands, or symbols, giving functions. If they are strings, then they can contain the \"%s\" format specifier. If that specifier is present, the input -filename will be put into the command line at that spot. If the +file name will be put into the command line at that spot. If the specifier is not present, the input should be read from standard input. @@ -4045,7 +4154,7 @@ ENCODING and DECODING can be strings, giving commands, or symbols, giving variables. If they are strings, then they can contain the \"%s\" format specifier. If that specifier is present, the input -filename will be put into the command line at that spot. If the +file name will be put into the command line at that spot. If the specifier is not present, the input should be read from standard input. @@ -4171,32 +4280,28 @@ (setq rem-dec (nth 2 ritem)) (setq found t))))))) - ;; Did we find something? - (unless found - (tramp-error - vec 'file-error "Couldn't find an inline transfer encoding")) - - ;; Set connection properties. Since the commands are risky (due - ;; to output direction), we cache them in the process cache. - (tramp-message vec 5 "Using local encoding `%s'" loc-enc) - (tramp-set-connection-property p "local-encoding" loc-enc) - (tramp-message vec 5 "Using local decoding `%s'" loc-dec) - (tramp-set-connection-property p "local-decoding" loc-dec) - (tramp-message vec 5 "Using remote encoding `%s'" rem-enc) - (tramp-set-connection-property p "remote-encoding" rem-enc) - (tramp-message vec 5 "Using remote decoding `%s'" rem-dec) - (tramp-set-connection-property p "remote-decoding" rem-dec)))) + (when found + ;; Set connection properties. Since the commands are risky + ;; (due to output direction), we cache them in the process cache. + (tramp-message vec 5 "Using local encoding `%s'" loc-enc) + (tramp-set-connection-property p "local-encoding" loc-enc) + (tramp-message vec 5 "Using local decoding `%s'" loc-dec) + (tramp-set-connection-property p "local-decoding" loc-dec) + (tramp-message vec 5 "Using remote encoding `%s'" rem-enc) + (tramp-set-connection-property p "remote-encoding" rem-enc) + (tramp-message vec 5 "Using remote decoding `%s'" rem-dec) + (tramp-set-connection-property p "remote-decoding" rem-dec))))) (defun tramp-call-local-coding-command (cmd input output) "Call the local encoding or decoding command. If CMD contains \"%s\", provide input file INPUT there in command. Otherwise, INPUT is passed via standard input. INPUT can also be nil which means `/dev/null'. -OUTPUT can be a string (which specifies a filename), or t (which +OUTPUT can be a string (which specifies a file name), or t (which means standard output and thus the current buffer), or nil (which means discard it)." (tramp-call-process - tramp-encoding-shell + nil tramp-encoding-shell (when (and input (not (string-match "%s" cmd))) input) (if (eq output t) t nil) nil @@ -4844,15 +4949,18 @@ "")) (defun tramp-make-copy-program-file-name (vec) - "Create a file name suitable to be passed to `rcp' and workalikes." - (let ((user (tramp-file-name-user vec)) + "Create a file name suitable to be passed to `scp' or `nc' and workalikes." + (let ((method (tramp-file-name-method vec)) + (user (tramp-file-name-user vec)) (host (tramp-file-name-real-host vec)) (localname (tramp-shell-quote-argument (tramp-file-name-localname vec)))) - (shell-quote-argument - (if (not (zerop (length user))) - (format "%s@%s:%s" user host localname) - (format "%s:%s" host localname))))) + (cond + ((tramp-get-method-parameter method 'tramp-remote-copy-program) + localname) + ((not (zerop (length user))) + (shell-quote-argument (format "%s@%s:%s" user host localname))) + (t (shell-quote-argument (format "%s:%s" host localname)))))) (defun tramp-method-out-of-band-p (vec size) "Return t if this is an out-of-band method, nil otherwise." @@ -5371,9 +5479,5 @@ ;; rsync). ;; * Keep a second connection open for out-of-band methods like scp or ;; rsync. -;; * Try telnet+curl as new method. It might be useful for busybox, -;; without built-in uuencode/uudecode. -;; * Try telnet+nc as new method. It might be useful for busybox, -;; without built-in uuencode/uudecode. ;;; tramp-sh.el ends here === modified file 'lisp/net/tramp-smb.el' --- lisp/net/tramp-smb.el 2014-02-19 19:24:32 +0000 +++ lisp/net/tramp-smb.el 2014-06-15 15:47:35 +0000 @@ -447,8 +447,7 @@ (expand-file-name tramp-temp-name-prefix (tramp-compat-temporary-file-directory)))) - (args (list tramp-smb-program - (concat "//" real-host "/" share) "-E"))) + (args (list (concat "//" real-host "/" share) "-E"))) (if (not (zerop (length real-user))) (setq args (append args (list "-U" real-user))) @@ -495,10 +494,11 @@ ;; Use an asynchronous processes. By this, ;; password can be handled. (let* ((default-directory tmpdir) - (p (start-process-shell-command + (p (apply + 'start-process (tramp-get-connection-name v) (tramp-get-connection-buffer v) - (mapconcat 'identity args " ")))) + tramp-smb-program args))) (tramp-message v 6 "%s" (mapconcat 'identity (process-command p) " ")) @@ -938,99 +938,100 @@ (setq filename (file-name-as-directory filename)) (setq filename (directory-file-name filename))) (with-parsed-tramp-file-name filename nil - (save-match-data - (let ((base (file-name-nondirectory filename)) - ;; We should not destroy the cache entry. - (entries (copy-sequence - (tramp-smb-get-file-entries - (file-name-directory filename))))) - - (when wildcard - (string-match "\\." base) - (setq base (replace-match "\\\\." nil nil base)) - (string-match "\\*" base) - (setq base (replace-match ".*" nil nil base)) - (string-match "\\?" base) - (setq base (replace-match ".?" nil nil base))) - - ;; Filter entries. - (setq entries - (delq - nil - (if (or wildcard (zerop (length base))) - ;; Check for matching entries. - (mapcar - (lambda (x) - (when (string-match - (format "^%s" base) (nth 0 x)) - x)) - entries) - ;; We just need the only and only entry FILENAME. - (list (assoc base entries))))) - - ;; Sort entries. - (setq entries - (sort - entries - (lambda (x y) - (if (string-match "t" switches) - ;; Sort by date. - (tramp-time-less-p (nth 3 y) (nth 3 x)) - ;; Sort by name. - (string-lessp (nth 0 x) (nth 0 y)))))) - - ;; Handle "-F" switch. - (when (string-match "F" switches) + (with-tramp-progress-reporter v 0 (format "Opening directory %s" filename) + (save-match-data + (let ((base (file-name-nondirectory filename)) + ;; We should not destroy the cache entry. + (entries (copy-sequence + (tramp-smb-get-file-entries + (file-name-directory filename))))) + + (when wildcard + (string-match "\\." base) + (setq base (replace-match "\\\\." nil nil base)) + (string-match "\\*" base) + (setq base (replace-match ".*" nil nil base)) + (string-match "\\?" base) + (setq base (replace-match ".?" nil nil base))) + + ;; Filter entries. + (setq entries + (delq + nil + (if (or wildcard (zerop (length base))) + ;; Check for matching entries. + (mapcar + (lambda (x) + (when (string-match + (format "^%s" base) (nth 0 x)) + x)) + entries) + ;; We just need the only and only entry FILENAME. + (list (assoc base entries))))) + + ;; Sort entries. + (setq entries + (sort + entries + (lambda (x y) + (if (string-match "t" switches) + ;; Sort by date. + (tramp-time-less-p (nth 3 y) (nth 3 x)) + ;; Sort by name. + (string-lessp (nth 0 x) (nth 0 y)))))) + + ;; Handle "-F" switch. + (when (string-match "F" switches) + (mapc + (lambda (x) + (when (not (zerop (length (car x)))) + (cond + ((char-equal ?d (string-to-char (nth 1 x))) + (setcar x (concat (car x) "/"))) + ((char-equal ?x (string-to-char (nth 1 x))) + (setcar x (concat (car x) "*")))))) + entries)) + + ;; Print entries. (mapc (lambda (x) - (when (not (zerop (length (car x)))) - (cond - ((char-equal ?d (string-to-char (nth 1 x))) - (setcar x (concat (car x) "/"))) - ((char-equal ?x (string-to-char (nth 1 x))) - (setcar x (concat (car x) "*")))))) - entries)) + (when (not (zerop (length (nth 0 x)))) + (when (string-match "l" switches) + (let ((attr + (when (tramp-smb-get-stat-capability v) + (ignore-errors + (file-attributes filename 'string))))) + (insert + (format + "%10s %3d %-8s %-8s %8s %s " + (or (nth 8 attr) (nth 1 x)) ; mode + (or (nth 1 attr) 1) ; inode + (or (nth 2 attr) "nobody") ; uid + (or (nth 3 attr) "nogroup") ; gid + (or (nth 7 attr) (nth 2 x)) ; size + (format-time-string + (if (tramp-time-less-p + (tramp-time-subtract (current-time) (nth 3 x)) + tramp-half-a-year) + "%b %e %R" + "%b %e %Y") + (nth 3 x)))))) ; date - ;; Print entries. - (mapc - (lambda (x) - (when (not (zerop (length (nth 0 x)))) - (when (string-match "l" switches) - (let ((attr - (when (tramp-smb-get-stat-capability v) - (ignore-errors - (file-attributes filename 'string))))) + ;; We mark the file name. The inserted name could be + ;; from somewhere else, so we use the relative file name + ;; of `default-directory'. + (let ((start (point))) (insert (format - "%10s %3d %-8s %-8s %8s %s " - (or (nth 8 attr) (nth 1 x)) ; mode - (or (nth 1 attr) 1) ; inode - (or (nth 2 attr) "nobody") ; uid - (or (nth 3 attr) "nogroup") ; gid - (or (nth 7 attr) (nth 2 x)) ; size - (format-time-string - (if (tramp-time-less-p - (tramp-time-subtract (current-time) (nth 3 x)) - tramp-half-a-year) - "%b %e %R" - "%b %e %Y") - (nth 3 x)))))) ; date - - ;; We mark the file name. The inserted name could be - ;; from somewhere else, so we use the relative file name - ;; of `default-directory'. - (let ((start (point))) - (insert - (format - "%s\n" - (file-relative-name - (expand-file-name - (nth 0 x) (file-name-directory filename)) - (when full-directory-p (file-name-directory filename))))) - (put-text-property start (1- (point)) 'dired-filename t)) - (forward-line) - (beginning-of-line))) - entries))))) + "%s\n" + (file-relative-name + (expand-file-name + (nth 0 x) (file-name-directory filename)) + (when full-directory-p (file-name-directory filename))))) + (put-text-property start (1- (point)) 'dired-filename t)) + (forward-line) + (beginning-of-line))) + entries)))))) (defun tramp-smb-handle-make-directory (dir &optional parents) "Like `make-directory' for Tramp files." @@ -1277,6 +1278,8 @@ ;; We must also flush the cache of the directory, because ;; `file-attributes' reads the values from there. + (tramp-flush-file-property v1 (file-name-directory v1-localname)) + (tramp-flush-file-property v1 v1-localname) (tramp-flush-file-property v2 (file-name-directory v2-localname)) (tramp-flush-file-property v2 v2-localname) (unless (tramp-smb-get-share v2) @@ -1349,7 +1352,7 @@ ;; Use an asynchronous processes. By this, password can ;; be handled. (let ((p (apply - 'start-process-shell-command + 'start-process (tramp-get-connection-name v) (tramp-get-connection-buffer v) tramp-smb-acl-program args))) === modified file 'lisp/net/tramp.el' --- lisp/net/tramp.el 2014-06-08 00:35:27 +0000 +++ lisp/net/tramp.el 2014-06-15 15:47:35 +0000 @@ -240,7 +240,7 @@ tamper the process output. * `tramp-copy-program' This specifies the name of the program to use for remotely copying - the file; this might be the absolute filename of rcp or the name of + the file; this might be the absolute filename of scp or the name of a workalike program. It is always applied on the local host. * `tramp-copy-args' This specifies the list of parameters to pass to the above mentioned @@ -248,6 +248,13 @@ * `tramp-copy-env' A list of environment variables and their values, which will be set when calling `tramp-copy-program'. + * `tramp-remote-copy-program' + The listener program to be applied on remote side, if needed. + * `tramp-remote-copy-args' + The list of parameters to pass to the listener program, the hints + for `tramp-login-args' also apply here. Additionally, \"%r\" could + be used here and in `tramp-copy-args'. It denotes a randomly + chosen port for the remote listener. * `tramp-copy-keep-date' This specifies whether the copying program when the preserves the timestamp of the original file. @@ -275,7 +282,7 @@ What does all this mean? Well, you should specify `tramp-login-program' for all methods; this program is used to log in to the remote site. Then, there are two ways to actually transfer the files between the local and the -remote side. One way is using an additional rcp-like program. If you want +remote side. One way is using an additional scp-like program. If you want to do this, set `tramp-copy-program' in the method. Another possibility for file transfer is inline transfer, i.e. the @@ -1762,7 +1769,7 @@ (and (memq system-type '(cygwin windows-nt)) (zerop (tramp-call-process - "reg" nil nil nil "query" (nth 1 (car v))))) + v "reg" nil nil nil "query" (nth 1 (car v))))) ;; Configuration file. (file-exists-p (nth 1 (car v))))) (setq r (delete (car v) r))) @@ -2816,7 +2823,7 @@ (if (memq system-type '(windows-nt)) (with-temp-buffer (when (zerop (tramp-call-process - "reg" nil t nil "query" registry-or-dirname)) + nil "reg" nil t nil "query" registry-or-dirname)) (goto-char (point-min)) (loop while (not (eobp)) collect (tramp-parse-putty-group registry-or-dirname)))) @@ -2895,7 +2902,7 @@ (defun tramp-handle-file-accessible-directory-p (filename) "Like `file-accessible-directory-p' for Tramp files." (and (file-directory-p filename) - (file-executable-p filename))) + (file-readable-p filename))) (defun tramp-handle-file-exists-p (filename) "Like `file-exists-p' for Tramp files." @@ -3906,7 +3913,7 @@ (tramp-get-file-property vec (tramp-file-name-localname vec) (concat "file-attributes-" suffix) nil) - (file-attributes + (tramp-compat-file-attributes (tramp-make-tramp-file-name (tramp-file-name-method vec) (tramp-file-name-user vec) @@ -4118,14 +4125,16 @@ ;;; Compatibility functions section: (defun tramp-call-process - (program &optional infile destination display &rest args) + (vec program &optional infile destination display &rest args) "Calls `call-process' on the local host. This is needed because for some Emacs flavors Tramp has defadvised `call-process' to behave like `process-file'. The Lisp error raised when PROGRAM is nil is trapped also, returning 1. Furthermore, traces are written with verbosity of 6." - (let ((v (vector tramp-current-method tramp-current-user tramp-current-host - nil nil)) + (let ((v (or vec + (vector tramp-current-method tramp-current-user + tramp-current-host nil nil))) + (destination (if (eq destination t) (current-buffer) destination)) result) (tramp-message v 6 "`%s %s' %s %s" === modified file 'lisp/net/trampver.el' --- lisp/net/trampver.el 2014-02-19 19:24:32 +0000 +++ lisp/net/trampver.el 2014-06-15 15:47:35 +0000 @@ -31,7 +31,7 @@ ;; should be changed only there. ;;;###tramp-autoload -(defconst tramp-version "2.2.9-24.4" +(defconst tramp-version "2.2.10" "This version of Tramp.") ;;;###tramp-autoload @@ -44,7 +44,7 @@ (= emacs-major-version 21) (>= emacs-minor-version 4))) "ok" - (format "Tramp 2.2.9-24.4 is not fit for %s" + (format "Tramp 2.2.10 is not fit for %s" (when (string-match "^.*$" (emacs-version)) (match-string 0 (emacs-version))))))) (unless (string-match "\\`ok\\'" x) (error "%s" x))) ------------------------------------------------------------ revno: 117341 committer: Michael Albinus branch nick: trunk timestamp: Sun 2014-06-15 17:09:22 +0200 message: Sync with Tramp 2.2.10. * doc/misc/tramp.texi (Inline methods): Remove restriction on "telnet". Recommend sharing ssh connections for "plink". (External methods): Remove "sftp". Merge "pscp" and "psftp" descriptions. Recommend sharing ssh connections. Add "nc" method. (GVFS based methods): Add "sftp". (Customizing Completion, External packages, Issues): Use @dots{}. * doc/misc/trampver.texi: Update release number. diff: === modified file 'doc/misc/ChangeLog' --- doc/misc/ChangeLog 2014-06-15 00:17:21 +0000 +++ doc/misc/ChangeLog 2014-06-15 15:09:22 +0000 @@ -1,3 +1,17 @@ +2014-06-15 Michael Albinus + + Sync with Tramp 2.2.10. + + * tramp.texi (Inline methods): Remove restriction on "telnet". + Recommend sharing ssh connections for "plink". + (External methods): Remove "sftp". Merge "pscp" and "psftp" + descriptions. Recommend sharing ssh connections. Add "nc" method. + (GVFS based methods): Add "sftp". + (Customizing Completion, External packages, Issues): + Use @dots{}. + + * trampver.texi: Update release number. + 2014-06-15 Glenn Morris * Makefile.in (bootstrap-clean): New. === modified file 'doc/misc/tramp.texi' --- doc/misc/tramp.texi 2014-06-10 02:20:31 +0000 +++ doc/misc/tramp.texi 2014-06-15 15:09:22 +0000 @@ -605,11 +605,10 @@ @cindex methods, inline The inline methods in @value{tramp} are quite powerful and can work in -situations where you cannot use an external transfer program to connect. -Inline methods are the only methods that work when connecting to the -remote host via telnet. (There are also strange inline methods which -allow you to transfer files between @emph{user identities} rather than -hosts, see below.) +situations where you cannot use an external transfer program to +connect. There are also strange inline methods which allow you to +transfer files between @emph{user identities} rather than hosts, see +below. These methods depend on the existence of a suitable encoding and decoding command on remote host. Locally, @value{tramp} may be able to @@ -748,7 +747,10 @@ implementation of SSH@. It uses @samp{plink -ssh} to log in to the remote host. -This supports the @samp{-P} argument. +With a recent PuTTY, it is recommended to check the @samp{Share SSH +connections if possible} control for that session. + +This method supports the @samp{-P} argument. @item @option{plinkx} @@ -757,9 +759,10 @@ Another method using PuTTY on Windows. Instead of host names, it expects PuTTY session names, calling @samp{plink -load @var{session} --t"}. User names are relevant only in case the corresponding session -hasn't defined a user name. Different port numbers must be defined in -the session. +-t}. User names and port numbers must be defined in the session. + +With a recent PuTTY, it is recommended to check the @samp{Share SSH +connections if possible} control for that session. @end table @@ -820,22 +823,6 @@ specify @samp{-P 42} in the argument list for @command{scp}. -@item @option{sftp}---@command{ssh} and @command{sftp} -@cindex method sftp -@cindex sftp method -@cindex sftp (with sftp method) -@cindex ssh (with sftp method) - -That is mostly the same method as @option{scp}, but using -@command{sftp} as transfer command. So the same remarks are valid. - -This command does not work like @value{ftppackagename}, where -@command{ftp} is called interactively, and all commands are send from -within this session. Instead of, @command{ssh} is used for login. - -This method supports the @samp{-p} argument. - - @item @option{rsync}---@command{ssh} and @command{rsync} @cindex method rsync @cindex rsync method @@ -881,33 +868,27 @@ @item @option{pscp}---@command{plink} and @command{pscp} +@item @option{psftp}---@command{plink} and @command{psftp} @cindex method pscp @cindex pscp method @cindex pscp (with pscp method) @cindex plink (with pscp method) @cindex PuTTY (with pscp method) - -This method is similar to @option{scp}, but it uses the -@command{plink} command to connect to the remote host, and it uses -@command{pscp} for transferring the files. These programs are part -of PuTTY, an SSH implementation for Windows. - -This method supports the @samp{-P} argument. - - -@item @option{psftp}---@command{plink} and @command{psftp} @cindex method psftp @cindex psftp method -@cindex psftp (with psftp method) +@cindex pscp (with psftp method) @cindex plink (with psftp method) @cindex PuTTY (with psftp method) -As you would expect, this method is similar to @option{sftp}, but it -uses the @command{plink} command to connect to the remote host, and it -uses @command{psftp} for transferring the files. These programs are -part of PuTTY, an SSH implementation for Windows. - -This method supports the @samp{-P} argument. +These methods are similar to @option{scp} or @option{sftp}, but they +use the @command{plink} command to connect to the remote host, and +they use @command{pscp} or @command{psftp} for transferring the files. +These programs are part of PuTTY, an SSH implementation for Windows. + +With a recent PuTTY, it is recommended to configure the @samp{Share +SSH connections if possible} control for that session. + +These methods support the @samp{-P} argument. @item @option{fcp}---@command{fsh} and @command{fcp} @@ -938,6 +919,19 @@ anyway. +@item @option{nc}---@command{telnet} and @command{nc} +@cindex method nc +@cindex nc method +@cindex nc (with nc method) +@cindex telnet (with nc method) + +Using @command{telnet} to connect to the remote host and @command{nc} +for file transfer is often the only possibility to access dumb +devices, like routers or NAS hosts. Those hosts have just a +restricted @command{busybox} as local shell, and there is no program +to encode and decode files for transfer. + + @item @option{ftp} @cindex method ftp @cindex ftp method @@ -1066,6 +1060,17 @@ phones. For the time being, @value{tramp} only supports OBEX over Bluetooth. +@item @option{sftp} +@cindex method sftp +@cindex sftp method + +As you might expect, this method uses @command{sftp} in order to +access the remote host. Contrary to the @option{ssh} and @option{scp} +methods, it doesn't open an @command{ssh} session for login. +Therefore, it could be used to access to remote hosts which refuse +@command{ssh} for security reasons. + + @item @option{synce} @cindex method synce @cindex synce method @@ -1077,10 +1082,10 @@ @end table @defopt tramp-gvfs-methods -This customer option, a list, defines the external methods which -shall be used with GVFS@. Per default, these are @option{dav}, -@option{davs}, @option{obex} and @option{synce}. Other possible -values are @option{ftp}, @option{sftp} and @option{smb}. +This customer option, a list, defines the external methods which shall +be used with GVFS@. Per default, these are @option{dav}, +@option{davs}, @option{obex}, @option{sftp} and @option{synce}. Other +possible values are @option{ftp} and @option{smb}. @end defopt @end ifset @@ -1503,7 +1508,7 @@ completion (@pxref{File name completion}). For every method, it keeps a set of configuration files, accompanied by a Lisp function able to parse that file. Entries in @code{tramp-completion-function-alist} -have the form (@var{method} @var{pair1} @var{pair2} ...). +have the form (@var{method} @var{pair1} @var{pair2} @dots{}). Each @var{pair} is composed of (@var{function} @var{file}). @var{function} is responsible to extract user names and host names @@ -3774,7 +3779,7 @@ @lisp (let ((non-essential t)) - ...) + @dots{}) @end lisp @@ -3793,7 +3798,7 @@ @lisp (let (process-file-side-effects) - ...) + @dots{}) @end lisp For asynchronous processes, @value{tramp} flushes the file attributes @@ -3934,7 +3939,7 @@ The autoload of the @value{emacsname} @value{tramp} package must be disabled. This can be achieved by setting file permissions @code{000} -to the files @file{.../xemacs-packages/lisp/tramp/auto-autoloads.el*}. +to the files @file{@dots{}/xemacs-packages/lisp/tramp/auto-autoloads.el*}. In case of unified file names, all @value{emacsname} download sites are added to @code{tramp-default-method-alist} with default method === modified file 'doc/misc/trampver.texi' --- doc/misc/trampver.texi 2014-02-19 19:31:02 +0000 +++ doc/misc/trampver.texi 2014-06-15 15:09:22 +0000 @@ -8,7 +8,7 @@ @c In the Tramp CVS, the version number is auto-frobbed from @c configure.ac, so you should edit that file and run @c "autoconf && ./configure" to change the version number. -@set trampver 2.2.9-24.4 +@set trampver 2.2.10 @c Other flags from configuration @set instprefix /usr/local ------------------------------------------------------------ revno: 117340 committer: Eli Barzilay branch nick: trunk timestamp: Sun 2014-06-15 00:52:34 -0400 message: * lisp/calculator.el: Lots of revisions - Kill the calculator buffer after electric mode too. - Make decimal mode have "," groups, so it's more fitting for use in money calculations. - Factorial works with non-integer inputs. - Swallow less errors. - Lots of other improvements, but no changes to custom variables, or other user visible changes (except the above). diff: === modified file 'lisp/calculator.el' --- lisp/calculator.el 2014-02-03 00:40:49 +0000 +++ lisp/calculator.el 2014-06-15 04:52:34 +0000 @@ -1,4 +1,4 @@ -;;; calculator.el --- a [not so] simple calculator for Emacs -*- lexical-binding: t -*- +;;; calculator.el --- a calculator for Emacs -*- lexical-binding: t -*- ;; Copyright (C) 1998, 2000-2014 Free Software Foundation, Inc. @@ -33,15 +33,8 @@ ;; "Run the Emacs calculator." t) ;; (global-set-key [(control return)] 'calculator) ;; -;; Written by Eli Barzilay: Maze is Life! eli@barzilay.org -;; http://www.barzilay.org/ -;; -;; For latest version, check -;; http://www.barzilay.org/misc/calculator.el -;; - -;;; History: -;; I hate history. +;; Written by Eli Barzilay, eli@barzilay.org +;; ;;;===================================================================== ;;; Customization: @@ -79,7 +72,7 @@ (defcustom calculator-prompt "Calc=%s> " "The prompt used by the Emacs calculator. -It should contain a \"%s\" somewhere that will indicate the i/o radices; +It should contain a \"%s\" somewhere that will indicate the i/o radixes; this will be a two-character string as described in the documentation for `calculator-mode'." :type 'string @@ -115,8 +108,8 @@ (defcustom calculator-remove-zeros t "Non-nil value means delete all redundant zero decimal digits. -If this value is not t, and not nil, redundant zeros are removed except -for one and if it is nil, nothing is removed. +If this value is not t and not nil, redundant zeros are removed except +for one. Used by the `calculator-remove-zeros' function." :type '(choice (const t) (const leave-decimal) (const nil)) :group 'calculator) @@ -136,23 +129,27 @@ associated with the displayer function (for example to change the number of digits displayed). -An exception to the above is the case of the list (std C) where C is a -character, in this case the `calculator-standard-displayer' function -will be used with this character for a format string." - :type '(choice (function) (string) (list (const std) character) (sexp)) +An exception to the above is the case of the list (std C [G]) where C is +a character and G is an optional boolean, in this case the +`calculator-standard-displayer' function will be used with these as +arguments." + :type '(choice (function) (string) (sexp) + (list (const std) character) + (list (const std) character boolean)) :group 'calculator) (defcustom calculator-displayers '(((std ?n) "Standard display, decimal point or scientific") (calculator-eng-display "Eng display") - ((std ?f) "Standard display, decimal point") + ((std ?f t) "Standard display, decimal point with grouping") ((std ?e) "Standard display, scientific") ("%S" "Emacs printer")) "A list of displayers. Each element is a list of a displayer and a description string. The -first element is the one which is currently used, this is for the display -of result values not values in expressions. A displayer specification -is the same as the values that can be stored in `calculator-displayer'. +first element is the one which is currently used, this is for the +display of result values not values in expressions. A displayer +specification is the same as the values that can be stored in +`calculator-displayer'. `calculator-rotate-displayer' rotates this list." :type 'sexp @@ -182,7 +179,7 @@ (defcustom calculator-mode-hook nil "List of hook functions for `calculator-mode' to run. Note: if `calculator-electric-mode' is on, then this hook will get -activated in the minibuffer - in that case it should not do much more +activated in the minibuffer -- in that case it should not do much more than local key settings and other effects that will change things outside the scope of calculator related code." :type 'hook @@ -224,15 +221,14 @@ (\"tF\" mt-to-ft (/ X 0.3048) 1) (\"tM\" ft-to-mt (* X 0.3048) 1))) -* Using a function-like form is very simple, X for an argument (Y the - second in case of a binary operator), TX is a truncated version of X - and F does a recursive call, Here is a [very inefficient] Fibonacci - number calculation: +* Using a function-like form is very simple: use `X' for the argument + (`Y' for the second in case of a binary operator), `TX' is a truncated + version of `X' and `F' for a recursive call. Here is a [very + inefficient] Fibonacci number calculation: (add-to-list 'calculator-user-operators - '(\"F\" fib (if (<= TX 1) - 1 - (+ (F (- TX 1)) (F (- TX 2)))) 0)) + '(\"F\" fib + (if (<= TX 1) 1 (+ (F (- TX 1)) (F (- TX 2)))))) Note that this will be either postfix or prefix, according to `calculator-unary-style'." @@ -248,7 +244,7 @@ ;;; Variables (defvar calculator-initial-operators - '(;; "+"/"-" have keybindings of themselves, not calculator-ops + '(;; "+"/"-" have keybindings of their own, not calculator-ops ("=" = identity 1 -1) (nobind "+" + + 2 4) (nobind "-" - - 2 4) @@ -303,26 +299,27 @@ versions), `DX' (converted to radians if degrees mode is on), `D' (function for converting radians to degrees if deg mode is on), `L' (list of saved values), `F' (function for recursive iteration calls) - and evaluates to the function value - these variables are capital; + and evaluates to the function value -- these variables are capital; 4. The function's arity, optional, one of: 2 => binary, -1 => prefix - unary, +1 => postfix unary, 0 => a 0-arg operator func, non-number => - postfix/prefix as determined by `calculator-unary-style' (the - default); + unary, +1 => postfix unary, 0 => a 0-arg operator func (note that + using such a function replaces the currently entered number, if any), + non-number (the default) => postfix or prefix as determined by + `calculator-unary-style'; -5. The function's precedence - should be in the range of 1 (lowest) to +5. The function's precedence -- should be in the range of 1 (lowest) to 9 (highest) (optional, defaults to 1); It it possible have a unary prefix version of a binary operator if it comes later in this list. If the list begins with the symbol 'nobind, -then no key binding will take place - this is only useful for predefined +then no key binding will take place -- this is only useful for predefined keys. Use `calculator-user-operators' to add operators to this list, see its documentation for an example.") (defvar calculator-stack nil - "Stack contents - operations and operands.") + "Stack contents -- operations and operands.") (defvar calculator-curnum nil "Current number being entered (as a string).") @@ -427,9 +424,9 @@ (calculator-backspace [backspace]) ))) (while p - ;; reverse the keys so first defs come last - makes the more - ;; sensible bindings visible in the menu - (let ((func (car (car p))) (keys (reverse (cdr (car p))))) + ;; reverse the keys so earlier definitions come last -- makes + ;; the more sensible bindings visible in the menu + (let ((func (caar p)) (keys (reverse (cdar p)))) (while keys (define-key map (car keys) func) (setq keys (cdr keys)))) @@ -441,7 +438,7 @@ ;; make C-h work in text-mode (or window-system (define-key map [?\C-h] 'calculator-backspace)) ;; set up a menu - (if (and calculator-use-menu (not (boundp 'calculator-menu))) + (when (and calculator-use-menu (not (boundp 'calculator-menu))) (let ((radix-selectors (mapcar (lambda (x) `([,(nth 0 x) @@ -580,7 +577,7 @@ "A [not so] simple calculator for Emacs. This calculator is used in the same way as other popular calculators -like xcalc or calc.exe - but using an Emacs interface. +like xcalc or calc.exe -- but using an Emacs interface. Expressions are entered using normal infix notation, parens are used as normal. Unary functions are usually postfix, but some depends on the @@ -589,8 +586,7 @@ `+' and `-' can be used as either binary operators or prefix unary operators. Numbers can be entered with exponential notation using `e', except when using a non-decimal radix mode for input (in this case `e' -will be the hexadecimal digit). If the result of a calculation is too -large (out of range for Emacs), the value of \"inf\" is returned. +will be the hexadecimal digit). Here are the editing keys: * `RET' `=' evaluate the current expression @@ -609,8 +605,8 @@ * `_' `;' postfix unary negation and reciprocal * `^' `L' binary operators for x^y and log(x) in base y * `Q' `!' unary square root and factorial -* `S' `C' `T' unary trigonometric operators - sin, cos and tan -* `|' `#' `&' `~' bitwise operators - or, xor, and, not +* `S' `C' `T' unary trigonometric operators: sin, cos and tan +* `|' `#' `&' `~' bitwise operators: or, xor, and, not The trigonometric functions can be inverted if prefixed with an `I', see below for the way to use degrees instead of the default radians. @@ -636,9 +632,9 @@ Also, the quote key can be used to switch display modes for decimal numbers (double-quote rotates back), and the two brace characters -\(\"{\" and \"}\" change display parameters that these displayers use (if -they handle such). If output is using any radix mode, then these keys -toggle digit grouping mode and the chunk size. +\(\"{\" and \"}\" change display parameters that these displayers use, +if they handle such). If output is using any radix mode, then these +keys toggle digit grouping mode and the chunk size. Values can be saved for future reference in either a list of saved values, or in registers. @@ -680,19 +676,21 @@ "Run the Emacs calculator. See the documentation for `calculator-mode' for more information." (interactive) - (if calculator-restart-other-mode + (when calculator-restart-other-mode (setq calculator-electric-mode (not calculator-electric-mode))) - (if calculator-initial-operators - (progn (calculator-add-operators calculator-initial-operators) - (setq calculator-initial-operators nil) - ;; don't change this since it is a customization variable, - ;; its set function will add any new operators - (calculator-add-operators calculator-user-operators))) + (when calculator-initial-operators + (calculator-add-operators calculator-initial-operators) + (setq calculator-initial-operators nil) + ;; don't change this since it is a customization variable, + ;; its set function will add any new operators + (calculator-add-operators calculator-user-operators)) (setq calculator-buffer (get-buffer-create "*calculator*")) (if calculator-electric-mode (save-window-excursion - (progn (require 'electric) (message nil)) ; hide load message - (let (old-g-map old-l-map (echo-keystrokes 0) + (require 'electric) (message nil) ; hide load message + (let (old-g-map old-l-map + (old-buf (window-buffer (minibuffer-window))) + (echo-keystrokes 0) (garbage-collection-messages nil)) ; no gc msg when electric (set-window-buffer (minibuffer-window) calculator-buffer) (select-window (minibuffer-window)) @@ -712,8 +710,8 @@ (lambda () 'noprompt) nil (lambda (_x _y) (calculator-update-display)))) - (and calculator-buffer - (catch 'calculator-done (calculator-quit))) + (set-window-buffer (minibuffer-window) old-buf) + (kill-buffer calculator-buffer) (use-local-map old-l-map) (use-global-map old-g-map)))) (progn @@ -722,45 +720,8 @@ (let ((window-min-height 2)) ;; maybe leave two lines for our window because of the ;; normal `raised' mode line - (select-window - (split-window-below - ;; If the mode line might interfere with the calculator - ;; buffer, use 3 lines instead. - (if (and (fboundp 'face-attr-construct) - (let* ((dh (plist-get (face-attr-construct 'default) :height)) - (mf (face-attr-construct 'mode-line)) - (mh (plist-get mf :height))) - ;; If the mode line is shorter than the default, - ;; stick with 2 lines. (It may be necessary to - ;; check how much shorter.) - (and - (not - (or (and (integerp dh) - (integerp mh) - (< mh dh)) - (and (numberp mh) - (not (integerp mh)) - (< mh 1)))) - (or - ;; If the mode line is taller than the default, - ;; use 3 lines. - (and (integerp dh) - (integerp mh) - (> mh dh)) - (and (numberp mh) - (not (integerp mh)) - (> mh 1)) - ;; If the mode line has a box with non-negative line-width, - ;; use 3 lines. - (let* ((bx (plist-get mf :box)) - (lh (plist-get bx :line-width))) - (and bx - (or - (not lh) - (> lh 0)))) - ;; If the mode line has an overline, use 3 lines. - (plist-get (face-attr-construct 'mode-line) :overline))))) - -3 -2))) + (select-window (split-window-below + (if (calculator-need-3-lines) -3 -2))) (switch-to-buffer calculator-buffer))) ((not (eq (current-buffer) calculator-buffer)) (select-window (get-buffer-window calculator-buffer)))) @@ -768,24 +729,46 @@ (setq buffer-read-only t) (calculator-reset) (message "Hit `?' For a quick help screen."))) - (if (and calculator-restart-other-mode calculator-electric-mode) + (when (and calculator-restart-other-mode calculator-electric-mode) (calculator))) +(defun calculator-need-3-lines () + ;; If the mode line might interfere with the calculator buffer, use 3 + ;; lines instead. + (let* ((dh (face-attribute 'default :height)) + (mh (face-attribute 'mode-line :height))) + ;; if the mode line is shorter than the default, stick with 2 lines + ;; (it may be necessary to check how much shorter) + (and (not (or (and (integerp dh) (integerp mh) (< mh dh)) + (and (numberp mh) (not (integerp mh)) (< mh 1)))) + (or ;; if the mode line is taller than the default, use 3 lines + (and (integerp dh) (integerp mh) (> mh dh)) + (and (numberp mh) (not (integerp mh)) (> mh 1)) + ;; if the mode line has a box with non-negative line-width, + ;; use 3 lines + (let* ((bx (face-attribute 'mode-line :box)) + (lh (plist-get bx :line-width))) + (and bx (or (not lh) (> lh 0)))) + ;; if the mode line has an overline, use 3 lines + (not (memq (face-attribute 'mode-line :overline) + '(nil unspecified))))))) + (defun calculator-message (string &rest arguments) - "Same as `message', but special handle of electric mode." + "Same as `message', but also handle electric mode." (apply 'message string arguments) - (if calculator-electric-mode - (progn (sit-for 1) (message nil)))) + (when calculator-electric-mode (sit-for 1) (message nil))) ;;;--------------------------------------------------------------------- ;;; Operators (defun calculator-op-arity (op) - "Return OP's arity, 2, +1 or -1." - (let ((arity (or (nth 3 op) 'x))) - (if (numberp arity) - arity - (if (eq calculator-unary-style 'postfix) +1 -1)))) + "Return OP's arity. +Current results are one of 2 (binary), +1 (postfix), -1 (prefix), or +0 (nullary)." + (let ((arity (nth 3 op))) + (cond ((numberp arity) arity) + ((eq calculator-unary-style 'postfix) +1) + (t -1)))) (defun calculator-op-prec (op) "Return OP's precedence for reducing when inserting into the stack. @@ -798,8 +781,8 @@ `calculator-initial-operators' and `calculator-user-operators'." (let ((added-ops nil)) (while more-ops - (or (eq (car (car more-ops)) 'nobind) - (let ((i -1) (key (car (car more-ops)))) + (or (eq (caar more-ops) 'nobind) + (let ((i -1) (key (caar more-ops))) ;; make sure the key is undefined, so it's easy to define ;; prefix keys (while (< (setq i (1+ i)) (length key)) @@ -811,8 +794,8 @@ calculator-mode-map (substring key 0 (1+ i)) nil) (setq i (length key))))) (define-key calculator-mode-map key 'calculator-op))) - (setq added-ops (cons (if (eq (car (car more-ops)) 'nobind) - (cdr (car more-ops)) + (setq added-ops (cons (if (eq (caar more-ops) 'nobind) + (cdar more-ops) (car more-ops)) added-ops)) (setq more-ops (cdr more-ops))) @@ -833,50 +816,37 @@ (setq calculator-restart-other-mode nil) (calculator-update-display)) -(defun calculator-get-prompt () +(defun calculator-get-display () "Return a string to display. -The string is set not to exceed the screen width." - (let* ((calculator-prompt - (format calculator-prompt +The result should not exceed the screen width." + (let* ((in-r (and calculator-input-radix + (char-to-string + (car (rassq calculator-input-radix + calculator-char-radix))))) + (out-r (and calculator-output-radix + (char-to-string + (car (rassq calculator-output-radix + calculator-char-radix))))) + (prompt (format calculator-prompt + (cond ((or in-r out-r) + (concat (or in-r "=") + (if (equal in-r out-r) "=" + (or out-r "=")))) + (calculator-deg "D=") + (t "==")))) + (expr + (concat (cdr calculator-stack-display) (cond - ((or calculator-output-radix calculator-input-radix) - (if (eq calculator-output-radix - calculator-input-radix) - (concat - (char-to-string - (car (rassq calculator-output-radix - calculator-char-radix))) - "=") - (concat - (if calculator-input-radix - (char-to-string - (car (rassq calculator-input-radix - calculator-char-radix))) - "=") - (char-to-string - (car (rassq calculator-output-radix - calculator-char-radix)))))) - (calculator-deg "D=") - (t "==")))) - (prompt - (concat calculator-prompt - (cdr calculator-stack-display) - (cond (calculator-curnum - ;; number being typed - (concat calculator-curnum "_")) - ((and (= 1 (length calculator-stack)) - calculator-display-fragile) - ;; only the result is shown, next number will - ;; restart - nil) - (t - ;; waiting for a number or an operator - "?")))) - (trim (- (length prompt) (1- (window-width))))) - (if (<= trim 0) - prompt - (concat calculator-prompt - (substring prompt (+ trim (length calculator-prompt))))))) + ;; entering a number + (calculator-curnum (concat calculator-curnum "_")) + ;; showing a result + ((and (= 1 (length calculator-stack)) + calculator-display-fragile) + nil) + ;; waiting for a number or an operator + (t "?")))) + (trim (+ (length expr) (length prompt) 1 (- (window-width))))) + (concat prompt (if (<= trim 0) expr (substring expr trim))))) (defun calculator-string-to-number (str) "Convert the given STR to a number, according to the value of @@ -902,7 +872,7 @@ "Warning: Ignoring bad input character `%c'." ch) (sit-for 1) value)))) - (if (if (< new-value 0) (> value 0) (< value 0)) + (when (if (< new-value 0) (> value 0) (< value 0)) (calculator-message "Warning: Overflow in input.")) (setq value new-value)) value) @@ -916,9 +886,12 @@ ((stringp str) (concat str ".0")) (t "0.0")))))) -(defun calculator-curnum-value () - "Get the numeric value of the displayed number string as a float." - (calculator-string-to-number calculator-curnum)) +(defun calculator-push-curnum () + "Push the numeric value of the displayed number to the stack." + (when calculator-curnum + (push (calculator-string-to-number calculator-curnum) + calculator-stack) + (setq calculator-curnum nil))) (defun calculator-rotate-displayer (&optional new-disp) "Switch to the next displayer on the `calculator-displayers' list. @@ -956,7 +929,7 @@ (calculator-rotate-displayer (car (last calculator-displayers)))) (defun calculator-displayer-prev () - "Send the current displayer function a 'left argument. + "Send the current displayer function a `left' argument. This is used to modify display arguments (if the current displayer function supports this). If radix output mode is active, increase the grouping size." @@ -967,13 +940,12 @@ (calculator-enter)) (and (car calculator-displayers) (let ((disp (caar calculator-displayers))) - (cond - ((symbolp disp) (funcall disp 'left)) - ((and (consp disp) (eq 'std (car disp))) - (calculator-standard-displayer 'left (cadr disp)))))))) + (cond ((symbolp disp) (funcall disp 'left)) + ((and (consp disp) (eq 'std (car disp))) + (calculator-standard-displayer 'left))))))) (defun calculator-displayer-next () - "Send the current displayer function a 'right argument. + "Send the current displayer function a `right' argument. This is used to modify display arguments (if the current displayer function supports this). If radix output mode is active, decrease the grouping size." @@ -984,44 +956,51 @@ (calculator-enter)) (and (car calculator-displayers) (let ((disp (caar calculator-displayers))) - (cond - ((symbolp disp) (funcall disp 'right)) - ((and (consp disp) (eq 'std (car disp))) - (calculator-standard-displayer 'right (cadr disp)))))))) + (cond ((symbolp disp) (funcall disp 'right)) + ((and (consp disp) (eq 'std (car disp))) + (calculator-standard-displayer 'right))))))) (defun calculator-remove-zeros (numstr) "Get a number string NUMSTR and remove unnecessary zeros. The behavior of this function is controlled by `calculator-remove-zeros'." - (cond ((and (eq calculator-remove-zeros t) - (string-match "\\.0+\\([eE][+-]?[0-9]*\\)?$" numstr)) - ;; remove all redundant zeros leaving an integer - (if (match-beginning 1) - (concat (substring numstr 0 (match-beginning 0)) - (match-string 1 numstr)) - (substring numstr 0 (match-beginning 0)))) - ((and calculator-remove-zeros - (string-match - "\\..\\([0-9]*[1-9]\\)?\\(0+\\)\\([eE][+-]?[0-9]*\\)?$" - numstr)) - ;; remove zeros, except for first after the "." - (if (match-beginning 3) - (concat (substring numstr 0 (match-beginning 2)) - (match-string 3 numstr)) - (substring numstr 0 (match-beginning 2)))) - (t numstr))) - -(defun calculator-standard-displayer (num char) + (let* ((s (if (not (eq calculator-remove-zeros t)) numstr + ;; remove all redundant zeros leaving an integer + (replace-regexp-in-string + "\\.0+\\([eE].*\\)?$" "\\1" numstr))) + (s (if (not calculator-remove-zeros) s + ;; remove zeros, except for first after the "." + (replace-regexp-in-string + "\\(\\..[0-9]*?\\)0+\\([eE].*\\)?$" "\\1\\2" s)))) + s)) + +(defun calculator-groupize-number (str n sep &optional fromleft) + "Return the input string STR with occurrences of SEP that separate +every N characters starting from the right, or from the left if +FROMLEFT is true." + (let* ((len (length str)) (i (/ len n)) (j (% len n)) + (r (if (or (not fromleft) (= j 0)) '() + (list (substring str (- len j)))))) + (while (> i 0) + (let* ((e (* i n)) (e (if fromleft e (+ e j)))) + (push (substring str (- e n) e) r)) + (setq i (1- i))) + (when (and (not fromleft) (> j 0)) + (push (substring str 0 j) r)) + (mapconcat 'identity r sep))) + +(defun calculator-standard-displayer (num &optional char group-p) "Standard display function, used to display NUM. Its behavior is determined by `calculator-number-digits' and the given CHAR argument (both will be used to compose a format string). If the char is \"n\" then this function will choose one between %f or %e, this is a work around %g jumping to exponential notation too fast. -The special 'left and 'right symbols will make it change the current -number of digits displayed (`calculator-number-digits'). +It will also split digit sequences into comma-separated groups +and/or remove redundant zeros. -It will also remove redundant zeros from the result." +The special `left' and `right' symbols will make it change the current +number of digits displayed (`calculator-number-digits')." (if (symbolp num) (cond ((eq num 'left) (and (> calculator-number-digits 0) @@ -1032,56 +1011,50 @@ (setq calculator-number-digits (1+ calculator-number-digits)) (calculator-enter))) - (let ((str (if (zerop num) - "0" - (format - (concat "%." - (number-to-string calculator-number-digits) - (if (eq char ?n) - (let ((n (abs num))) - (if (or (< n 0.001) (> n 1e8)) "e" "f")) - (string char))) - num)))) - (calculator-remove-zeros str)))) + (let* ((s (if (eq char ?n) + (let ((n (abs num))) + (if (or (and (< 0 n) (< n 0.001)) (< 1e8 n)) ?e ?f)) + char)) + (s (format "%%.%s%c" calculator-number-digits s)) + (s (calculator-remove-zeros (format s num))) + (s (if (or (not group-p) (string-match-p "[eE]" s)) s + (replace-regexp-in-string + "\\([0-9]+\\)\\(?:\\.\\|$\\)" + (lambda (s) (calculator-groupize-number s 3 ",")) + s nil nil 1)))) + s))) (defun calculator-eng-display (num) "Display NUM in engineering notation. The number of decimal digits used is controlled by `calculator-number-digits', so to change it at runtime you have to use -the 'left or 'right when one of the standard modes is used." +the `left' or `right' when one of the standard modes is used." (if (symbolp num) (cond ((eq num 'left) (setq calculator-eng-extra - (if calculator-eng-extra - (1+ calculator-eng-extra) - 1)) + (if calculator-eng-extra (1+ calculator-eng-extra) 1)) (let ((calculator-eng-tmp-show t)) (calculator-enter))) ((eq num 'right) (setq calculator-eng-extra - (if calculator-eng-extra - (1- calculator-eng-extra) - -1)) + (if calculator-eng-extra (1- calculator-eng-extra) -1)) (let ((calculator-eng-tmp-show t)) (calculator-enter)))) (let ((exp 0)) - (and (not (= 0 num)) - (progn - (while (< (abs num) 1.0) - (setq num (* num 1000.0)) (setq exp (- exp 3))) - (while (> (abs num) 999.0) - (setq num (/ num 1000.0)) (setq exp (+ exp 3))) - (and calculator-eng-tmp-show - (not (= 0 calculator-eng-extra)) - (let ((i calculator-eng-extra)) - (while (> i 0) - (setq num (* num 1000.0)) (setq exp (- exp 3)) - (setq i (1- i))) - (while (< i 0) - (setq num (/ num 1000.0)) (setq exp (+ exp 3)) - (setq i (1+ i))))))) + (unless (= 0 num) + (while (< (abs num) 1.0) + (setq num (* num 1000.0)) (setq exp (- exp 3))) + (while (> (abs num) 999.0) + (setq num (/ num 1000.0)) (setq exp (+ exp 3))) + (when (and calculator-eng-tmp-show + (not (= 0 calculator-eng-extra))) + (let ((i calculator-eng-extra)) + (while (> i 0) + (setq num (* num 1000.0)) (setq exp (- exp 3)) + (setq i (1- i))) + (while (< i 0) + (setq num (/ num 1000.0)) (setq exp (+ exp 3)) + (setq i (1+ i)))))) (or calculator-eng-tmp-show (setq calculator-eng-extra nil)) - (let ((str (format (concat "%." (number-to-string - calculator-number-digits) - "f") + (let ((str (format (format "%%.%sf" calculator-number-digits) num))) (concat (let ((calculator-remove-zeros ;; make sure we don't leave integers @@ -1092,56 +1065,48 @@ (defun calculator-number-to-string (num) "Convert NUM to a displayable string." (cond - ((and (numberp num) calculator-output-radix) - ;; print with radix - for binary I convert the octal number - (let ((str (format (if (eq calculator-output-radix 'hex) "%x" "%o") - (calculator-truncate - (if calculator-2s-complement num (abs num)))))) - (if (eq calculator-output-radix 'bin) - (let ((i -1) (s "")) - (while (< (setq i (1+ i)) (length str)) - (setq s - (concat s - (cdr (assq (aref str i) - '((?0 . "000") (?1 . "001") - (?2 . "010") (?3 . "011") - (?4 . "100") (?5 . "101") - (?6 . "110") (?7 . "111"))))))) - (string-match "^0*\\(.+\\)" s) - (setq str (match-string 1 s)))) - (if calculator-radix-grouping-mode - (let ((d (/ (length str) calculator-radix-grouping-digits)) - (r (% (length str) calculator-radix-grouping-digits))) - (while (>= (setq d (1- d)) (if (zerop r) 1 0)) - (let ((i (+ r (* d calculator-radix-grouping-digits)))) - (setq str (concat (substring str 0 i) - calculator-radix-grouping-separator - (substring str i))))))) - (upcase - (if (and (not calculator-2s-complement) (< num 0)) - (concat "-" str) - str)))) - ((and (numberp num) calculator-displayer) - (cond - ((stringp calculator-displayer) - (format calculator-displayer num)) - ((symbolp calculator-displayer) - (funcall calculator-displayer num)) - ((eq 'std (car-safe calculator-displayer)) - (calculator-standard-displayer num (cadr calculator-displayer))) - ((listp calculator-displayer) - (eval calculator-displayer `((num. ,num)))) - (t (prin1-to-string num t)))) - ;; operators are printed here - (t (prin1-to-string (nth 1 num) t)))) + ;; operators are printed here, the rest is for numbers + ((not (numberp num)) (prin1-to-string (nth 1 num) t)) + ;; %f/%e handle these, but avoid them in radix or in user displayers + ((and (floatp num) (isnan num)) "NaN") + ((<= 1.0e+INF num) "Inf") + ((<= num -1.0e+INF) "-Inf") + (calculator-output-radix + ;; print with radix -- for binary, convert the octal number + (let* ((fmt (if (eq calculator-output-radix 'hex) "%x" "%o")) + (str (if calculator-2s-complement num (abs num))) + (str (format fmt (calculator-truncate str))) + (bins '((?0 "000") (?1 "001") (?2 "010") (?3 "011") + (?4 "100") (?5 "101") (?6 "110") (?7 "111"))) + (str (if (not (eq calculator-output-radix 'bin)) str + (replace-regexp-in-string + "^0+\\(.\\)" "\\1" + (apply 'concat (mapcar (lambda (c) + (cadr (assq c bins))) + str))))) + (str (if (not calculator-radix-grouping-mode) str + (calculator-groupize-number + str calculator-radix-grouping-digits + calculator-radix-grouping-separator)))) + (upcase (if (or calculator-2s-complement (>= num 0)) str + (concat "-" str))))) + ((stringp calculator-displayer) (format calculator-displayer num)) + ((symbolp calculator-displayer) (funcall calculator-displayer num)) + ((eq 'std (car-safe calculator-displayer)) + (apply 'calculator-standard-displayer + num (cdr calculator-displayer))) + ((listp calculator-displayer) + (eval `(let ((num ',num)) ,calculator-displayer) t)) + ;; nil (or bad) displayer + (t (prin1-to-string num t)))) (defun calculator-update-display (&optional force) "Update the display. If optional argument FORCE is non-nil, don't use the cached string." (set-buffer calculator-buffer) ;; update calculator-stack-display - (if (or force - (not (eq (car calculator-stack-display) calculator-stack))) + (when (or force (not (eq (car calculator-stack-display) + calculator-stack))) (setq calculator-stack-display (cons calculator-stack (if calculator-stack @@ -1170,165 +1135,97 @@ "")))) (let ((inhibit-read-only t)) (erase-buffer) - (insert (calculator-get-prompt))) + (insert (calculator-get-display))) (set-buffer-modified-p nil) - (if calculator-display-fragile - (goto-char (1+ (length calculator-prompt))) - (goto-char (1- (point))))) + (goto-char (if calculator-display-fragile + (1+ (length calculator-prompt)) + (1- (point))))) ;;;--------------------------------------------------------------------- ;;; Stack computations +(defun calculator-reduce-stack-once (prec) + "Worker for `calculator-reduce-stack'." + (cl-flet ((check (ar op) (and (listp op) + (<= prec (calculator-op-prec op)) + (= ar (calculator-op-arity op)))) + (call (op &rest args) (apply 'calculator-funcall + (nth 2 op) args))) + (pcase calculator-stack + ;; reduce "... ( x )" --> "... x" + (`((,_ \) . ,_) ,(and X (pred numberp)) (,_ \( . ,_) . ,rest) + (cons X rest)) + ;; reduce "... x op y" --> "... r", r is the result + (`(,(and Y (pred numberp)) + ,(and O (pred (check 2))) + ,(and X (pred numberp)) + . ,rest) + (cons (call O X Y) rest)) + ;; reduce "... op x" --> "... r" for prefix op + (`(,(and X (pred numberp)) ,(and O (pred (check -1))) . ,rest) + (cons (call O X) rest)) + ;; reduce "... x op" --> "... r" for postfix op + (`(,(and O (pred (check +1))) ,(and X (pred numberp)) . ,rest) + (cons (call O X) rest)) + ;; reduce "... op" --> "... r" for 0-ary op + (`(,(and O (pred (check 0))) . ,rest) + (cons (call O) rest)) + ;; reduce "... y x" --> "... x" + ;; (needed for 0-ary ops: replace current number with result) + (`(,(and X (pred numberp)) ,(and _Y (pred numberp)) . ,rest) + (cons X rest)) + (_ nil)))) ; nil = done + (defun calculator-reduce-stack (prec) - "Reduce the stack using top operator. -PREC is a precedence - reduce everything with higher precedence." - (while - (cond - ((and (cdr (cdr calculator-stack)) ; have three values - (consp (nth 0 calculator-stack)) ; two operators & num - (numberp (nth 1 calculator-stack)) - (consp (nth 2 calculator-stack)) - (eq '\) (nth 1 (nth 0 calculator-stack))) - (eq '\( (nth 1 (nth 2 calculator-stack)))) - ;; reduce "... ( x )" --> "... x" - (setq calculator-stack - (cons (nth 1 calculator-stack) - (nthcdr 3 calculator-stack))) - ;; another iteration - t) - ((and (cdr (cdr calculator-stack)) ; have three values - (numberp (nth 0 calculator-stack)) ; two nums & operator - (consp (nth 1 calculator-stack)) - (numberp (nth 2 calculator-stack)) - (= 2 (calculator-op-arity ; binary operator - (nth 1 calculator-stack))) - (<= prec ; with higher prec. - (calculator-op-prec (nth 1 calculator-stack)))) - ;; reduce "... x op y" --> "... r", r is the result - (setq calculator-stack - (cons (calculator-funcall - (nth 2 (nth 1 calculator-stack)) - (nth 2 calculator-stack) - (nth 0 calculator-stack)) - (nthcdr 3 calculator-stack))) - ;; another iteration - t) - ((and (>= (length calculator-stack) 2) ; have two values - (numberp (nth 0 calculator-stack)) ; number & operator - (consp (nth 1 calculator-stack)) - (= -1 (calculator-op-arity ; prefix-unary op - (nth 1 calculator-stack))) - (<= prec ; with higher prec. - (calculator-op-prec (nth 1 calculator-stack)))) - ;; reduce "... op x" --> "... r" for prefix op - (setq calculator-stack - (cons (calculator-funcall - (nth 2 (nth 1 calculator-stack)) - (nth 0 calculator-stack)) - (nthcdr 2 calculator-stack))) - ;; another iteration - t) - ((and (cdr calculator-stack) ; have two values - (consp (nth 0 calculator-stack)) ; operator & number - (numberp (nth 1 calculator-stack)) - (= +1 (calculator-op-arity ; postfix-unary op - (nth 0 calculator-stack))) - (<= prec ; with higher prec. - (calculator-op-prec (nth 0 calculator-stack)))) - ;; reduce "... x op" --> "... r" for postfix op - (setq calculator-stack - (cons (calculator-funcall - (nth 2 (nth 0 calculator-stack)) - (nth 1 calculator-stack)) - (nthcdr 2 calculator-stack))) - ;; another iteration - t) - ((and calculator-stack ; have one value - (consp (nth 0 calculator-stack)) ; an operator - (= 0 (calculator-op-arity ; 0-ary op - (nth 0 calculator-stack)))) - ;; reduce "... op" --> "... r" for 0-ary op - (setq calculator-stack - (cons (calculator-funcall - (nth 2 (nth 0 calculator-stack))) - (nthcdr 1 calculator-stack))) - ;; another iteration - t) - ((and (cdr calculator-stack) ; have two values - (numberp (nth 0 calculator-stack)) ; both numbers - (numberp (nth 1 calculator-stack))) - ;; get rid of redundant numbers: - ;; reduce "... y x" --> "... x" - ;; needed for 0-ary ops that puts more values - (setcdr calculator-stack (cdr (cdr calculator-stack)))) - (t ;; no more iterations - nil)))) + "Reduce the stack using top operators as long as possible. +PREC is a precedence -- reduce everything with higher precedence." + (let ((new nil)) + (while (setq new (calculator-reduce-stack-once prec)) + (setq calculator-stack new)))) (defun calculator-funcall (f &optional X Y) "If F is a symbol, evaluate (F X Y). Otherwise, it should be a list, evaluate it with X, Y bound to the arguments." ;; remember binary ops for calculator-repR/L - (if Y (setq calculator-last-opXY (list f X Y))) - (condition-case nil - ;; there used to be code here that returns 0 if the result was - ;; smaller than calculator-epsilon (1e-15). I don't think this is - ;; necessary now. - (if (symbolp f) - (cond ((and X Y) (funcall f X Y)) - (X (funcall f X)) - (t (funcall f))) - ;; f is an expression - (let* ((TX (calculator-truncate X)) - (TY (and Y (calculator-truncate Y))) - (DX (if calculator-deg (/ (* X pi) 180) X)) - (L calculator-saved-list)) - (cl-letf (((symbol-function 'F) - (lambda (&optional x y) (calculator-funcall f x y))) - ((symbol-function 'D) - (lambda (x) (if calculator-deg (/ (* x 180) float-pi) x)))) - (eval f `((X . ,X) - (Y . ,Y) - (TX . ,TX) - (TY . ,TY) - (DX . ,DX) - (L . ,L)))))) - (error 0))) + (when Y (setq calculator-last-opXY (list f X Y))) + (if (symbolp f) + (cond ((and X Y) (funcall f X Y)) + (X (funcall f X)) + (t (funcall f))) + ;; f is an expression + (let ((TX (and X (calculator-truncate X))) + (TY (and Y (calculator-truncate Y))) + (DX (if (and X calculator-deg) (/ (* X pi) 180) X)) + (L calculator-saved-list)) + (cl-flet ((F (&optional x y) (calculator-funcall f x y)) + (D (x) (if calculator-deg (/ (* x 180) float-pi) x))) + (eval `(let ((X ,X) (Y ,Y) (DX ,DX) (TX ,TX) (TY ,TY) (L ',L)) + ,f) + t))))) ;;;--------------------------------------------------------------------- ;;; Input interaction (defun calculator-last-input (&optional keys) "Last char (or event or event sequence) that was read. -Optional string argument KEYS will force using it as the keys entered." +Use KEYS if given, otherwise use `this-command-keys'." (let ((inp (or keys (this-command-keys)))) (if (or (stringp inp) (not (arrayp inp))) inp - ;; this translates kp-x to x and [tries to] create a string to - ;; lookup operators - (let* ((i -1) (converted-str (make-string (length inp) ? )) k) - ;; converts an array to a string the ops lookup with keypad - ;; input - (while (< (setq i (1+ i)) (length inp)) - (setq k (aref inp i)) - ;; if Emacs will someday have a event-key, then this would - ;; probably be modified anyway - (and (if (fboundp 'key-press-event-p) (key-press-event-p k)) - (if (fboundp 'event-key) - (and (event-key k) (setq k (event-key k))))) - ;; assume all symbols are translatable with an ascii-character - (and (symbolp k) - (setq k (or (get k 'ascii-character) ? ))) - (aset converted-str i k)) - converted-str)))) + ;; translates kp-x to x and [tries to] create a string to lookup + ;; operators; assume all symbols are translatable via + ;; `function-key-map' or with an 'ascii-character property + (concat (mapcar (lambda (k) + (if (numberp k) k (or (get k 'ascii-character) + (error "??bad key??")))) + (or (lookup-key function-key-map inp) inp)))))) (defun calculator-clear-fragile (&optional op) "Clear the fragile flag if it was set, then maybe reset all. OP is the operator (if any) that caused this call." - (if (and calculator-display-fragile - (or (not op) - (= -1 (calculator-op-arity op)) - (= 0 (calculator-op-arity op)))) + (when (and calculator-display-fragile + (or (not op) (memq (calculator-op-arity op) '(-1 0)))) ;; reset if last calc finished, and now get a num or prefix or 0-ary ;; op (calculator-reset)) @@ -1338,53 +1235,44 @@ "Enter a single digit." (interactive) (let ((inp (aref (calculator-last-input) 0))) - (if (and (or calculator-display-fragile - (not (numberp (car calculator-stack)))) - (cond - ((not calculator-input-radix) (<= inp ?9)) - ((eq calculator-input-radix 'bin) (<= inp ?1)) - ((eq calculator-input-radix 'oct) (<= inp ?7)) - (t t))) - ;; enter digit if starting a new computation or have an op on the - ;; stack - (progn - (calculator-clear-fragile) - (let ((digit (upcase (char-to-string inp)))) - (if (equal calculator-curnum "0") - (setq calculator-curnum nil)) - (setq calculator-curnum - (concat (or calculator-curnum "") digit))) - (calculator-update-display))))) + (when (and (or calculator-display-fragile + (not (numberp (car calculator-stack)))) + (<= inp (pcase calculator-input-radix + (`nil ?9) (`bin ?1) (`oct ?7) (_ 999)))) + (calculator-clear-fragile) + (setq calculator-curnum + (concat (if (equal calculator-curnum "0") "" + calculator-curnum) + (list (upcase inp)))) + (calculator-update-display)))) (defun calculator-decimal () "Enter a decimal period." (interactive) - (if (and (not calculator-input-radix) - (or calculator-display-fragile - (not (numberp (car calculator-stack)))) - (not (and calculator-curnum - (string-match-p "[.eE]" calculator-curnum)))) + (when (and (not calculator-input-radix) + (or calculator-display-fragile + (not (numberp (car calculator-stack)))) + (not (and calculator-curnum + (string-match-p "[.eE]" calculator-curnum)))) ;; enter the period on the same condition as a digit, only if no ;; period or exponent entered yet - (progn - (calculator-clear-fragile) - (setq calculator-curnum (concat (or calculator-curnum "0") ".")) - (calculator-update-display)))) + (calculator-clear-fragile) + (setq calculator-curnum (concat (or calculator-curnum "0") ".")) + (calculator-update-display))) (defun calculator-exp () "Enter an `E' exponent character, or a digit in hex input mode." (interactive) - (if calculator-input-radix - (calculator-digit) - (if (and (or calculator-display-fragile - (not (numberp (car calculator-stack)))) - (not (and calculator-curnum - (string-match-p "[eE]" calculator-curnum)))) - ;; same condition as above, also no E so far - (progn - (calculator-clear-fragile) - (setq calculator-curnum (concat (or calculator-curnum "1") "e")) - (calculator-update-display))))) + (cond + (calculator-input-radix (calculator-digit)) + ((and (or calculator-display-fragile + (not (numberp (car calculator-stack)))) + (not (and calculator-curnum + (string-match-p "[eE]" calculator-curnum)))) + ;; same condition as above, also no E so far + (calculator-clear-fragile) + (setq calculator-curnum (concat (or calculator-curnum "1") "e")) + (calculator-update-display)))) (defun calculator-op (&optional keys) "Enter an operator on the stack, doing all necessary reductions. @@ -1394,42 +1282,29 @@ (let* ((last-inp (calculator-last-input keys)) (op (assoc last-inp calculator-operators))) (calculator-clear-fragile op) - (if (and calculator-curnum (/= (calculator-op-arity op) 0)) - (setq calculator-stack - (cons (calculator-curnum-value) calculator-stack))) - (setq calculator-curnum nil) - (if (and (= 2 (calculator-op-arity op)) - (not (and calculator-stack - (numberp (nth 0 calculator-stack))))) - ;; we have a binary operator but no number - search for a prefix - ;; version - (let ((rest-ops calculator-operators)) - (while (not (equal last-inp (car (car rest-ops)))) - (setq rest-ops (cdr rest-ops))) - (setq op (assoc last-inp (cdr rest-ops))) - (if (not (and op (= -1 (calculator-op-arity op)))) - ;;(error "Binary operator without a first operand") - (progn - (calculator-message - "Binary operator without a first operand") - (throw 'op-error nil))))) + (calculator-push-curnum) + (when (and (= 2 (calculator-op-arity op)) + (not (numberp (car calculator-stack)))) + ;; we have a binary operator but no number -- search for a + ;; prefix version + (setq op (assoc last-inp (cdr (memq op calculator-operators)))) + (unless (and op (= -1 (calculator-op-arity op))) + (calculator-message "Binary operator without a first operand") + (throw 'op-error nil))) (calculator-reduce-stack (cond ((eq (nth 1 op) '\() 10) ((eq (nth 1 op) '\)) 0) (t (calculator-op-prec op)))) - (if (or (and (= -1 (calculator-op-arity op)) - (numberp (car calculator-stack))) - (and (/= (calculator-op-arity op) -1) - (/= (calculator-op-arity op) 0) - (not (numberp (car calculator-stack))))) - ;;(error "Unterminated expression") - (progn - (calculator-message "Unterminated expression") - (throw 'op-error nil))) - (setq calculator-stack (cons op calculator-stack)) + (when (let ((hasnum (numberp (car calculator-stack)))) + (pcase (calculator-op-arity op) + (-1 hasnum) + ((or 1 2) (not hasnum)))) + (calculator-message "Incomplete expression") + (throw 'op-error nil)) + (push op calculator-stack) (calculator-reduce-stack (calculator-op-prec op)) (and (= (length calculator-stack) 1) - (numberp (nth 0 calculator-stack)) + (numberp (car calculator-stack)) ;; the display is fragile if it contains only one number (setq calculator-display-fragile t) ;; add number to the saved-list @@ -1445,7 +1320,8 @@ (defun calculator-op-or-exp () "Either enter an operator or a digit. Used with +/- for entering them as digits in numbers like 1e-3 (there is -no need for negative numbers since these are handled by unary operators)." +no need for negative numbers since these are handled by unary +operators)." (interactive) (if (and (not calculator-display-fragile) calculator-curnum @@ -1459,14 +1335,11 @@ (defun calculator-dec/deg-mode () "Set decimal mode for display & input, if decimal, toggle deg mode." (interactive) - (if calculator-curnum - (setq calculator-stack - (cons (calculator-curnum-value) calculator-stack))) - (setq calculator-curnum nil) + (calculator-push-curnum) (if (or calculator-input-radix calculator-output-radix) (progn (setq calculator-input-radix nil) (setq calculator-output-radix nil)) - ;; already decimal - toggle degrees mode + ;; already decimal -- toggle degrees mode (setq calculator-deg (not calculator-deg))) (calculator-update-display t)) @@ -1481,10 +1354,7 @@ "Set input radix modes. Optional string argument KEYS will force using it as the keys entered." (interactive) - (if calculator-curnum - (setq calculator-stack - (cons (calculator-curnum-value) calculator-stack))) - (setq calculator-curnum nil) + (calculator-push-curnum) (setq calculator-input-radix (let ((inp (calculator-last-input keys))) (cdr (assq (upcase (aref inp (1- (length inp)))) @@ -1495,10 +1365,7 @@ "Set display radix modes. Optional string argument KEYS will force using it as the keys entered." (interactive) - (if calculator-curnum - (setq calculator-stack - (cons (calculator-curnum-value) calculator-stack))) - (setq calculator-curnum nil) + (calculator-push-curnum) (setq calculator-output-radix (let ((inp (calculator-last-input keys))) (cdr (assq (upcase (aref inp (1- (length inp)))) @@ -1524,19 +1391,18 @@ (defun calculator-saved-move (n) "Go N elements up the list of saved values." (interactive) - (and calculator-saved-list - (or (null calculator-stack) calculator-display-fragile) - (progn - (setq calculator-saved-ptr - (max (min (+ n calculator-saved-ptr) - (length calculator-saved-list)) - 0)) - (if (nth calculator-saved-ptr calculator-saved-list) - (setq calculator-stack - (list (nth calculator-saved-ptr calculator-saved-list)) - calculator-display-fragile t) - (calculator-reset)) - (calculator-update-display)))) + (when (and calculator-saved-list + (or (null calculator-stack) calculator-display-fragile)) + (setq calculator-saved-ptr + (max (min (+ n calculator-saved-ptr) + (length calculator-saved-list)) + 0)) + (if (nth calculator-saved-ptr calculator-saved-list) + (setq calculator-stack (list (nth calculator-saved-ptr + calculator-saved-list)) + calculator-display-fragile t) + (calculator-reset)) + (calculator-update-display))) (defun calculator-saved-up () "Go up the list of saved values." @@ -1583,7 +1449,7 @@ (interactive) (setq calculator-curnum nil) (cond - ;; if the current number is from the saved-list - remove it + ;; if the current number is from the saved-list remove it ((and calculator-display-fragile calculator-saved-list (= (car calculator-stack) @@ -1592,7 +1458,7 @@ (setq calculator-saved-list (cdr calculator-saved-list)) (let ((p (nthcdr (1- calculator-saved-ptr) calculator-saved-list))) - (setcdr p (cdr (cdr p))) + (setcdr p (cddr p)) (setq calculator-saved-ptr (1- calculator-saved-ptr)))) (if calculator-saved-list (setq calculator-stack @@ -1613,15 +1479,16 @@ (calculator-enter) ;; remove trailing spaces and an index (let ((s (cdr calculator-stack-display))) - (and s - (if (string-match "^\\([^ ]+\\) *\\(\\[[0-9/]+\\]\\)? *$" s) - (setq s (match-string 1 s))) - (kill-new s))))) + (when s + (kill-new (replace-regexp-in-string + "^\\([^ ]+\\) *\\(\\[[0-9/]+\\]\\)? *$" "\\1" s)))))) -;; FIXME this should use register-read-with-preview, but it -;; uses calculator-registers rather than register-alist. (defun calculator-set-register (reg) "Set a register value for REG." + ;; FIXME: this should use `register-read-with-preview', but it uses + ;; calculator-registers rather than `register-alist'. (Maybe + ;; dynamically rebinding it will get blessed?) Also in to + ;; `calculator-get-register'. (interactive "cRegister to store into: ") (let* ((as (assq reg calculator-registers)) (val (progn (calculator-enter) (car calculator-stack)))) @@ -1634,15 +1501,14 @@ (defun calculator-put-value (val) "Paste VAL as if entered. Used by `calculator-paste' and `get-register'." - (if (and (numberp val) - ;; (not calculator-curnum) - (or calculator-display-fragile - (not (numberp (car calculator-stack))))) - (progn - (calculator-clear-fragile) - (setq calculator-curnum (let ((calculator-displayer "%S")) - (calculator-number-to-string val))) - (calculator-update-display)))) + (when (and (numberp val) + ;; (not calculator-curnum) + (or calculator-display-fragile + (not (numberp (car calculator-stack))))) + (calculator-clear-fragile) + (setq calculator-curnum (let ((calculator-displayer "%S")) + (calculator-number-to-string val))) + (calculator-update-display))) (defun calculator-paste () "Paste a value from the `kill-ring'." @@ -1662,8 +1528,6 @@ (or (match-string 3 str) "")))) (ignore-errors (calculator-string-to-number str))))) -;; FIXME this should use register-read-with-preview, but it -;; uses calculator-registers rather than register-alist. (defun calculator-get-register (reg) "Get a value from a register REG." (interactive "cRegister to get value from: ") @@ -1696,16 +1560,13 @@ (g-map (current-global-map)) (win (selected-window))) (require 'ehelp) - (if calculator-electric-mode + (when calculator-electric-mode (use-global-map calculator-saved-global-map)) - (if (or (not calculator-electric-mode) - ;; XEmacs has a problem with electric-describe-mode - (featurep 'xemacs)) - (describe-mode) - (electric-describe-mode)) (if calculator-electric-mode - (use-global-map g-map)) - (select-window win) ; these are for XEmacs (also below) + (electric-describe-mode) + (describe-mode)) + (when calculator-electric-mode (use-global-map g-map)) + (select-window win) (message nil)) (let ((one (one-window-p t)) (win (selected-window)) @@ -1713,12 +1574,11 @@ (save-window-excursion (with-output-to-temp-buffer "*Help*" (princ (documentation 'calculator-help))) - (if one - (shrink-window-if-larger-than-buffer - (get-buffer-window help-buf))) - (message - "`%s' again for more help, any other key continues normally." - (calculator-last-input)) + (when one (shrink-window-if-larger-than-buffer + (get-buffer-window help-buf))) + (message "`%s' again for more help, %s." + (calculator-last-input) + "any other key continues normally") (select-window win) (sit-for 360)) (select-window win)))) @@ -1731,11 +1591,12 @@ (unless calculator-electric-mode (ignore-errors (while (get-buffer-window calculator-buffer) - (delete-window (get-buffer-window calculator-buffer)))) - (kill-buffer calculator-buffer)) - (setq calculator-buffer nil) + (delete-window (get-buffer-window calculator-buffer))))) + (kill-buffer calculator-buffer) (message "Calculator done.") - (if calculator-electric-mode (throw 'calculator-done nil))) + (if calculator-electric-mode + (throw 'calculator-done nil) ; will kill the buffer + (setq calculator-buffer nil))) (defun calculator-save-and-quit () "Quit the calculator, saving the result on the `kill-ring'." @@ -1764,58 +1625,47 @@ (car calculator-last-opXY) (nth 1 calculator-last-opXY) x)) x)) -(defun calculator-integer-p (x) - "Non-nil if X is equal to an integer." - (ignore-errors (= x (ftruncate x)))) - (defun calculator-expt (x y) "Compute X^Y, dealing with errors appropriately." (condition-case nil (expt x y) (domain-error 0.0e+NaN) (range-error - (cond - ((and (< x 1.0) (> x -1.0)) - ;; For small x, the range error comes from large y. - 0.0) - ((and (> x 0.0) (< y 0.0)) - ;; For large positive x and negative y, the range error - ;; comes from large negative y. - 0.0) - ((and (> x 0.0) (> y 0.0)) - ;; For large positive x and positive y, the range error - ;; comes from large y. - 1.0e+INF) - ;; For the rest, x must be large and negative. - ;; The range errors come from large integer y. - ((< y 0.0) - 0.0) - ((eq (logand (truncate y) 1) 1) ; expansion of cl `oddp' - ;; If y is odd - -1.0e+INF) - (t - ;; - 1.0e+INF))) + (cond ((and (< x 1.0) (> x -1.0)) + ;; For small x, the range error comes from large y. + 0.0) + ((and (> x 0.0) (< y 0.0)) + ;; For large positive x and negative y, the range error + ;; comes from large negative y. + 0.0) + ((and (> x 0.0) (> y 0.0)) + ;; For large positive x and positive y, the range error + ;; comes from large y. + 1.0e+INF) + ;; For the rest, x must be large and negative. + ;; The range errors come from large integer y. + ((< y 0.0) + 0.0) + ((eq (logand (truncate y) 1) 1) ; expansion of cl `oddp' + ;; If y is odd + -1.0e+INF) + (t + ;; + 1.0e+INF))) (error 0.0e+NaN))) (defun calculator-fact (x) "Simple factorial of X." - (if (and (>= x 0) - (calculator-integer-p x)) - (if (= (calculator-expt (/ x 3.0) x) 1.0e+INF) - 1.0e+INF - (let ((r (if (<= x 10) 1 1.0))) - (while (> x 0) - (setq r (* r (truncate x))) - (setq x (1- x))) - (+ 0.0 r))) - (if (= x 1.0e+INF) - x - 0.0e+NaN))) + (cond ((>= x 1.0e+INF) x) + ((or (and (floatp x) (isnan x)) (< x 0)) 0.0e+NaN) + ((>= (calculator-expt (/ x 3.0) x) 1.0e+INF) 1.0e+INF) + (t (let ((x (truncate x)) (r 1.0)) + (while (> x 0) (setq r (* r x) x (1- x))) + r)))) (defun calculator-truncate (n) "Truncate N, return 0 in case of overflow." - (condition-case nil (truncate n) (error 0))) + (condition-case nil (truncate n) (range-error 0))) (provide 'calculator) ------------------------------------------------------------ revno: 117339 committer: Stefan Monnier branch nick: trunk timestamp: Sun 2014-06-15 00:10:40 -0400 message: * lisp/ses.el: Miscellaneous cleanups; use lexical-binding; avoid add-to-list. (ses-localvars): Remove ses--local-printer-list, unused. (ses--metaprogramming): New macro. Use it to defvar variables. (ses-set-localvars): Simplify. (ses--locprn, ses-cell): Use defstruct. Change ses-cell's property-list into an alist. (ses-locprn-get-compiled, ses-locprn-compiled-aset) (ses-locprn-get-def, ses-locprn-def-aset, ses-locprn-get-number): Remove; use defstruct accessors/setters instead. (ses-cell-formula-aset, ses-cell-printer-aset) (ses-cell-references-aset): Remove, use setf instead. (ses--alist-get): New function. (ses-cell-property): Rename from ses-cell-property-get and rewrite. Use an alist instead of a plist and don't do move-to-front since the list is always short. (ses-cell-property-get-fun, ses-cell-property-delq-fun) (ses-cell-property-set-fun, ses-cell-property-set) (ses-cell-property-pop-fun, ses-cell-property-get-handle) (ses-cell-property-handle-car, ses-cell-property-handle-setcar): Remove. (ses--letref): New macro. (ses-cell-property-pop): Rewrite. (ses--cell): Rename from ses-cell and make it into a function. Make `formula' fallback on `value' if nil. (ses--local-printer): Rename from ses-local-printer and make it into a function. (ses-set-cell): Turn it into a macro so finding the accessor from the field name is done at compile time. (ses-repair-cell-reference-all): Test presence of `sym' rather than `ref' before adding `sym' to :ses-repair-reference. (ses-calculate-cell): Use ses--letref rather than ses-cell-property-get-handle. (ses-write-cells): Use a single prin1-to-string. (ses-setter-with-undo): New function. (ses-aset-with-undo, ses-set-with-undo): Rewrite using it. (ses-unset-with-undo): Remove. (ses-load): Prefer apply' over `eval'. (ses-read-printer, ses-set-column-width): Use standard "(default foo)" format. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-06-15 00:34:22 +0000 +++ lisp/ChangeLog 2014-06-15 04:10:40 +0000 @@ -1,3 +1,45 @@ +2014-06-15 Stefan Monnier + + * ses.el: Miscellaneous cleanups; use lexical-binding; avoid + add-to-list. + (ses-localvars): Remove ses--local-printer-list, unused. + (ses--metaprogramming): New macro. Use it to defvar variables. + (ses-set-localvars): Simplify. + (ses--locprn, ses-cell): Use defstruct. Change ses-cell's + property-list into an alist. + (ses-locprn-get-compiled, ses-locprn-compiled-aset) + (ses-locprn-get-def, ses-locprn-def-aset, ses-locprn-get-number): + Remove; use defstruct accessors/setters instead. + (ses-cell-formula-aset, ses-cell-printer-aset) + (ses-cell-references-aset): Remove, use setf instead. + (ses--alist-get): New function. + (ses-cell-property): Rename from ses-cell-property-get and rewrite. + Use an alist instead of a plist and don't do move-to-front since the + list is always short. + (ses-cell-property-get-fun, ses-cell-property-delq-fun) + (ses-cell-property-set-fun, ses-cell-property-set) + (ses-cell-property-pop-fun, ses-cell-property-get-handle) + (ses-cell-property-handle-car, ses-cell-property-handle-setcar): Remove. + (ses--letref): New macro. + (ses-cell-property-pop): Rewrite. + (ses--cell): Rename from ses-cell and make it into a function. + Make `formula' fallback on `value' if nil. + (ses--local-printer): Rename from ses-local-printer and make it into + a function. + (ses-set-cell): Turn it into a macro so finding the accessor from the + field name is done at compile time. + (ses-repair-cell-reference-all): Test presence of `sym' rather than + `ref' before adding `sym' to :ses-repair-reference. + (ses-calculate-cell): Use ses--letref rather than + ses-cell-property-get-handle. + (ses-write-cells): Use a single prin1-to-string. + (ses-setter-with-undo): New function. + (ses-aset-with-undo, ses-set-with-undo): Rewrite using it. + (ses-unset-with-undo): Remove. + (ses-load): Prefer apply' over `eval'. + (ses-read-printer, ses-set-column-width): Use standard "(default + foo)" format. + 2014-06-15 Glenn Morris * Makefile.in (leim, semantic): Use `make -C' rather than `cd && make'. === modified file 'lisp/ses.el' --- lisp/ses.el 2014-06-12 06:04:48 +0000 +++ lisp/ses.el 2014-06-15 04:10:40 +0000 @@ -1,4 +1,4 @@ -;;; ses.el -- Simple Emacs Spreadsheet -*- coding: utf-8 -*- +;;; ses.el -- Simple Emacs Spreadsheet -*- lexical-binding:t -*- ;; Copyright (C) 2002-2014 Free Software Foundation, Inc. @@ -282,10 +282,6 @@ ses--col-widths ses--curcell ses--curcell-overlay ses--default-printer (ses--local-printer-hashmap . :hashmap) - ;; the list is there to remember the order of local printers like there - ;; are written to the SES filen which service the hashmap does not - ;; provide. - ses--local-printer-list (ses--numlocprn . 0); count of local printers ses--deferred-narrow ses--deferred-recalc ses--deferred-write ses--file-format @@ -300,8 +296,12 @@ ses--renamed-cell-symb-list ;; Global variables that we override mode-line-process next-line-add-newlines transient-mark-mode) - "Buffer-local variables used by SES.") + "Buffer-local variables used by SES.")) +(defmacro ses--metaprogramming (exp) (declare (debug t)) (eval exp t)) +(ses--metaprogramming + `(progn ,@(mapcar (lambda (x) `(defvar ,(or (car-safe x) x))) ses-localvars))) + (defun ses-set-localvars () "Set buffer-local and initialize some SES variables." (dolist (x ses-localvars) @@ -313,20 +313,10 @@ ((integerp (cdr x)) (set (make-local-variable (car x)) (cdr x))) ((eq (cdr x) :hashmap) - (set (make-local-variable (car x)) - (if (boundp (car x)) - (let ((xv (symbol-value (car x)))) - (if (hash-table-p xv) - (clrhash xv) - (warn "Unexpected value of symbol %S, should be a hash table" x) - (make-hash-table :test 'eq))) - (make-hash-table :test 'eq)))) + (set (make-local-variable (car x)) (make-hash-table :test 'eq))) (t (error "Unexpected initializer `%S' in list `ses-localvars' for entry %S" (cdr x) (car x)) ) )) - (t (error "Unexpected elements `%S' in list `ses-localvars'" x)))))) - -(eval-when-compile ; silence compiler - (ses-set-localvars)) + (t (error "Unexpected elements `%S' in list `ses-localvars'" x))))) ;;; This variable is documented as being permitted in file-locals: (put 'ses--symbolic-formulas 'safe-local-variable 'consp) @@ -381,186 +371,115 @@ (defmacro ses-get-cell (row col) "Return the cell structure that stores information about cell (ROW,COL)." + (declare (debug t)) `(aref (aref ses--cells ,row) ,col)) -;; We might want to use defstruct here, but cells are explicitly used as -;; arrays in ses-set-cell, so we'd need to fix this first. --Stef -(defsubst ses-make-cell (&optional symbol formula printer references - property-list) - (vector symbol formula printer references property-list)) - -(defsubst ses-make-local-printer-info (def &optional compiled-def number) - (let ((v (vector def - (or compiled-def (ses-local-printer-compile def)) - (or number ses--numlocprn) - nil))) - (push v ses--local-printer-list) - (aset v 3 ses--local-printer-list) - v)) - -(defmacro ses-locprn-get-compiled (locprn) - `(aref ,locprn 1)) - -(defmacro ses-locprn-compiled-aset (locprn compiled) - `(aset ,locprn 1 ,compiled)) - -(defmacro ses-locprn-get-def (locprn) - `(aref ,locprn 0)) - -(defmacro ses-locprn-def-aset (locprn def) - `(aset ,locprn 0 ,def)) - -(defmacro ses-locprn-get-number (locprn) - `(aref ,locprn 2)) +(cl-defstruct (ses-cell + (:constructor nil) + (:constructor ses-make-cell + (&optional symbol formula printer references)) + (:copier nil) + ;; This is treated as an 4-elem array in various places. + ;; Mostly in ses-set-cell. + (:type vector) ;Not named. + (:conc-name ses-cell--)) + symbol formula printer references properties) + +(cl-defstruct (ses--locprn + (:constructor) + (:constructor ses-make-local-printer-info + (def &optional (compiled (ses-local-printer-compile def)) + (number ses--numlocprn)))) + def + compiled + number + local-printer-list) (defmacro ses-cell-symbol (row &optional col) "From a CELL or a pair (ROW,COL), get the symbol that names the local-variable holding its value. (0,0) => A1." - `(aref ,(if col `(ses-get-cell ,row ,col) row) 0)) + (declare (debug t)) + `(ses-cell--symbol ,(if col `(ses-get-cell ,row ,col) row))) (put 'ses-cell-symbol 'safe-function t) (defmacro ses-cell-formula (row &optional col) "From a CELL or a pair (ROW,COL), get the function that computes its value." - `(aref ,(if col `(ses-get-cell ,row ,col) row) 1)) - -(defmacro ses-cell-formula-aset (cell formula) - "From a CELL set the function that computes its value." - `(aset ,cell 1 ,formula)) + (declare (debug t)) + `(ses-cell--formula ,(if col `(ses-get-cell ,row ,col) row))) (defmacro ses-cell-printer (row &optional col) "From a CELL or a pair (ROW,COL), get the function that prints its value." - `(aref ,(if col `(ses-get-cell ,row ,col) row) 2)) - -(defmacro ses-cell-printer-aset (cell printer) - "From a CELL set the printer that prints its value." - `(aset ,cell 2 ,printer)) + (declare (debug t)) + `(ses-cell--printer ,(if col `(ses-get-cell ,row ,col) row))) (defmacro ses-cell-references (row &optional col) "From a CELL or a pair (ROW,COL), get the list of symbols for cells whose functions refer to its value." - `(aref ,(if col `(ses-get-cell ,row ,col) row) 3)) - -(defmacro ses-cell-references-aset (cell references) - "From a CELL set the list REFERENCES of symbols for cells the -function of which refer to its value." - `(aset ,cell 3 ,references)) + (declare (debug t)) + `(ses-cell--references ,(if col `(ses-get-cell ,row ,col) row))) (defun ses-cell-p (cell) - "Return non `nil' is CELL is a cell of current buffer." + "Return non-nil if CELL is a cell of current buffer." (and (vectorp cell) (= (length cell) 5) (eq cell (let ((rowcol (ses-sym-rowcol (ses-cell-symbol cell)))) (and (consp rowcol) (ses-get-cell (car rowcol) (cdr rowcol))))))) -(defun ses-cell-property-get-fun (property-name cell) - ;; To speed up property fetching, each time a property is found it is placed - ;; in the first position. This way, after the first get, the full property - ;; list needs to be scanned only when the property does not exist for that - ;; cell. - (let* ((plist (aref cell 4)) - (ret (plist-member plist property-name))) - (if ret - ;; Property was found. - (let ((val (cadr ret))) - (if (eq ret plist) - ;; Property found is already in the first position, so just return - ;; its value. - val - ;; Property is not in the first position, the following will move it - ;; there before returning its value. - (let ((next (cddr ret))) - (if next - (progn - (setcdr ret (cdr next)) - (setcar ret (car next))) - (setcdr (last plist 1) nil))) - (aset cell 4 - `(,property-name ,val ,@plist)) - val))))) - -(defmacro ses-cell-property-get (property-name row &optional col) - "Get property named PROPERTY-NAME from a CELL or a pair (ROW,COL). + +(defun ses--alist-get (key alist &optional remove) + "Get the value associated to KEY in ALIST." + (declare + (gv-expander + (lambda (do) + (macroexp-let2 macroexp-copyable-p k key + (gv-letplace (getter setter) alist + (macroexp-let2 nil p `(assq ,k ,getter) + (funcall do `(cdr ,p) + (lambda (v) + (let ((set-exp + `(if ,p (setcdr ,p ,v) + ,(funcall setter + `(cons (setq ,p (cons ,k ,v)) + ,getter))))) + (cond + ((null remove) set-exp) + ((null v) + `(if ,p ,(funcall setter `(delq ,p ,getter)))) + (t + `(cond + (,v ,set-exp) + (,p ,(funcall setter + `(delq ,p ,getter))))))))))))))) + (ignore remove) ;;Silence byte-compiler. + (cdr (assoc key alist))) + +(defmacro ses--letref (vars place &rest body) + (declare (indent 2) (debug (sexp form &rest body))) + (gv-letplace (getter setter) place + `(cl-macrolet ((,(nth 0 vars) () ',getter) + (,(nth 1 vars) (v) (funcall ,setter v))) + ,@body))) + +(defmacro ses-cell-property (property-name row &optional col) + "Get property named PROPERTY-NAME from a CELL or a pair (ROW,COL). When COL is omitted, CELL=ROW is a cell object. When COL is present ROW and COL are the integer coordinates of the cell of interest." - (declare (debug t)) - `(ses-cell-property-get-fun - ,property-name - ,(if col `(ses-get-cell ,row ,col) row))) - -(defun ses-cell-property-delq-fun (property-name cell) - (let ((ret (plist-get (aref cell 4) property-name))) - (if ret - (setcdr ret (cddr ret))))) - -(defun ses-cell-property-set-fun (property-name property-val cell) - (let* ((plist (aref cell 4)) - (ret (plist-member plist property-name))) - (if ret - (setcar (cdr ret) property-val) - (aset cell 4 `(,property-name ,property-val ,@plist))))) - -(defmacro ses-cell-property-set (property-name property-value row &optional col) - "From a CELL or a pair (ROW,COL), set the property value of -the corresponding cell with name PROPERTY-NAME to PROPERTY-VALUE." - (if property-value - `(ses-cell-property-set-fun ,property-name ,property-value - ,(if col `(ses-get-cell ,row ,col) row)) - `(ses-cell-property-delq-fun ,property-name - ,(if col `(ses-get-cell ,row ,col) row)))) - -(defun ses-cell-property-pop-fun (property-name cell) - (let* ((plist (aref cell 4)) - (ret (plist-member plist property-name))) - (if ret - (prog1 (cadr ret) - (let ((next (cddr ret))) - (if next - (progn - (setcdr ret (cdr next)) - (setcar ret (car next))) - (if (eq plist ret) - (aset cell 4 nil) - (setcdr (last plist 2) nil)))))))) - + (declare (debug t)) + `(ses--alist-get ,property-name + (ses-cell--properties + ,(if col `(ses-get-cell ,row ,col) row)))) (defmacro ses-cell-property-pop (property-name row &optional col) - "From a CELL or a pair (ROW,COL), get and remove the property value of + "From a CELL or a pair (ROW,COL), get and remove the property value of the corresponding cell with name PROPERTY-NAME." - `(ses-cell-property-pop-fun ,property-name - ,(if col `(ses-get-cell ,row ,col) row))) - -(defun ses-cell-property-get-handle-fun (property-name cell) - (let* ((plist (aref cell 4)) - (ret (plist-member plist property-name))) - (if ret - (if (eq ret plist) - (cdr ret) - (let ((val (cadr ret)) - (next (cddr ret))) - (if next - (progn - (setcdr ret (cdr next)) - (setcar ret (car next))) - (setcdr (last plist 2) nil)) - (setq ret (cons val plist)) - (aset cell 4 (cons property-name ret)) - ret)) - (setq ret (cons nil plist)) - (aset cell 4 (cons property-name ret)) - ret))) - -(defmacro ses-cell-property-get-handle (property-name row &optional col) - "From a CELL or a pair (ROW,COL), get a cons cell whose car is -the property value of the corresponding cell property with name -PROPERTY-NAME." - `(ses-cell-property-get-handle-fun ,property-name - ,(if col `(ses-get-cell ,row ,col) row))) - - -(defalias 'ses-cell-property-handle-car 'car) -(defalias 'ses-cell-property-handle-setcar 'setcar) + `(ses--letref (pget pset) + (ses--alist-get ,property-name + (ses-cell--properties + ,(if col `(ses-get-cell ,row ,col) row)) + t) + (prog1 (pget) (pset nil)))) (defmacro ses-cell-value (row &optional col) "From a CELL or a pair (ROW,COL), get the current value for that cell." @@ -592,14 +511,14 @@ (< (cdr rowcol) ses--numcols) (eq (ses-cell-symbol (car rowcol) (cdr rowcol)) sym)))))) -(defmacro ses-cell (sym value formula printer references) +(defun ses--cell (sym value formula printer references) "Load a cell SYM from the spreadsheet file. Does not recompute VALUE from -FORMULA, does not reprint using PRINTER, does not check REFERENCES. This is a -macro to prevent propagate-on-load viruses. Safety-checking for FORMULA and -PRINTER are deferred until first use." +FORMULA, does not reprint using PRINTER, does not check REFERENCES. +Safety-checking for FORMULA and PRINTER are deferred until first use." (let ((rowcol (ses-sym-rowcol sym))) (ses-formula-record formula) (ses-printer-record printer) + (unless formula (setq formula value)) (or (atom formula) (eq safe-functions t) (setq formula `(ses-safe-formula ,formula))) @@ -607,11 +526,9 @@ (stringp printer) (eq safe-functions t) (setq printer `(ses-safe-printer ,printer))) - (aset (aref ses--cells (car rowcol)) - (cdr rowcol) + (setf (ses-get-cell (car rowcol) (cdr rowcol)) (ses-make-cell sym formula printer references))) - (set sym value) - sym) + (set sym value)) (defun ses-local-printer-compile (printer) "Convert local printer function into faster printer @@ -622,18 +539,18 @@ `(lambda (x) (format ,printer x))) (t (error "Invalid printer %S" printer)))) -(defmacro ses-local-printer (printer-name printer-def) - "Define a local printer with name PRINTER-NAME and definition -PRINTER-DEF. Return the printer info." +(defun ses--local-printer (name def) + "Define a local printer with name NAME and definition DEF. +Return the printer info." (or - (and (symbolp printer-name) - (ses-printer-validate printer-def)) + (and (symbolp name) + (ses-printer-validate def)) (error "Invalid local printer definition")) - (and (gethash printer-name ses--local-printer-hashmap) - (error "Duplicate printer definition %S" printer-name)) - (add-to-list 'ses-read-printer-history (symbol-name printer-name)) - (puthash printer-name - (ses-make-local-printer-info (ses-safe-printer printer-def)) + (and (gethash name ses--local-printer-hashmap) + (error "Duplicate printer definition %S" name)) + (add-to-list 'ses-read-printer-history (symbol-name name)) + (puthash name + (ses-make-local-printer-info (ses-safe-printer def)) ses--local-printer-hashmap)) (defmacro ses-column-widths (widths) @@ -704,9 +621,11 @@ (defmacro 1value (form) "For code-coverage testing, indicate that FORM is expected to always have the same value." + (declare (debug t)) form) (defmacro noreturn (form) "For code-coverage testing, indicate that FORM will always signal an error." + (declare (debug t)) form) @@ -753,7 +672,7 @@ (and (symbolp printer) (gethash printer ses--local-printer-hashmap)) (functionp printer) (and (stringp (car-safe printer)) (not (cdr printer))) - (error "Invalid printer function")) + (error "Invalid printer function %S" printer)) printer) (defun ses-printer-record (printer) @@ -785,20 +704,22 @@ (intern (concat (ses-column-letter col) (number-to-string (1+ row))))) (defun ses-decode-cell-symbol (str) - "Decode a symbol \"A1\" => (0,0). Returns `nil' if STR is not a - canonical cell name. Does not save match data." + "Decode a symbol \"A1\" => (0,0). Return nil if STR is not a +canonical cell name." (let (case-fold-search) (and (string-match "\\`\\([A-Z]+\\)\\([0-9]+\\)\\'" str) (let* ((col-str (match-string-no-properties 1 str)) - (col 0) - (col-base 1) - (col-idx (1- (length col-str))) - (row (1- (string-to-number (match-string-no-properties 2 str))))) + (col 0) + (col-base 1) + (col-idx (1- (length col-str))) + (row (1- (string-to-number + (match-string-no-properties 2 str))))) (and (>= row 0) (progn (while (progn - (setq col (+ col (* (- (aref col-str col-idx) ?A) col-base)) + (setq col (+ col (* (- (aref col-str col-idx) ?A) + col-base)) col-base (* col-base 26) col-idx (1- col-idx)) (and (>= col-idx 0) @@ -872,21 +793,34 @@ ;; The cells ;;---------------------------------------------------------------------------- -(defun ses-set-cell (row col field val) +(defmacro ses-set-cell (row col field val) "Install VAL as the contents for field FIELD (named by a quoted symbol) of cell (ROW,COL). This is undoable. The cell's data will be updated through `post-command-hook'." - (let ((cell (ses-get-cell row col)) - (elt (plist-get '(value t symbol 0 formula 1 printer 2 references 3) - field)) - change) - (or elt (signal 'args-out-of-range nil)) - (setq change (if (eq elt t) - (ses-set-with-undo (ses-cell-symbol cell) val) - (ses-aset-with-undo cell elt val))) - (if change - (add-to-list 'ses--deferred-write (cons row col)))) - nil) ; Make coverage-tester happy. + `(let ((row ,row) + (col ,col) + (val ,val)) + (let* ((cell (ses-get-cell row col)) + (change + ,(let ((field (eval field t))) + (if (eq field 'value) + `(ses-set-with-undo (ses-cell-symbol cell) val) + ;; (let* ((slots (get 'ses-cell 'cl-struct-slots)) + ;; (slot (or (assq field slots) + ;; (error "Unknown field %S" field))) + ;; (idx (- (length slots) + ;; (length (memq slot slots))))) + ;; `(ses-aset-with-undo cell ,idx val)) + (let ((getter (intern-soft (format "ses-cell--%s" field)))) + `(ses-setter-with-undo + (eval-when-compile + (cons #',getter + (lambda (newval cell) + (setf (,getter cell) newval)))) + val cell)))))) + (if change + (add-to-list 'ses--deferred-write (cons row col)))) + nil)) ; Make coverage-tester happy. (defun ses-cell-set-formula (row col formula) "Store a new formula for (ROW . COL) and enqueue the cell for @@ -901,7 +835,7 @@ (newref (ses-formula-references formula)) (inhibit-quit t) x xrow xcol) - (add-to-list 'ses--deferred-recalc sym) + (cl-pushnew sym ses--deferred-recalc) ;;Delete old references from this cell. Skip the ones that are also ;;in the new list. (dolist (ref oldref) @@ -932,11 +866,11 @@ (dotimes (col ses--numcols) (let ((references (ses-cell-property-pop :ses-repair-reference row col))) - (when references - (push (list - (ses-cell-symbol row col) - :corrupt-property - references) errors))))) + (when references + (push (list (ses-cell-symbol row col) + :corrupt-property + references) + errors))))) ;; Step 2, build new. (dotimes (row ses--numrows) @@ -946,21 +880,17 @@ (formula (ses-cell-formula cell)) (new-ref (ses-formula-references formula))) (dolist (ref new-ref) - (let* ((rowcol (ses-sym-rowcol ref)) - (h (ses-cell-property-get-handle :ses-repair-reference - (car rowcol) (cdr rowcol)))) - (unless (memq ref (ses-cell-property-handle-car h)) - (ses-cell-property-handle-setcar - h - (cons sym - (ses-cell-property-handle-car h))))))))) + (let ((rowcol (ses-sym-rowcol ref))) + (cl-pushnew sym (ses-cell-property :ses-repair-reference + (car rowcol) + (cdr rowcol)))))))) ;; Step 3, overwrite with check. (dotimes (row ses--numrows) (dotimes (col ses--numcols) (let* ((cell (ses-get-cell row col)) (irrelevant (ses-cell-references cell)) - (new-ref (ses-cell-property-pop :ses-repair-reference cell)) + (new-ref (ses-cell-property-pop :ses-repair-reference cell)) missing) (dolist (ref new-ref) (if (memq ref irrelevant) @@ -973,7 +903,7 @@ ,@(and irrelevant (list :irrelevant irrelevant))) errors))))) (if errors - (warn "---------------------------------------------------------------- + (warn "---------------------------------------------------------------- Some references were corrupted. The following is a list where each element ELT is such @@ -1004,12 +934,7 @@ (let ((oldval (ses-cell-value cell)) (formula (ses-cell-formula cell)) newval - this-cell-Dijkstra-attempt-h - this-cell-Dijkstra-attempt - this-cell-Dijkstra-attempt+1 - ref-cell-Dijkstra-attempt-h - ref-cell-Dijkstra-attempt - ref-rowcol) + this-cell-Dijkstra-attempt+1) (when (eq (car-safe formula) 'ses-safe-formula) (setq formula (ses-safe-formula (cadr formula))) (ses-set-cell row col 'formula formula)) @@ -1025,46 +950,42 @@ (setq newval '*skip*)) (catch 'cycle (when (or force (not (eq newval oldval))) - (add-to-list 'ses--deferred-write (cons row col)) ; In case force=t. - (setq this-cell-Dijkstra-attempt-h - (ses-cell-property-get-handle :ses-Dijkstra-attempt cell); - this-cell-Dijkstra-attempt - (ses-cell-property-handle-car this-cell-Dijkstra-attempt-h)) - (if (null this-cell-Dijkstra-attempt) - (ses-cell-property-handle-setcar - this-cell-Dijkstra-attempt-h - (setq this-cell-Dijkstra-attempt - (cons ses--Dijkstra-attempt-nb 0))) - (unless (= ses--Dijkstra-attempt-nb - (car this-cell-Dijkstra-attempt)) - (setcar this-cell-Dijkstra-attempt ses--Dijkstra-attempt-nb) - (setcdr this-cell-Dijkstra-attempt 0))) - (setq this-cell-Dijkstra-attempt+1 - (1+ (cdr this-cell-Dijkstra-attempt))) + (cl-pushnew (cons row col) ses--deferred-write :test #'equal) ; In case force=t. + (ses--letref (pget pset) + (ses-cell-property :ses-Dijkstra-attempt cell) + (let ((this-cell-Dijkstra-attempt (pget))) + (if (null this-cell-Dijkstra-attempt) + (pset + (setq this-cell-Dijkstra-attempt + (cons ses--Dijkstra-attempt-nb 0))) + (unless (= ses--Dijkstra-attempt-nb + (car this-cell-Dijkstra-attempt)) + (setcar this-cell-Dijkstra-attempt ses--Dijkstra-attempt-nb) + (setcdr this-cell-Dijkstra-attempt 0))) + (setq this-cell-Dijkstra-attempt+1 + (1+ (cdr this-cell-Dijkstra-attempt))))) (ses-set-cell row col 'value newval) (dolist (ref (ses-cell-references cell)) - (add-to-list 'ses--deferred-recalc ref) - (setq ref-rowcol (ses-sym-rowcol ref) - ref-cell-Dijkstra-attempt-h - (ses-cell-property-get-handle - :ses-Dijkstra-attempt - (car ref-rowcol) (cdr ref-rowcol)) - ref-cell-Dijkstra-attempt - (ses-cell-property-handle-car ref-cell-Dijkstra-attempt-h)) + (cl-pushnew ref ses--deferred-recalc) + (ses--letref (pget pset) + (let ((ref-rowcol (ses-sym-rowcol ref))) + (ses-cell-property + :ses-Dijkstra-attempt + (car ref-rowcol) (cdr ref-rowcol))) + (let ((ref-cell-Dijkstra-attempt (pget))) - (if (null ref-cell-Dijkstra-attempt) - (ses-cell-property-handle-setcar - ref-cell-Dijkstra-attempt-h - (setq ref-cell-Dijkstra-attempt - (cons ses--Dijkstra-attempt-nb - this-cell-Dijkstra-attempt+1))) - (if (= (car ref-cell-Dijkstra-attempt) ses--Dijkstra-attempt-nb) - (setcdr ref-cell-Dijkstra-attempt - (max (cdr ref-cell-Dijkstra-attempt) - this-cell-Dijkstra-attempt+1)) - (setcar ref-cell-Dijkstra-attempt ses--Dijkstra-attempt-nb) - (setcdr ref-cell-Dijkstra-attempt - this-cell-Dijkstra-attempt+1))) + (if (null ref-cell-Dijkstra-attempt) + (pset + (setq ref-cell-Dijkstra-attempt + (cons ses--Dijkstra-attempt-nb + this-cell-Dijkstra-attempt+1))) + (if (= (car ref-cell-Dijkstra-attempt) ses--Dijkstra-attempt-nb) + (setcdr ref-cell-Dijkstra-attempt + (max (cdr ref-cell-Dijkstra-attempt) + this-cell-Dijkstra-attempt+1)) + (setcar ref-cell-Dijkstra-attempt ses--Dijkstra-attempt-nb) + (setcdr ref-cell-Dijkstra-attempt + this-cell-Dijkstra-attempt+1))))) (when (> this-cell-Dijkstra-attempt+1 ses--Dijkstra-weight-bound) ;; Update print of this cell. @@ -1123,7 +1044,7 @@ (when (or (memq ref curlist) (memq ref ses--deferred-recalc)) ;; This cell refers to another that isn't done yet - (add-to-list 'ses--deferred-recalc this-sym) + (cl-pushnew this-sym ses--deferred-recalc :test #'equal) (throw 'ref t))))) ;; ses-update-cells is called from post-command-hook, so ;; inhibit-quit is implicitly bound to t. @@ -1132,7 +1053,7 @@ (error "Quit")) (ses-calculate-cell (car this-rowcol) (cdr this-rowcol) force))) (dolist (ref ses--deferred-recalc) - (add-to-list 'nextlist ref))) + (cl-pushnew ref nextlist :test #'equal))) (when ses--deferred-recalc ;; Just couldn't finish these. (dolist (x ses--deferred-recalc) @@ -1251,7 +1172,8 @@ ((< len width) ;; Fill field to length with spaces. (setq len (make-string (- width len) ?\s) - text (if (eq ses-call-printer-return t) + text (if (or (stringp value) + (eq ses-call-printer-return t)) (concat text len) (concat len text)))) ((> len width) @@ -1352,7 +1274,7 @@ (or (and (symbolp printer) (let ((locprn (gethash printer ses--local-printer-hashmap))) (and locprn - (ses-locprn-get-compiled locprn)))) + (ses--locprn-compiled locprn)))) printer) (or value ""))) (if (stringp value) @@ -1440,7 +1362,8 @@ (ses-widen) (goto-char ses--params-marker) (forward-line (plist-get ses-paramlines-plist 'ses--numlocprn )) - (insert (format (plist-get ses-paramfmt-plist 'ses--numlocprn) ses--numlocprn) + (insert (format (plist-get ses-paramfmt-plist 'ses--numlocprn) + ses--numlocprn) ?\n) t) ))) @@ -1492,24 +1415,17 @@ (setq formula (cadr formula))) (if (eq (car-safe printer) 'ses-safe-printer) (setq printer (cadr printer))) - ;; This is noticeably faster than (format "%S %S %S %S %S") - (setq text (concat "(ses-cell " - (symbol-name sym) - " " - (prin1-to-string (symbol-value sym)) - " " - (prin1-to-string formula) - " " - (prin1-to-string printer) - " " - (if (atom (ses-cell-references cell)) - "nil" - (concat "(" - (mapconcat 'symbol-name - (ses-cell-references cell) - " ") - ")")) - ")")) + (setq text (prin1-to-string + ;; We could shorten it to (ses-cell SYM VAL) when + ;; the other parameters are nil, but in practice most + ;; cells have non-nil `references', so it's + ;; rather pointless. + `(ses-cell ,sym + ,(symbol-value sym) + ,(unless (equal formula (symbol-value sym)) + formula) + ,printer + ,(ses-cell-references cell)))) (ses-goto-data row col) (delete-region (point) (line-end-position)) (insert text))) @@ -1526,8 +1442,8 @@ constructed, or t to get a wrong-type-argument error when the first reference is found." (if (ses-sym-rowcol formula) - ;;Entire formula is one symbol - (add-to-list 'result-so-far formula) + ;; Entire formula is one symbol. + (cl-pushnew formula result-so-far :test #'equal) (if (consp formula) (cond ((eq (car formula) 'ses-range) @@ -1535,7 +1451,7 @@ (cdr (funcall 'macroexpand (list 'ses-range (nth 1 formula) (nth 2 formula))))) - (add-to-list 'result-so-far cur))) + (cl-pushnew cur result-so-far :test #'equal))) ((null (eq (car formula) 'quote)) ;;Recursive call for subformulas (dolist (cur formula) @@ -1704,8 +1620,8 @@ ;; This cell referred to a cell that's been deleted or is no ;; longer part of the range. We can't fix that now because ;; reference lists cells have been partially updated. - (add-to-list 'ses--deferred-recalc - (ses-create-cell-symbol row col))) + (cl-pushnew (ses-create-cell-symbol row col) + ses--deferred-recalc :test #'equal)) (setq newval (ses-relocate-formula (ses-cell-references mycell) minrow mincol rowincr colincr)) (ses-set-cell row col 'references newval) @@ -1795,36 +1711,30 @@ (insert-and-inherit "X") (delete-region (1- (point)) (point)))) +(defun ses-setter-with-undo (accessors newval &rest args) + "Set a field/variable and record it so it can be undone. +Result is non-nil if field/variable has changed." + (let ((oldval (apply (car accessors) args))) + (unless (equal-including-properties oldval newval) + (push `(apply ses-setter-with-undo ,accessors ,oldval ,@args) + buffer-undo-list) + (apply (cdr accessors) newval args) + t))) + +(defun ses-aset-with-undo (array idx newval) + (ses-setter-with-undo (eval-when-compile + (cons #'aref + (lambda (newval array idx) (aset array idx newval)))) + newval array idx)) + (defun ses-set-with-undo (sym newval) - "Like set, but undoable. Result is t if value has changed." - ;; We try to avoid adding redundant entries to the undo list, but this is - ;; unavoidable for strings because equal ignores text properties and there's - ;; no easy way to get the whole property list to see if it's different! - (unless (and (boundp sym) - (equal (symbol-value sym) newval) - (not (stringp newval))) - (push (if (boundp sym) - `(apply ses-set-with-undo ,sym ,(symbol-value sym)) - `(apply ses-unset-with-undo ,sym)) - buffer-undo-list) - (set sym newval) - t)) - -(defun ses-unset-with-undo (sym) - "Set SYM to be unbound. This is undoable." - (when (1value (boundp sym)) ; Always bound, except after a programming error. - (push `(apply ses-set-with-undo ,sym ,(symbol-value sym)) buffer-undo-list) - (makunbound sym))) - -(defun ses-aset-with-undo (array idx newval) - "Like `aset', but undoable. -Result is t if element has changed." - (unless (equal (aref array idx) newval) - (push `(apply ses-aset-with-undo ,array ,idx - ,(aref array idx)) buffer-undo-list) - (aset array idx newval) - t)) - + (ses-setter-with-undo + (eval-when-compile + (cons (lambda (sym) (if (boundp sym) (symbol-value sym) :ses--unbound)) + (lambda (newval sym) (if (eq newval :ses--unbound) + (makunbound sym) + (set sym newval))))) + newval sym)) ;;---------------------------------------------------------------------------- ;; Startup for major mode @@ -1890,11 +1800,11 @@ (forward-line (* ses--numrows (1+ ses--numcols))) (let ((numlocprn ses--numlocprn)) (setq ses--numlocprn 0) - (dotimes (lp numlocprn) + (dotimes (_ numlocprn) (let ((x (read (current-buffer)))) (or (and (looking-at-p "\n") (eq (car-safe x) 'ses-local-printer) - (eval x)) + (apply #'ses--local-printer (cdr x))) (error "local printer-def error")) (setq ses--numlocprn (1+ ses--numlocprn)))))) ;; Load cell definitions. @@ -1906,7 +1816,7 @@ (eq (car-safe x) 'ses-cell) (ses-create-cell-variable sym row col)) (error "Cell-def error")) - (eval x))) + (apply #'ses--cell (cdr x)))) (or (looking-at-p "\n\n") (error "Missing blank line between rows"))) ;; Skip local printer function declaration --- that were already loaded. @@ -2067,7 +1977,8 @@ ;; calculation). indent-tabs-mode nil) (1value (add-hook 'change-major-mode-hook 'ses-cleanup nil t)) - (1value (add-hook 'before-revert-hook 'ses-cleanup nil t)) + ;; This makes revert impossible if the buffer is read-only. + ;; (1value (add-hook 'before-revert-hook 'ses-cleanup nil t)) (setq header-line-format '(:eval (progn (when (/= (window-hscroll) ses--header-hscroll) @@ -2251,7 +2162,7 @@ (delete-region (point-min) (point)) ;; Insert all blank lines before printing anything, so ses-print-cell can ;; find the data area when inserting or deleting *skip* values for cells. - (dotimes (row ses--numrows) + (dotimes (_ ses--numrows) (insert-and-inherit ses--blank-line)) (dotimes-with-progress-reporter (row ses--numrows) "Reprinting..." (if (eq (ses-cell-value row 0) '*skip*) @@ -2283,9 +2194,10 @@ (when (setq cur-rowcol (ses-sym-rowcol ses--curcell) sig (progn - (ses-cell-property-set :ses-Dijkstra-attempt - (cons ses--Dijkstra-attempt-nb 0) - (car cur-rowcol) (cdr cur-rowcol) ) + (setf (ses-cell-property :ses-Dijkstra-attempt + (car cur-rowcol) + (cdr cur-rowcol)) + (cons ses--Dijkstra-attempt-nb 0)) (ses-calculate-cell (car cur-rowcol) (cdr cur-rowcol) t))) (nconc sig (list (ses-cell-symbol (car cur-rowcol) (cdr cur-rowcol))))) @@ -2298,14 +2210,14 @@ ;; The t causes an error if the cell has references. If no ;; references, the t will be the result value. (1value (ses-formula-references (ses-cell-formula row col) t)) - (ses-cell-property-set :ses-Dijkstra-attempt - (cons ses--Dijkstra-attempt-nb 0) - row col) + (setf (ses-cell-property :ses-Dijkstra-attempt row col) + (cons ses--Dijkstra-attempt-nb 0)) (when (setq sig (ses-calculate-cell row col t)) (nconc sig (list (ses-cell-symbol row col))))) (wrong-type-argument ;; The formula contains a reference. - (add-to-list 'ses--deferred-recalc (ses-cell-symbol row col)))))) + (cl-pushnew (ses-cell-symbol row col) ses--deferred-recalc + :test #'equal))))) ;; Do the update now, so we can force recalculation. (let ((x ses--deferred-recalc)) (setq ses--deferred-recalc nil) @@ -2380,7 +2292,7 @@ (insert ses-initial-file-trailer) (goto-char (point-min))) ;; Create a blank display area. - (dotimes (row ses--numrows) + (dotimes (_ ses--numrows) (insert ses--blank-line)) (insert ses-print-data-boundary) (backward-char (1- (length ses-print-data-boundary))) @@ -2450,16 +2362,23 @@ (barf-if-buffer-read-only) (list (car rowcol) (cdr rowcol) - (read-from-minibuffer - (format "Cell %s: " ses--curcell) - (cons (if (equal initial "\"") "\"\"" - (if (equal initial "(") "()" initial)) 2) - ses-mode-edit-map - t ; Convert to Lisp object. - 'ses-read-cell-history - (prin1-to-string (if (eq (car-safe curval) 'ses-safe-formula) - (cadr curval) - curval)))))) + (if (equal initial "\"") + (progn + (if (not (stringp curval)) (setq curval nil)) + (read-string (if curval + (format "String Cell %s (default %s): " + ses--curcell curval) + (format "String Cell %s: " ses--curcell)) + nil 'ses-read-string-history curval)) + (read-from-minibuffer + (format "Cell %s: " ses--curcell) + (cons (if (equal initial "(") "()" initial) 2) + ses-mode-edit-map + t ; Convert to Lisp object. + 'ses-read-cell-history + (prin1-to-string (if (eq (car-safe curval) 'ses-safe-formula) + (cadr curval) + curval))))))) (when (ses-edit-cell row col newval) (ses-command-hook) ; Update cell widths before movement. (dolist (x ses-after-entry-functions) @@ -2492,7 +2411,7 @@ (1value (ses-clear-cell-backward (- count))) (ses-check-curcell) (ses-begin-change) - (dotimes (x count) + (dotimes (_ count) (ses-set-curcell) (let ((rowcol (ses-sym-rowcol ses--curcell))) (or rowcol (signal 'end-of-buffer nil)) @@ -2507,7 +2426,7 @@ (1value (ses-clear-cell-forward (- count))) (ses-check-curcell 'end) (ses-begin-change) - (dotimes (x count) + (dotimes (_ count) (backward-char 1) ; Will signal 'beginning-of-buffer if appropriate. (ses-set-curcell) (let ((rowcol (ses-sym-rowcol ses--curcell))) @@ -2526,7 +2445,7 @@ (barf-if-buffer-read-only) (if (eq default t) (setq default "") - (setq prompt (format "%s [currently %S]: " + (setq prompt (format "%s (default %S): " (substring prompt 0 -2) default))) (let ((new (read-from-minibuffer prompt @@ -2557,21 +2476,20 @@ latter two cases, the function's result should be either a string (will be right-justified) or a list of one string (will be left-justified)." (interactive - (let ((default t) - x) + (let ((default t)) (ses-check-curcell 'range) ;;Default is none if not all cells in range have same printer (catch 'ses-read-cell-printer (ses-dorange ses--curcell - (setq x (ses-cell-printer row col)) - (if (eq (car-safe x) 'ses-safe-printer) - (setq x (cadr x))) - (if (eq default t) - (setq default x) - (unless (equal default x) - ;;Range contains differing printer functions - (setq default t) - (throw 'ses-read-cell-printer t))))) + (let ((x (ses-cell-printer row col))) + (if (eq (car-safe x) 'ses-safe-printer) + (setq x (cadr x))) + (if (eq default t) + (setq default x) + (unless (equal default x) + ;;Range contains differing printer functions + (setq default t) + (throw 'ses-read-cell-printer t)))))) (list (ses-read-printer (format "Cell %S printer: " ses--curcell) default)))) (unless (eq newval t) @@ -2850,7 +2768,7 @@ (list col (if current-prefix-arg (prefix-numeric-value current-prefix-arg) - (read-from-minibuffer (format "Column %s width [currently %d]: " + (read-from-minibuffer (format "Column %s width (default %d): " (ses-column-letter col) (ses-col-width col)) nil ; No initial contents. @@ -3089,9 +3007,9 @@ ;; Invalid sexp --- leave it as a string. (setq val (substring text from to))) ((and (car val) (symbolp (car val))) - (if (consp arg) - (setq val (list 'quote (car val))) ; Keep symbol. - (setq val (substring text from to)))) ; Treat symbol as text. + (setq val (if (consp arg) + (list 'quote (car val)) ; Keep symbol. + (substring text from to)))) ; Treat symbol as text. (t (setq val (car val)))) (let ((row (car rowcol)) @@ -3437,29 +3355,31 @@ (if (equal new-rowcol rowcol) (put new-name 'ses-cell rowcol) (error "Not a valid name for this cell location")) - (setq ses--named-cell-hashmap (or ses--named-cell-hashmap (make-hash-table :test 'eq))) + (setq ses--named-cell-hashmap + (or ses--named-cell-hashmap (make-hash-table :test 'eq))) (put new-name 'ses-cell :ses-named) (puthash new-name rowcol ses--named-cell-hashmap)) (push `(ses-rename-cell ,old-name ,cell) buffer-undo-list) - ;; replace name by new name in formula of cells refering to renamed cell + ;; Replace name by new name in formula of cells refering to renamed cell. (dolist (ref (ses-cell-references cell)) (let* ((x (ses-sym-rowcol ref)) (xcell (ses-get-cell (car x) (cdr x)))) - (ses-cell-formula-aset xcell - (ses-replace-name-in-formula - (ses-cell-formula xcell) - sym - new-name)))) - ;; replace name by new name in reference list of cells to which renamed cell refers to + (setf (ses-cell-formula xcell) + (ses-replace-name-in-formula + (ses-cell-formula xcell) + sym + new-name)))) + ;; Replace name by new name in reference list of cells to which renamed + ;; cell refers to. (dolist (ref (ses-formula-references (ses-cell-formula cell))) (let* ((x (ses-sym-rowcol ref)) (xcell (ses-get-cell (car x) (cdr x)))) - (ses-cell-references-aset xcell - (cons new-name (delq sym - (ses-cell-references xcell)))))) + (setf (ses-cell-references xcell) + (cons new-name (delq sym + (ses-cell-references xcell)))))) (push new-name ses--renamed-cell-symb-list) (set new-name (symbol-value sym)) - (aset cell 0 new-name) + (setf (ses-cell--symbol cell) new-name) (makunbound sym) (and curcell (setq ses--curcell new-name)) (let* ((pos (point)) @@ -3477,8 +3397,9 @@ (force-mode-line-update))) (defun ses-refresh-local-printer (name compiled-value) - "Refresh printout of spreadsheet for all cells with printer - defined to local printer named NAME using the value COMPILED-VALUE for this printer" + "Refresh printout for all cells which use printer NAME. +NAME should be the name of a locally defined printer. +Uses the value COMPILED-VALUE for this printer." (message "Refreshing cells using printer %S" name) (let (new-print) (dotimes (row ses--numrows) @@ -3490,55 +3411,58 @@ (ses-begin-change)) (ses-print-cell row col))))))) -(defun ses-define-local-printer (printer-name) - "Define a local printer with name PRINTER-NAME." +(defun ses-define-local-printer (name) + "Define a local printer with name NAME." (interactive "*SEnter printer name: ") - (let* ((cur-printer (gethash printer-name ses--local-printer-hashmap)) - (default (and (vectorp cur-printer) (ses-locprn-get-def cur-printer))) - printer-def-text + (let* ((cur-printer (gethash name ses--local-printer-hashmap)) + (default (and (vectorp cur-printer) (ses--locprn-def cur-printer))) create-printer - (new-printer (ses-read-printer (format "Enter definition of printer %S: " printer-name) default))) + (new-def + (ses-read-printer (format "Enter definition of printer %S: " name) + default))) (cond ;; cancelled operation => do nothing - ((eq new-printer t)) + ((eq new-def t)) ;; no change => do nothing - ((and (vectorp cur-printer) (equal new-printer default))) + ((and (vectorp cur-printer) (equal new-def default))) ;; re-defined printer ((vectorp cur-printer) (setq create-printer 0) - (ses-locprn-def-aset cur-printer new-printer) + (setf (ses--locprn-def cur-printer) new-def) (ses-refresh-local-printer - printer-name - (ses-locprn-compiled-aset cur-printer (ses-local-printer-compile new-printer)))) + name + (setf (ses--locprn-compiled cur-printer) + (ses-local-printer-compile new-def)))) ;; new definition (t (setq create-printer 1) - (puthash printer-name + (puthash name (setq cur-printer - (ses-make-local-printer-info new-printer)) + (ses-make-local-printer-info new-def)) ses--local-printer-hashmap))) (when create-printer - (setq printer-def-text - (concat - "(ses-local-printer " - (symbol-name printer-name) - " " - (prin1-to-string (ses-locprn-get-def cur-printer)) - ")")) - (save-excursion - (ses-goto-data ses--numrows - (ses-locprn-get-number cur-printer)) - (let ((inhibit-read-only t)) - ;; Special undo since it's outside the narrowed buffer. - (let (buffer-undo-list) - (if (= create-printer 0) - (delete-region (point) (line-end-position)) - (insert ?\n) - (backward-char)) - (insert printer-def-text) - (when (= create-printer 1) - (ses-file-format-extend-paramter-list 3) - (ses-set-parameter 'ses--numlocprn (+ ses--numlocprn create-printer))) ))))) ) + (let ((printer-def-text + (concat + "(ses-local-printer " + (symbol-name name) + " " + (prin1-to-string (ses--locprn-def cur-printer)) + ")"))) + (save-excursion + (ses-goto-data ses--numrows + (ses--locprn-number cur-printer)) + (let ((inhibit-read-only t)) + ;; Special undo since it's outside the narrowed buffer. + (let (buffer-undo-list) + (if (= create-printer 0) + (delete-region (point) (line-end-position)) + (insert ?\n) + (backward-char)) + (insert printer-def-text) + (when (= create-printer 1) + (ses-file-format-extend-paramter-list 3) + (ses-set-parameter 'ses--numlocprn + (+ ses--numlocprn create-printer)))))))))) ;;---------------------------------------------------------------------------- ------------------------------------------------------------ revno: 117338 committer: Glenn Morris branch nick: trunk timestamp: Sat 2014-06-14 18:16:35 -0700 message: * oldXMenu/Makefile.in: Fix typo in earlier change. diff: === modified file 'oldXMenu/Makefile.in' --- oldXMenu/Makefile.in 2014-06-15 00:17:21 +0000 +++ oldXMenu/Makefile.in 2014-06-15 01:16:35 +0000 @@ -141,7 +141,7 @@ clean: mostlyclean -boostrap-clean maintainer-clean distclean: clean +bootstrap-clean maintainer-clean distclean: clean rm -f Makefile .PHONY: tags ------------------------------------------------------------ revno: 117337 committer: Glenn Morris branch nick: trunk timestamp: Sat 2014-06-14 17:34:22 -0700 message: Use `make -C' rather than `cd && make' * Makefile.in: Use `make -C' rather than `cd && make' throughout. * lib-src/Makefile.in (../lib/libgnu.a): Use `make -C' rather than `cd && make'. * lisp/Makefile.in (leim, semantic): Use `make -C' rather than `cd && make'. * lwlib/Makefile.in ($(globals_h)): Use `make -C' rather than `cd && make'. * src/Makefile.in: Use `make -C' rather than `cd && make' throughout. diff: === modified file 'ChangeLog' --- ChangeLog 2014-06-15 00:17:21 +0000 +++ ChangeLog 2014-06-15 00:34:22 +0000 @@ -1,5 +1,7 @@ 2014-06-15 Glenn Morris + * Makefile.in: Use `make -C' rather than `cd && make' throughout. + * Makefile.in: Parallelize clean rules using GNU make features. (submake_template): New definition. (mostlyclean_dirs, clean_dirs, distclean_dirs, maintainer_clean_dirs): === modified file 'Makefile.in' --- Makefile.in 2014-06-15 00:17:21 +0000 +++ Makefile.in 2014-06-15 00:34:22 +0000 @@ -358,7 +358,7 @@ # These targets should be "${SUBDIR} without `src'". lib lib-src lisp nt: Makefile - cd $@ && $(MAKE) all + $(MAKE) -C $@ all # Pass to src/Makefile.in an additional BOOTSTRAPEMACS variable which # is either set to bootstrap-emacs (in case bootstrap-emacs has not been @@ -384,7 +384,7 @@ $(MAKE) all BOOTSTRAPEMACS="$$boot" VCSWITNESS="$$vcswitness" blessmail: Makefile src - cd lib-src && $(MAKE) maybe-blessmail + $(MAKE) -C lib-src maybe-blessmail # We used to have one rule per */Makefile.in, but that leads to race # conditions with parallel makes, so let's assume that the time stamp on @@ -477,7 +477,7 @@ ### Lisp files and DOC file to work properly. install-arch-dep: src install-arch-indep install-etcdoc install-$(NTDIR) umask 022; ${MKDIR_P} "$(DESTDIR)${bindir}" - cd lib-src && $(MAKE) install + $(MAKE) -C lib-src install if test "${ns_self_contained}" = "no"; then \ ${INSTALL_PROGRAM} $(INSTALL_STRIP) src/emacs${EXEEXT} "$(DESTDIR)${bindir}/$(EMACSFULL)" || exit 1 ; \ chmod 1755 "$(DESTDIR)${bindir}/$(EMACSFULL)" || true; \ @@ -495,7 +495,7 @@ ### in nt/, and its Posix do-nothing shadow. install-: install-nt: - cd $(NTDIR) && $(MAKE) install + $(MAKE) -C $(NTDIR) install ## In the share directory, we are deleting: ## applications (with emacs.desktop, also found in etc/) @@ -641,7 +641,7 @@ [ -f "$(DESTDIR)${infodir}/dir" ] || \ [ ! -f ${srcdir}/info/dir ] || \ ${INSTALL_DATA} ${srcdir}/info/dir "$(DESTDIR)${infodir}/dir"; \ - info_misc=`cd doc/misc && $(QUIET_SUBMAKE) $(MAKE) -s echo-info`; \ + info_misc=`$(QUIET_SUBMAKE) $(MAKE) -s -C doc/misc echo-info`; \ cd ${srcdir}/info ; \ for elt in ${INFO_NONMISC} $${info_misc}; do \ test "$(HAVE_MAKEINFO)" = "no" && test ! -f $$elt && continue; \ @@ -715,7 +715,7 @@ ### ### Don't delete the lisp and etc directories if they're in the source tree. uninstall: uninstall-$(NTDIR) uninstall-doc - cd lib-src && $(MAKE) uninstall + $(MAKE) -C lib-src uninstall -unset CDPATH; \ for dir in "$(DESTDIR)${lispdir}" "$(DESTDIR)${etcdir}" ; do \ if [ -d "$${dir}" ]; then \ @@ -732,7 +732,7 @@ done -rm -rf "$(DESTDIR)${libexecdir}/emacs/${version}" thisdir=`/bin/pwd`; \ - (info_misc=`cd doc/misc && $(QUIET_SUBMAKE) $(MAKE) -s echo-info`; \ + (info_misc=`$(QUIET_SUBMAKE) $(MAKE) -s -C doc/misc echo-info`; \ if cd "$(DESTDIR)${infodir}"; then \ for elt in ${INFO_NONMISC} $${info_misc}; do \ (cd "$${thisdir}"; \ @@ -764,7 +764,7 @@ ### in nt/, and its Posix do-nothing shadow. uninstall-: uninstall-nt: - cd $(NTDIR) && $(MAKE) uninstall + $(MAKE) -C $(NTDIR) uninstall # ==================== Cleaning up and miscellanea ==================== @@ -888,14 +888,14 @@ # even when the build directory and source dir are different. .PHONY: TAGS tags TAGS tags: lib lib-src src - cd src && $(MAKE) tags + $(MAKE) -C src tags check: all @if test ! -d test/automated; then \ echo "You do not seem to have the test/ directory."; \ echo "Maybe you are using a release tarfile, rather than a repository checkout."; \ else \ - cd test/automated && $(MAKE) check; \ + $(MAKE) -C test/automated check; \ fi dist: @@ -909,7 +909,7 @@ DOCS = $(DVIS) $(HTMLS) $(INFOS) $(PDFS) $(PSS) $(DOCS): - t=$@; IFS=-; set $$t; IFS=; cd doc/$$1 && $(MAKE) $$2 + t=$@; IFS=-; set $$t; IFS=; $(MAKE) -C doc/$$1 $$2 .PHONY: $(DOCS) docs pdf ps .PHONY: info dvi dist check html info-real info-dir check-info @@ -958,7 +958,7 @@ ## Install non .info forms of the documentation. ## TODO add etc/refcards. $(INSTALL_DOC): - t=$@; IFS=-; set $$t; IFS=; cd doc/$$2 && $(MAKE) $$1-$$3 + t=$@; IFS=-; set $$t; IFS=; $(MAKE) -C doc/$$2 $$1-$$3 .PHONY: $(INSTALL_DOC) install-doc .PHONY: install-dvi install-html install-pdf install-ps @@ -981,7 +981,7 @@ UNINSTALL_DOC = $(UNINSTALL_DVI) $(UNINSTALL_HTML) $(UNINSTALL_PDF) $(UNINSTALL_PS) $(UNINSTALL_DOC): - t=$@; IFS=-; set $$t; IFS=; cd doc/$$2 && $(MAKE) $$1-$$3 + t=$@; IFS=-; set $$t; IFS=; $(MAKE) -C doc/$$2 $$1-$$3 .PHONY: $(UNINSTALL_DOC) uninstall-doc .PHONY: uninstall-dvi uninstall-html uninstall-pdf uninstall-ps @@ -1058,4 +1058,4 @@ echo "You must build Emacs to use this command"; \ exit 1; \ fi - cd lisp && $(MAKE) $@ + $(MAKE) -C lisp $@ === modified file 'lib-src/ChangeLog' --- lib-src/ChangeLog 2014-06-15 00:17:21 +0000 +++ lib-src/ChangeLog 2014-06-15 00:34:22 +0000 @@ -1,5 +1,8 @@ 2014-06-15 Glenn Morris + * Makefile.in (../lib/libgnu.a): + Use `make -C' rather than `cd && make'. + * Makefile.in (bootstrap-clean): New. 2014-06-13 Glenn Morris === modified file 'lib-src/Makefile.in' --- lib-src/Makefile.in 2014-06-15 00:17:21 +0000 +++ lib-src/Makefile.in 2014-06-15 00:34:22 +0000 @@ -304,7 +304,7 @@ etags *.[ch] ../lib/libgnu.a: $(config_h) - cd ../lib && $(MAKE) libgnu.a + $(MAKE) -C ../lib libgnu.a regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h $(config_h) ${CC} -c ${CPP_CFLAGS} ${srcdir}/../src/regex.c === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-06-15 00:06:30 +0000 +++ lisp/ChangeLog 2014-06-15 00:34:22 +0000 @@ -1,5 +1,7 @@ 2014-06-15 Glenn Morris + * Makefile.in (leim, semantic): Use `make -C' rather than `cd && make'. + * progmodes/cc-langs.el: Require cl-lib. (Bug#17463) Replace delete-duplicates and mapcan by cl- versions throughout. And cl-macroexpand-all by macroexpand-all. === modified file 'lisp/Makefile.in' --- lisp/Makefile.in 2014-06-13 23:05:00 +0000 +++ lisp/Makefile.in 2014-06-15 00:34:22 +0000 @@ -348,7 +348,7 @@ .PHONY: leim semantic leim: - cd ../leim && $(MAKE) all EMACS="$(EMACS)" + $(MAKE) -C ../leim all EMACS="$(EMACS)" # FIXME. Yuck. semantic: @@ -356,7 +356,7 @@ .*) EMACS="../${EMACS}" ;; \ *) EMACS="${EMACS}" ;; \ esac; \ - cd ../admin/grammars && $(MAKE) all EMACS="$${EMACS}" + $(MAKE) -C ../admin/grammars all EMACS="$${EMACS}" # Compile all Lisp files, but don't recompile those that are up to # date. Some .el files don't get compiled because they set the === modified file 'lwlib/ChangeLog' --- lwlib/ChangeLog 2014-06-15 00:17:21 +0000 +++ lwlib/ChangeLog 2014-06-15 00:34:22 +0000 @@ -1,5 +1,7 @@ 2014-06-15 Glenn Morris + * Makefile.in ($(globals_h)): Use `make -C' rather than `cd && make'. + * Makefile.in (mostlyclean, clean, distclean, maintainer-clean): Declare as PHONY. (bootstrap-clean): New. === modified file 'lwlib/Makefile.in' --- lwlib/Makefile.in 2014-06-15 00:17:21 +0000 +++ lwlib/Makefile.in 2014-06-15 00:34:22 +0000 @@ -80,7 +80,7 @@ src_h = $(config_h) $(lisp_h) $(globals_h) $(globals_h): - cd ../src && $(MAKE) globals.h + $(MAKE) -C ../src globals.h lwlib-utils.o: $(src_h) lwlib-utils.c lwlib-utils.h lwlib.h lwlib.o: $(src_h) lwlib.c lwlib.h lwlib-int.h lwlib-utils.h \ === modified file 'src/ChangeLog' --- src/ChangeLog 2014-06-15 00:06:30 +0000 +++ src/ChangeLog 2014-06-15 00:34:22 +0000 @@ -1,3 +1,7 @@ +2014-06-15 Glenn Morris + + * Makefile.in: Use `make -C' rather than `cd && make' throughout. + 2014-06-15 Eli Zaretskii * xdisp.c (Fmove_point_visually): Don't use the glyph matrix === modified file 'src/Makefile.in' --- src/Makefile.in 2014-06-13 23:05:00 +0000 +++ src/Makefile.in 2014-06-15 00:34:22 +0000 @@ -414,11 +414,11 @@ .PHONY: all $(leimdir)/leim-list.el: bootstrap-emacs$(EXEEXT) - cd ../leim && $(MAKE) leim-list.el EMACS="$(bootstrap_exe)" + $(MAKE) -C ../leim leim-list.el EMACS="$(bootstrap_exe)" $(srcdir)/macuvs.h $(lispsource)/international/charprop.el: \ bootstrap-emacs$(EXEEXT) - cd ../admin/unidata && $(MAKE) all EMACS="../$(bootstrap_exe)" + $(MAKE) -C ../admin/unidata all EMACS="../$(bootstrap_exe)" ## The dumped Emacs is as functional and more efficient than ## bootstrap-emacs, so we replace the latter with the former. @@ -459,7 +459,7 @@ $(libsrc)/make-docfile -a $(etc)/DOC -d $(lispsource) `sed -n -e 's| \\\\||' -e 's|^[ ]*$$(lispsource)/||p' $(srcdir)/lisp.mk` $(libsrc)/make-docfile$(EXEEXT): - cd $(libsrc); $(MAKE) make-docfile$(EXEEXT) + $(MAKE) -C $(libsrc) make-docfile$(EXEEXT) buildobj.h: Makefile for i in $(ALLOBJS); do \ @@ -480,7 +480,7 @@ $(ALLOBJS): globals.h $(lib)/libgnu.a: $(config_h) - cd $(lib) && $(MAKE) libgnu.a + $(MAKE) -C $(lib) libgnu.a ## We have to create $(etc) here because init_cmdargs tests its ## existence when setting Vinstallation_directory (FIXME?). @@ -499,9 +499,9 @@ ## The following oldxmenu-related rules are only (possibly) used if ## HAVE_X11 && !USE_GTK, but there is no harm in always defining them. $(lwlibdir)/liblw.a: $(config_h) globals.h lisp.h FORCE - cd $(lwlibdir) && $(MAKE) liblw.a + $(MAKE) -C $(lwlibdir) liblw.a $(oldXMenudir)/libXMenu11.a: FORCE - cd $(oldXMenudir) && $(MAKE) libXMenu11.a + $(MAKE) -C $(oldXMenudir) libXMenu11.a FORCE: .PHONY: FORCE @@ -519,7 +519,7 @@ -o $@ $(ntsource)/emacs.rc ns-app: emacs$(EXEEXT) - cd ../nextstep && $(MAKE) all + $(MAKE) -C ./nextstep all .PHONY: mostlyclean clean bootstrap-clean distclean maintainer-clean .PHONY: versionclean extraclean @@ -578,10 +578,10 @@ ## Arrange to make tags tables for ../lisp and ../lwlib, ## which the above TAGS file for the C files includes by reference. ../lisp/TAGS: - cd ../lisp && $(MAKE) TAGS ETAGS="$(ETAGS)" + $(MAKE) -C ../lisp TAGS ETAGS="$(ETAGS)" $(lwlibdir)/TAGS: - cd $(lwlibdir) && $(MAKE) TAGS ETAGS="$(ETAGS)" + $(MAKE) -C $(lwlibdir) TAGS ETAGS="$(ETAGS)" tags: TAGS ../lisp/TAGS $(lwlibdir)/TAGS .PHONY: tags @@ -617,8 +617,7 @@ ## separately below. ## With GNU Make, we would just say "%.el : %.elc $(BOOTSTRAPEMACS)" .el.elc: - @cd ../lisp && $(MAKE) compile-onefile \ - THEFILE=$< EMACS="$(bootstrap_exe)" + @$(MAKE) -C ../lisp compile-onefile THEFILE=$< EMACS="$(bootstrap_exe)" ## Since the .el.elc rule cannot specify an extra dependency, we do it here. $(lisp): $(BOOTSTRAPEMACS) @@ -629,12 +628,12 @@ VCSWITNESS = $(lispsource)/loaddefs.el: $(BOOTSTRAPEMACS) $(VCSWITNESS) - cd ../lisp && $(MAKE) autoloads EMACS="$(bootstrap_exe)" + $(MAKE) -C ../lisp autoloads EMACS="$(bootstrap_exe)" ## Dump an Emacs executable named bootstrap-emacs containing the ## files from loadup.el in source form. bootstrap-emacs$(EXEEXT): temacs$(EXEEXT) - cd ../lisp && $(MAKE) update-subdirs + $(MAKE) -C ../lisp update-subdirs if test "$(CANNOT_DUMP)" = "yes"; then \ rm -f bootstrap-emacs$(EXEEXT); \ ln temacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \ @@ -644,7 +643,7 @@ mv -f emacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \ fi @: Compile some files earlier to speed up further compilation. - cd ../lisp && $(MAKE) compile-first EMACS="$(bootstrap_exe)" + $(MAKE) -C ../lisp compile-first EMACS="$(bootstrap_exe)" ## Insert either autodeps.mk (if AUTO_DEPEND), else deps.mk. @deps_frag@ ------------------------------------------------------------ revno: 117336 committer: Glenn Morris branch nick: trunk timestamp: Sat 2014-06-14 17:17:21 -0700 message: Parallelize clean rules using GNU make features * Makefile.in: (submake_template): New definition. (mostlyclean_dirs, clean_dirs, distclean_dirs, maintainer_clean_dirs): New variables. (mostlyclean, clean, distclean, bootstrap-clean, maintainer-clean) (extraclean): Define using each subdirectory as a prequisite. * lib/Makefile.am (bootstrap-clean): * doc/emacs/Makefile.in (bootstrap-clean): * doc/lispintro/Makefile.in (bootstrap-clean): * doc/lispref/Makefile.in (bootstrap-clean): * doc/misc/Makefile.in (bootstrap-clean): * lib-src/Makefile.in (bootstrap-clean): * lwlib/Makefile.in (bootstrap-clean): * nextstep/Makefile.in (bootstrap-clean): * nt/Makefile.in (bootstrap-clean): * oldXMenu/Makefile.in (bootstrap-clean): New rules, for symmetry/simplicity. * lwlib/Makefile.in (mostlyclean, clean, distclean, maintainer-clean): * oldXMenu/Makefile.in (mostlyclean, clean, distclean, maintainer-clean, tags): Declare as PHONY. diff: === modified file 'ChangeLog' --- ChangeLog 2014-06-15 00:06:30 +0000 +++ ChangeLog 2014-06-15 00:17:21 +0000 @@ -1,3 +1,13 @@ +2014-06-15 Glenn Morris + + * Makefile.in: Parallelize clean rules using GNU make features. + (submake_template): New definition. + (mostlyclean_dirs, clean_dirs, distclean_dirs, maintainer_clean_dirs): + New variables. + (mostlyclean, clean, distclean, bootstrap-clean, maintainer-clean) + (extraclean): Define using each subdirectory as a prequisite. + * lib/Makefile.am (bootstrap-clean): New. + 2014-06-15 Paul Eggert Port part of the AIX fix to Solaris (Bug#17598). === modified file 'Makefile.in' --- Makefile.in 2014-06-13 23:05:00 +0000 +++ Makefile.in 2014-06-15 00:17:21 +0000 @@ -770,22 +770,27 @@ .PHONY: mostlyclean clean distclean bootstrap-clean maintainer-clean extraclean +## Eg: +## src_clean: +## make -C src clean +define submake_template +.PHONY: $(1)_$(2) +$(1)_$(2): + $$(MAKE) -C $(1) $(2) +endef + ### `mostlyclean' ### Like `clean', but may refrain from deleting a few files that people ### normally don't want to recompile. For example, the `mostlyclean' ### target for GCC does not delete `libgcc.a', because recompiling it ### is rarely necessary and takes a lot of time. -mostlyclean: - cd src && $(MAKE) mostlyclean - cd oldXMenu && $(MAKE) mostlyclean - cd lwlib && $(MAKE) mostlyclean - cd lib && $(MAKE) mostlyclean - cd lib-src && $(MAKE) mostlyclean - cd nt && $(MAKE) mostlyclean - -cd doc/emacs && $(MAKE) mostlyclean - -cd doc/misc && $(MAKE) mostlyclean - -cd doc/lispref && $(MAKE) mostlyclean - -cd doc/lispintro && $(MAKE) mostlyclean +mostlyclean_dirs = src oldXMenu lwlib lib lib-src nt doc/emacs doc/misc \ + doc/lispref doc/lispintro + +$(foreach dir,$(mostlyclean_dirs),$(eval $(call submake_template,$(dir),mostlyclean))) + +mostlyclean: $(mostlyclean_dirs:=_mostlyclean) + ### `clean' ### Delete all files from the current directory that are normally @@ -795,24 +800,18 @@ ### with them. ### ### Delete `.dvi' files here if they are not part of the distribution. -clean: +clean_dirs = $(mostlyclean_dirs) nextstep + +$(foreach dir,$(clean_dirs),$(eval $(call submake_template,$(dir),clean))) + +clean: $(clean_dirs:=_clean) -rm -f etc/emacs.tmpdesktop - cd src && $(MAKE) clean - cd oldXMenu && $(MAKE) clean - cd lwlib && $(MAKE) clean - cd lib && $(MAKE) clean - cd lib-src && $(MAKE) clean - cd nt && $(MAKE) clean - -cd doc/emacs && $(MAKE) clean - -cd doc/misc && $(MAKE) clean - -cd doc/lispref && $(MAKE) clean - -cd doc/lispintro && $(MAKE) clean - cd nextstep && $(MAKE) clean ### `bootclean' ### Delete all files that need to be remade for a clean bootstrap. top_bootclean=\ rm -f config.cache config.log + ### `distclean' ### Delete all files from the current directory that are created by ### configuring or building the program. If you have unpacked the @@ -822,44 +821,25 @@ top_distclean=\ ${top_bootclean}; \ rm -f config.status config.log~ Makefile stamp-h1 ${SUBDIR_MAKEFILES} -distclean: - cd src && $(MAKE) distclean - cd oldXMenu && $(MAKE) distclean - cd lwlib && $(MAKE) distclean - cd lib && $(MAKE) distclean - cd lib-src && $(MAKE) distclean - cd nt && $(MAKE) distclean - cd doc/emacs && $(MAKE) distclean - cd doc/misc && $(MAKE) distclean - cd doc/lispref && $(MAKE) distclean - cd doc/lispintro && $(MAKE) distclean - cd leim && $(MAKE) distclean - cd lisp && $(MAKE) distclean - cd nextstep && $(MAKE) distclean + +distclean_dirs = $(clean_dirs) leim lisp + +$(foreach dir,$(distclean_dirs),$(eval $(call submake_template,$(dir),distclean))) + +distclean: $(distclean_dirs:=_distclean) for dir in test/automated admin/grammars admin/unidata; do \ - [ ! -d $$dir ] || (cd $$dir && $(MAKE) distclean); \ + [ ! -d $$dir ] || $(MAKE) -C $$dir distclean; \ done ${top_distclean} ### `bootstrap-clean' ### Delete everything that can be reconstructed by `make' and that ### needs to be deleted in order to force a bootstrap from a clean state. -bootstrap-clean: - cd src && $(MAKE) bootstrap-clean - cd oldXMenu && $(MAKE) maintainer-clean - cd lwlib && $(MAKE) maintainer-clean - cd lib && $(MAKE) maintainer-clean - cd lib-src && $(MAKE) maintainer-clean - cd nt && $(MAKE) maintainer-clean - -cd doc/emacs && $(MAKE) maintainer-clean - -cd doc/misc && $(MAKE) maintainer-clean - -cd doc/lispref && $(MAKE) maintainer-clean - -cd doc/lispintro && $(MAKE) maintainer-clean - cd leim && $(MAKE) bootstrap-clean - cd lisp && $(MAKE) bootstrap-clean - cd nextstep && $(MAKE) maintainer-clean +$(foreach dir,$(distclean_dirs),$(eval $(call submake_template,$(dir),bootstrap-clean))) + +bootstrap-clean: $(distclean_dirs:=_bootstrap-clean) for dir in test/automated admin/grammars admin/unidata; do \ - [ ! -d $$dir ] || (cd $$dir && $(MAKE) bootstrap-clean); \ + [ ! -d $$dir ] || $(MAKE) -C $$dir bootstrap-clean; \ done [ ! -f config.log ] || mv -f config.log config.log~ rm -rf ${srcdir}/info @@ -879,12 +859,14 @@ top_maintainer_clean=\ ${top_distclean}; \ rm -fr autom4te.cache -maintainer-clean: bootstrap-clean - cd src && $(MAKE) maintainer-clean - cd leim && $(MAKE) maintainer-clean - cd lisp && $(MAKE) maintainer-clean + +maintainer_clean_dirs = src leim lisp + +$(foreach dir,$(maintainer_clean_dirs),$(eval $(call submake_template,$(dir),maintainer-clean))) + +maintainer-clean: bootstrap-clean $(maintainer_clean_dirs:=_maintainer-clean) for dir in test/automated admin/grammars admin/unidata; do \ - [ ! -d $$dir ] || (cd $$dir && $(MAKE) maintainer-clean); \ + [ ! -d $$dir ] || $(MAKE) -C $$dir maintainer-clean; \ done ${top_maintainer_clean} @@ -892,8 +874,12 @@ ### says GCC supports it, and that's where the configuration part of ### the coding standards seem to come from. It's like distclean, but ### it deletes backup and autosave files too. -extraclean: - for i in ${SUBDIR}; do (cd $$i; $(MAKE) extraclean); done +### Note that we abuse this in some subdirectories (eg leim), +### to delete some generated files that are slow to rebuild. +$(foreach dir,$(SUBDIR),$(eval $(call submake_template,$(dir),extraclean))) + +## FIXME this is busted because most of these do not have extraclean rules. +extraclean: $(SUBDIR:=_extraclean) ${top_maintainer_clean} -rm -f config-tmp-* -rm -f *~ \#* === modified file 'doc/emacs/ChangeLog' --- doc/emacs/ChangeLog 2014-06-10 02:11:38 +0000 +++ doc/emacs/ChangeLog 2014-06-15 00:17:21 +0000 @@ -1,3 +1,7 @@ +2014-06-15 Glenn Morris + + * Makefile.in (bootstrap-clean): New. + 2014-06-10 Glenn Morris * Makefile.in (INFO_EXT): Remove and replace by ".info" throughout. === modified file 'doc/emacs/Makefile.in' --- doc/emacs/Makefile.in 2014-06-10 02:11:38 +0000 +++ doc/emacs/Makefile.in 2014-06-15 00:17:21 +0000 @@ -181,7 +181,7 @@ emacs-xtra.pdf: $(EMACS_XTRA) $(ENVADD) $(TEXI2PDF) ${srcdir}/emacs-xtra.texi -.PHONY: mostlyclean clean distclean maintainer-clean infoclean +.PHONY: mostlyclean clean distclean bootstrap-clean maintainer-clean infoclean ## Temp files. mostlyclean: @@ -203,7 +203,7 @@ $(buildinfodir)/emacs.info-[1-9] \ $(buildinfodir)/emacs.info-[1-9][0-9] -maintainer-clean: distclean infoclean +bootstrap-clean maintainer-clean: distclean infoclean .PHONY: dist === modified file 'doc/lispintro/ChangeLog' --- doc/lispintro/ChangeLog 2014-06-10 02:11:38 +0000 +++ doc/lispintro/ChangeLog 2014-06-15 00:17:21 +0000 @@ -1,3 +1,7 @@ +2014-06-15 Glenn Morris + + * Makefile.in (bootstrap-clean): New. + 2014-06-10 Glenn Morris * Makefile.in (INFO_EXT): Remove and replace by ".info" throughout. === modified file 'doc/lispintro/Makefile.in' --- doc/lispintro/Makefile.in 2014-06-10 02:11:38 +0000 +++ doc/lispintro/Makefile.in 2014-06-15 00:17:21 +0000 @@ -101,7 +101,7 @@ emacs-lisp-intro.html: ${srcs} $(MAKEINFO) $(MAKEINFO_OPTS) $(HTML_OPTS) -o $@ ${srcdir}/emacs-lisp-intro.texi -.PHONY: mostlyclean clean distclean maintainer-clean infoclean +.PHONY: mostlyclean clean distclean bootstrap-clean maintainer-clean infoclean mostlyclean: rm -f *.aux *.log *.toc *.cp *.cps *.fn *.fns *.ky *.kys \ @@ -119,7 +119,7 @@ $(buildinfodir)/eintr.info \ $(buildinfodir)/eintr.info-[1-9] -maintainer-clean: distclean infoclean +bootstrap-clean maintainer-clean: distclean infoclean .PHONY: dist === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2014-06-15 00:06:30 +0000 +++ doc/lispref/ChangeLog 2014-06-15 00:17:21 +0000 @@ -1,3 +1,7 @@ +2014-06-15 Glenn Morris + + * Makefile.in (bootstrap-clean): New. + 2014-06-15 Eli Zaretskii * commands.texi (Accessing Mouse): Improve the wording of the === modified file 'doc/lispref/Makefile.in' --- doc/lispref/Makefile.in 2014-06-10 02:11:38 +0000 +++ doc/lispref/Makefile.in 2014-06-15 00:17:21 +0000 @@ -153,7 +153,7 @@ elisp.pdf: $(srcs) $(ENVADD) $(TEXI2PDF) $(srcdir)/elisp.texi -.PHONY: mostlyclean clean distclean maintainer-clean infoclean +.PHONY: mostlyclean clean distclean bootstrap-clean maintainer-clean infoclean ## [12] stuff is from two-volume.make. mostlyclean: @@ -175,7 +175,7 @@ $(buildinfodir)/elisp.info-[1-9] \ $(buildinfodir)/elisp.info-[1-9][0-9] -maintainer-clean: distclean infoclean +bootstrap-clean maintainer-clean: distclean infoclean .PHONY: dist === modified file 'doc/misc/ChangeLog' --- doc/misc/ChangeLog 2014-06-12 06:04:48 +0000 +++ doc/misc/ChangeLog 2014-06-15 00:17:21 +0000 @@ -1,3 +1,7 @@ +2014-06-15 Glenn Morris + + * Makefile.in (bootstrap-clean): New. + 2014-06-12 Vincent Belaïche * ses.texi: Adding documentation for SES local printer functions. === modified file 'doc/misc/Makefile.in' --- doc/misc/Makefile.in 2014-06-12 01:00:57 +0000 +++ doc/misc/Makefile.in 2014-06-15 00:17:21 +0000 @@ -209,7 +209,7 @@ ${buildinfodir}/tramp.info tramp.html: ${srcdir}/trampver.texi -.PHONY: mostlyclean clean distclean maintainer-clean +.PHONY: mostlyclean clean distclean bootstrap-clean maintainer-clean mostlyclean: rm -f *.aux *.log *.toc *.c[mp] *.c[mp]s *.fn *.fns \ @@ -235,7 +235,7 @@ $(buildinfodir)/$${file}-[1-9][0-9]; \ done -maintainer-clean: distclean infoclean +bootstrap-clean maintainer-clean: distclean infoclean dist: rm -rf emacs-misc-${version} === modified file 'lib-src/ChangeLog' --- lib-src/ChangeLog 2014-06-13 23:05:00 +0000 +++ lib-src/ChangeLog 2014-06-15 00:17:21 +0000 @@ -1,3 +1,7 @@ +2014-06-15 Glenn Morris + + * Makefile.in (bootstrap-clean): New. + 2014-06-13 Glenn Morris * Makefile.in (../lib/libgnu.a): === modified file 'lib-src/Makefile.in' --- lib-src/Makefile.in 2014-06-13 23:05:00 +0000 +++ lib-src/Makefile.in 2014-06-15 00:17:21 +0000 @@ -255,7 +255,7 @@ fi .PHONY: install uninstall mostlyclean clean distclean maintainer-clean -.PHONY: extraclean check tags +.PHONY: bootstrap-clean extraclean check tags install: $(DESTDIR)${archlibdir} @echo @@ -289,7 +289,7 @@ -rm -f TAGS -rm -f Makefile blessmail -maintainer-clean: distclean +bootstrap-clean maintainer-clean: distclean true extraclean: maintainer-clean === modified file 'lib/Makefile.am' --- lib/Makefile.am 2013-05-15 16:15:07 +0000 +++ lib/Makefile.am 2014-06-15 00:17:21 +0000 @@ -16,3 +16,7 @@ libgnu_a_SOURCES += openat-die.c save-cwd.c endif + +.PHONY: bootstrap-clean + +bootstrap-clean: maintainer-clean === modified file 'lwlib/ChangeLog' --- lwlib/ChangeLog 2014-06-13 23:05:00 +0000 +++ lwlib/ChangeLog 2014-06-15 00:17:21 +0000 @@ -1,3 +1,9 @@ +2014-06-15 Glenn Morris + + * Makefile.in (mostlyclean, clean, distclean, maintainer-clean): + Declare as PHONY. + (bootstrap-clean): New. + 2014-06-13 Glenn Morris * Makefile.in ($(globals_h)): === modified file 'lwlib/Makefile.in' --- lwlib/Makefile.in 2014-06-13 23:05:00 +0000 +++ lwlib/Makefile.in 2014-06-15 00:17:21 +0000 @@ -91,13 +91,16 @@ xlwmenu.o: $(src_h) xlwmenu.c xlwmenu.h lwlib.h xlwmenuP.h \ $(srcdir)/../src/xterm.h -mostlyclean: + +.PHONY: mostlyclean clean distclean bootstrap-clean maintainer-clean + +clean mostlyclean: rm -f *.o liblw.a \#* -clean: mostlyclean distclean: clean rm -f Makefile -maintainer-clean: distclean + +bootstrap-clean maintainer-clean: distclean rm -f TAGS === modified file 'nextstep/ChangeLog' --- nextstep/ChangeLog 2014-03-13 00:43:30 +0000 +++ nextstep/ChangeLog 2014-06-15 00:17:21 +0000 @@ -1,3 +1,7 @@ +2014-06-15 Glenn Morris + + * Makefile.in (bootstrap-clean): New. + 2014-03-13 Glenn Morris * templates/Info.plist.in: Make it strictly valid xml. (Bug#17002) === modified file 'nextstep/Makefile.in' --- nextstep/Makefile.in 2014-01-01 07:43:34 +0000 +++ nextstep/Makefile.in 2014-06-15 00:17:21 +0000 @@ -52,7 +52,7 @@ all: ${ns_appdir} ${ns_appbindir}/Emacs -.PHONY: clean distclean maintainer-clean +.PHONY: clean distclean bootstrap-clean maintainer-clean clean: rm -rf ${ns_appdir} @@ -64,6 +64,6 @@ Cocoa/Emacs.base/Contents/Info.plist \ Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings -maintainer-clean: distclean +bootstrap-clean maintainer-clean: distclean ### Makefile.in ends here === modified file 'nt/ChangeLog' --- nt/ChangeLog 2014-06-05 06:24:54 +0000 +++ nt/ChangeLog 2014-06-15 00:17:21 +0000 @@ -1,3 +1,7 @@ +2014-06-15 Glenn Morris + + * Makefile.in (bootstrap-clean): New. + 2014-06-05 Dmitry Antipov * inc/ms-w32.h (POLL_FOR_INPUT): Define with HAVE_WINDOW_SYSTEM. === modified file 'nt/Makefile.in' --- nt/Makefile.in 2014-05-29 19:16:32 +0000 +++ nt/Makefile.in 2014-06-15 00:17:21 +0000 @@ -162,7 +162,7 @@ fi .PHONY: install uninstall mostlyclean clean distclean maintainer-clean -.PHONY: extraclean check tags +.PHONY: bootstrap-clean extraclean check tags install: $(DESTDIR)${archlibdir} @echo @@ -193,7 +193,7 @@ -rm -f TAGS -rm -f Makefile -maintainer-clean: distclean +bootstrap-clean maintainer-clean: distclean true extraclean: maintainer-clean === modified file 'oldXMenu/ChangeLog' --- oldXMenu/ChangeLog 2014-01-15 03:06:07 +0000 +++ oldXMenu/ChangeLog 2014-06-15 00:17:21 +0000 @@ -1,3 +1,9 @@ +2014-06-15 Glenn Morris + + * Makefile.in (mostlyclean, clean, distclean, maintainer-clean, tags): + Declare as PHONY. + (boostrap-clean): New. + 2013-10-24 Glenn Morris * Makefile.in (abs_top_srcdir): New, set by configure. === modified file 'oldXMenu/Makefile.in' --- oldXMenu/Makefile.in 2014-01-01 07:43:34 +0000 +++ oldXMenu/Makefile.in 2014-06-15 00:17:21 +0000 @@ -134,14 +134,17 @@ XMakeAssoc.o: XMakeAssoc.c X10.h insque.o: insque.c -FRC.mostlyclean: -mostlyclean: FRC.mostlyclean +.PHONY: mostlyclean clean distclean bootstrap-clean maintainer-clean + +mostlyclean: rm -f libXMenu11.a ${OBJS} ${EXTRA} + clean: mostlyclean -distclean: clean + +boostrap-clean maintainer-clean distclean: clean rm -f Makefile -maintainer-clean: distclean +.PHONY: tags tags: $(TAGS) -t *.[ch] -.PHONY: tags + ------------------------------------------------------------ revno: 117335 [merge] committer: Glenn Morris branch nick: trunk timestamp: Sat 2014-06-14 17:06:30 -0700 message: Merge from emacs-24; up to r117245 diff: === modified file 'ChangeLog' --- ChangeLog 2014-06-13 23:05:00 +0000 +++ ChangeLog 2014-06-15 00:06:30 +0000 @@ -1,3 +1,11 @@ +2014-06-15 Paul Eggert + + Port part of the AIX fix to Solaris (Bug#17598). + * configure.ac (_REENTRANT): Define on Solaris if HAVE_PTHREAD. + This ports part of the recent AIX fixes to Solaris. It is needed + for the same reason that _THREAD_SAFE is needed on AIX, e.g., to + make sure that each thread has its own 'errno'. + 2014-06-13 Glenn Morris * Makefile.in (CC, CFLAGS, LDFLAGS, CPPFLAGS, abs_top_srcdir): === modified file 'configure.ac' --- configure.ac 2014-06-11 17:51:27 +0000 +++ configure.ac 2014-06-15 00:06:30 +0000 @@ -2091,11 +2091,15 @@ # Some systems optimize for single-threaded programs by default, and # need special flags to disable these optimizations. For example, the # definition of 'errno' in . - if test "$opsys" = aix4-2; then - AC_DEFINE([_THREAD_SAFE], [1], - [Define to 1 if your system requires this in multithreaded code.]) - fi]) - if test "X$LIBS" != "X$OLD_LIBS"; then + case $opsys in + sol*) + AC_DEFINE([_REENTRANT], 1, + [Define to 1 if your system requires this in multithreaded code.]);; + aix4-2) + AC_DEFINE([_THREAD_SAFE], 1, + [Define to 1 if your system requires this in multithreaded code.]);; + esac]) + if test "X$LIBS" != "X$OLD_LIBS"; then eval LIB_PTHREAD=\$ac_cv_search_$emacs_pthread_function fi LIBS=$OLD_LIBS === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2014-06-10 02:11:38 +0000 +++ doc/lispref/ChangeLog 2014-06-15 00:06:30 +0000 @@ -1,3 +1,8 @@ +2014-06-15 Eli Zaretskii + + * commands.texi (Accessing Mouse): Improve the wording of the + posn-col-row documentation. (Bug#17768) + 2014-06-10 Glenn Morris * Makefile.in (INFO_EXT): Remove and replace by ".info" throughout. === modified file 'doc/lispref/commands.texi' --- doc/lispref/commands.texi 2014-06-07 14:29:48 +0000 +++ doc/lispref/commands.texi 2014-06-15 00:06:30 +0000 @@ -2053,23 +2053,24 @@ @defun posn-col-row position This function returns a cons cell @code{(@var{col} . @var{row})}, containing the estimated column and row corresponding to buffer -position @var{position}. The return value is given in units of the -frame's default character width and height, as computed from the -@var{x} and @var{y} values corresponding to @var{position}. (So, if -the actual characters have non-default sizes, the actual row and -column may differ from these computed values.) +position in @var{position}. The return value is given in units of the +frame's default character width and default line height (including +spacing), as computed from the @var{x} and @var{y} values +corresponding to @var{position}. (So, if the actual characters have +non-default sizes, the actual row and column may differ from these +computed values.) Note that @var{row} is counted from the top of the text area. If the -window possesses a header line (@pxref{Header Lines}), it is -@emph{not} counted as the first line. +window given by @var{position} possesses a header line (@pxref{Header +Lines}), it is @emph{not} included in the @var{row} count. @end defun @defun posn-actual-col-row position Return the actual row and column in @var{position}, as a cons cell @code{(@var{col} . @var{row})}. The values are the actual row and -column numbers in the window. @xref{Click Events}, for details. It -returns @code{nil} if @var{position} does not include actual positions -values. +column numbers in the window given by @var{position}. @xref{Click +Events}, for details. The function returns @code{nil} if +@var{position} does not include actual position values. @end defun @defun posn-string position === modified file 'etc/NEWS' --- etc/NEWS 2014-06-13 18:09:06 +0000 +++ etc/NEWS 2014-06-15 00:06:30 +0000 @@ -309,16 +309,7 @@ *** The function `quail-help' is no longer an interactive command. Use `C-h C-\' (`describe-input-method') instead. -** ImageMagick - -*** ImageMagick images now support the :max-width and :max-height keywords. - -*** When using `create-image' with image data, you can pass a :format -attribute (via the property-list argument) in order to help -ImageMagick detect the image type. The value should be a MIME -content-type that is found in the new variable `image-format-suffixes'. - -** Frame and window changes +** Frame and window handling *** New commands `toggle-frame-fullscreen' and `toggle-frame-maximized', bound to and M-, respectively. @@ -416,7 +407,7 @@ caller of `display-buffer' is ready to handle the case of not displaying the buffer in a window. -** Lisp evaluation changes +** Lisp evaluation *** `eval-defun' on an already defined defcustom calls the :set function, if there is one. @@ -450,7 +441,7 @@ * Editing Changes in Emacs 24.4 -** Indentation changes +** Indentation *** `electric-indent-mode' is now enabled by default. Typing RET reindents the current line and indents the new line. @@ -708,8 +699,7 @@ *** New option `hi-lock-auto-select-face'. When non-nil, hi-lock commands will cycle through faces in `hi-lock-face-defaults' without prompting. -** Icomplete -Icomplete is now more similar to Ido. +** Icomplete is now more similar to Ido. *** Icomplete by default now applies to all forms of minibuffer completion. The variable `icomplete-with-completion-tables' (now a user option) @@ -1066,8 +1056,8 @@ * New Modes and Packages in Emacs 24.4 -** New package `eww' is a built-in web browser. -(It is only available if Emacs is compiled with libxml2 support.) +** New package eww.el provides a built-in web browser. +This requires Emacs to have been compiled with libxml2 support. ** New package nadvice.el offers lighter-weight advice facilities. It is layered as: @@ -1078,11 +1068,10 @@ *** `advice-add'/`advice-remove' to add/remove a piece of advice on a named function, much like `defadvice' does. -** New package frameset.el. -It provides a set of operations to save a frameset (the state of all -or a subset of the existing frames and windows, somewhat similar to a -frame configuration), both in-session and persistently, and restore it -at some point in the future. +** New package frameset.el provides a set of operations to save a frameset +(the state of all or a subset of the existing frames and windows, somewhat +similar to a frame configuration), both in-session and persistently, and +restore it at some point in the future. ** New package filenotify.el provides an interface for file system notifications. It requires that Emacs be compiled with one of the @@ -1092,9 +1081,9 @@ display specified symbols as composed characters. E.g., in Emacs Lisp mode, this replaces the string "lambda" with the Greek lambda character. -** New minor mode `superword-mode'. -This overrides the default word motion commands to treat "symbol_words" -as a single word, similar to what `subword-mode' does. +** New minor mode `superword-mode', which overrides the default word motion +commands to treat "symbol_words" as a single word, similar to what +`subword-mode' does. * Incompatible Lisp Changes in Emacs 24.4 @@ -1332,6 +1321,15 @@ *** New functions `image-current-frame' and `image-show-frame' for getting and setting the current frame of a multi-frame image. +** ImageMagick + +*** ImageMagick images now support the :max-width and :max-height keywords. + +*** When using `create-image' with image data, you can pass a :format +attribute (via the property-list argument) in order to help +ImageMagick detect the image type. The value should be a MIME +content-type that is found in the new variable `image-format-suffixes'. + ** Revert and Autorevert *** If Emacs is compiled with file notification support, it uses notifications === modified file 'etc/PROBLEMS' --- etc/PROBLEMS 2014-05-16 15:49:13 +0000 +++ etc/PROBLEMS 2014-06-15 00:06:30 +0000 @@ -159,7 +159,6 @@ be fixed in ImageMagick 6.8.3-10. See . ** Crashes when displaying GIF images in Emacs built with version - libungif-4.1.0 are resolved by using version libungif-4.1.0b1. Configure checks for the correct version, but this problem could occur if a binary built against a shared libungif is run on a system with an === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-06-14 20:57:34 +0000 +++ lisp/ChangeLog 2014-06-15 00:06:30 +0000 @@ -1,6 +1,31 @@ -2014-06-14 Ron Schnell +2014-06-15 Glenn Morris + + * progmodes/cc-langs.el: Require cl-lib. (Bug#17463) + Replace delete-duplicates and mapcan by cl- versions throughout. + And cl-macroexpand-all by macroexpand-all. + (delete-duplicates, mapcan, cl-macroexpand-all): No need to declare. + +2014-06-15 Eli Zaretskii + + * subr.el (posn-col-row): Doc fix. (Bug#17768) + +2014-06-15 Juri Linkov + + * bindings.el: Put `ascii-character' property on keypad keys + mapped to characters. (Bug#17759) + +2014-06-15 Stefan Monnier + + * emacs-lisp/smie.el (smie-next-sexp): Fix up "other-end" info when + bumping forward into a closing paren (bug#17761). + + * term/xterm.el (xterm--version-handler): Work around for OSX + Terminal.app (bug#17607). + +2014-06-14 Ron Schnell + * play/dunnet.el If a lamp is in the room, you won't be eaten by a grue. - + 2014-06-13 Glenn Morris * Makefile.in ($(lisp)/cus-load.el, $(lisp)/finder-inf.el) === modified file 'lisp/bindings.el' --- lisp/bindings.el 2014-03-20 17:14:45 +0000 +++ lisp/bindings.el 2014-06-14 09:50:13 +0000 @@ -1075,10 +1075,14 @@ (kp-5 ?5) (kp-6 ?6) (kp-7 ?7) (kp-8 ?8) (kp-9 ?9) (kp-add ?+) (kp-subtract ?-) (kp-multiply ?*) (kp-divide ?/)))) (dolist (pair keys) - (dolist (mod modifiers) - (define-key function-key-map - (vector (append mod (list (nth 0 pair)))) - (vector (append mod (list (nth 1 pair)))))))) + (let ((keypad (nth 0 pair)) + (normal (nth 1 pair))) + (when (characterp normal) + (put keypad 'ascii-character normal)) + (dolist (mod modifiers) + (define-key function-key-map + (vector (append mod (list keypad))) + (vector (append mod (list normal)))))))) (define-key function-key-map [backspace] [?\C-?]) (define-key function-key-map [delete] [?\C-?]) === modified file 'lisp/emacs-lisp/smie.el' --- lisp/emacs-lisp/smie.el 2014-03-04 08:35:11 +0000 +++ lisp/emacs-lisp/smie.el 2014-06-13 15:31:17 +0000 @@ -709,7 +709,8 @@ (condition-case err (progn (funcall next-sexp 1) nil) (scan-error - (let ((epos (nth 2 err))) + (let* ((epos1 (nth 2 err)) + (epos (if (<= (point) epos1) (nth 3 err) epos1))) (goto-char pos) (throw 'return (list t epos @@ -1832,6 +1833,8 @@ (append smie-blink-matching-triggers (delete-dups triggers))))))) +(declare-function edebug-instrument-function "edebug" (func)) + (defun smie-edebug () "Instrument the `smie-rules-function' for Edebug." (interactive) === modified file 'lisp/progmodes/cc-langs.el' --- lisp/progmodes/cc-langs.el 2014-01-01 07:43:34 +0000 +++ lisp/progmodes/cc-langs.el 2014-06-14 23:54:39 +0000 @@ -130,7 +130,9 @@ ;; This file is not always loaded. See note above. -(cc-external-require 'cl) +;; Except it is always loaded - see bug#17463. +;;;(cc-external-require 'cl) +(require 'cl-lib) ;;; Setup for the `c-lang-defvar' system. @@ -209,9 +211,9 @@ ;; Suppress "might not be defined at runtime" warning. ;; This file is only used when compiling other cc files. ;; These are defined in cl as aliases to the cl- versions. -(declare-function delete-duplicates "cl-seq" (cl-seq &rest cl-keys) t) -(declare-function mapcan "cl-extra" (cl-func cl-seq &rest cl-rest) t) -(declare-function cl-macroexpand-all "cl" (form &optional env)) +;(declare-function delete-duplicates "cl-seq" (cl-seq &rest cl-keys) t) +;(declare-function mapcan "cl-extra" (cl-func cl-seq &rest cl-rest) t) +;(declare-function cl-macroexpand-all "cl" (form &optional env)) (eval-and-compile ;; Some helper functions used when building the language constants. @@ -252,14 +254,14 @@ (unless xlate (setq xlate 'identity)) (c-with-syntax-table (c-lang-const c-mode-syntax-table) - (delete-duplicates - (mapcan (lambda (opgroup) + (cl-delete-duplicates + (cl-mapcan (lambda (opgroup) (when (if (symbolp (car opgroup)) (when (funcall opgroup-filter (car opgroup)) (setq opgroup (cdr opgroup)) t) t) - (mapcan (lambda (op) + (cl-mapcan (lambda (op) (when (funcall op-filter op) (let ((res (funcall xlate op))) (if (listp res) res (list res))))) @@ -1147,7 +1149,7 @@ (c-lang-defconst c-all-op-syntax-tokens ;; List of all tokens in the punctuation and parenthesis syntax ;; classes. - t (delete-duplicates (append (c-lang-const c-other-op-syntax-tokens) + t (cl-delete-duplicates (append (c-lang-const c-other-op-syntax-tokens) (c-lang-const c-operator-list)) :test 'string-equal)) @@ -1700,7 +1702,7 @@ (c-lang-defconst c-type-start-kwds ;; All keywords that can start a type (i.e. are either a type prefix ;; or a complete type). - t (delete-duplicates (append (c-lang-const c-primitive-type-kwds) + t (cl-delete-duplicates (append (c-lang-const c-primitive-type-kwds) (c-lang-const c-type-prefix-kwds) (c-lang-const c-type-modifier-kwds)) :test 'string-equal)) @@ -1943,7 +1945,7 @@ ;; something is a type or just some sort of macro in front of the ;; declaration. They might be ambiguous with types or type ;; prefixes. - t (delete-duplicates (append (c-lang-const c-class-decl-kwds) + t (cl-delete-duplicates (append (c-lang-const c-class-decl-kwds) (c-lang-const c-brace-list-decl-kwds) (c-lang-const c-other-block-decl-kwds) (c-lang-const c-typedef-decl-kwds) @@ -2136,7 +2138,7 @@ pike '("array" "function" "int" "mapping" "multiset" "object" "program")) (c-lang-defconst c-paren-any-kwds - t (delete-duplicates (append (c-lang-const c-paren-nontype-kwds) + t (cl-delete-duplicates (append (c-lang-const c-paren-nontype-kwds) (c-lang-const c-paren-type-kwds)) :test 'string-equal)) @@ -2162,7 +2164,7 @@ (c-lang-defconst c-<>-sexp-kwds ;; All keywords that can be followed by an angle bracket sexp. - t (delete-duplicates (append (c-lang-const c-<>-type-kwds) + t (cl-delete-duplicates (append (c-lang-const c-<>-type-kwds) (c-lang-const c-<>-arglist-kwds)) :test 'string-equal)) @@ -2222,7 +2224,7 @@ (c-lang-defconst c-block-stmt-kwds ;; Union of `c-block-stmt-1-kwds' and `c-block-stmt-2-kwds'. - t (delete-duplicates (append (c-lang-const c-block-stmt-1-kwds) + t (cl-delete-duplicates (append (c-lang-const c-block-stmt-1-kwds) (c-lang-const c-block-stmt-2-kwds)) :test 'string-equal)) @@ -2326,7 +2328,7 @@ (c-lang-defconst c-expr-kwds ;; Keywords that can occur anywhere in expressions. Built from ;; `c-primary-expr-kwds' and all keyword operators in `c-operators'. - t (delete-duplicates + t (cl-delete-duplicates (append (c-lang-const c-primary-expr-kwds) (c-filter-ops (c-lang-const c-operator-list) t @@ -2430,7 +2432,7 @@ (c-lang-defconst c-keywords ;; All keywords as a list. - t (delete-duplicates + t (cl-delete-duplicates (c-lang-defconst-eval-immediately `(append ,@(mapcar (lambda (kwds-lang-const) `(c-lang-const ,kwds-lang-const)) @@ -3193,10 +3195,10 @@ ;; `c-lang-const' will expand to the evaluated ;; constant immediately in `cl-macroexpand-all' ;; below. - (mapcan + (cl-mapcan (lambda (init) `(current-var ',(car init) - ,(car init) ,(cl-macroexpand-all + ,(car init) ,(macroexpand-all (elt init 1)))) ;; Note: The following `append' copies the ;; first argument. That list is small, so === modified file 'lisp/subr.el' --- lisp/subr.el 2014-06-02 00:18:22 +0000 +++ lisp/subr.el 2014-06-15 00:06:30 +0000 @@ -1127,7 +1127,7 @@ "Return the nominal column and row in POSITION, measured in characters. The column and row values are approximations calculated from the x and y coordinates in POSITION and the frame's default character width -and height. +and default line height, including spacing. For a scroll-bar event, the result column is 0, and the row corresponds to the vertical position of the click in the scroll bar. POSITION should be a list of the form returned by the `event-start' === modified file 'lisp/term/xterm.el' --- lisp/term/xterm.el 2014-05-25 08:08:24 +0000 +++ lisp/term/xterm.el 2014-06-15 00:06:30 +0000 @@ -605,6 +605,10 @@ ;; Gnome terminal 3.6.1 reports 1;3406;0 ;; Gnome terminal 2.32.1 reports 1;2802;0 (setq version 200)) + (when (equal (match-string 1 str) "83") + ;; OSX's Terminal.app (version 2.3 (309), which returns 83;40003;0) + ;; seems to also lack support for some of these (bug#17607). + (setq version 240)) ;; If version is 242 or higher, assume the xterm supports ;; reporting the background color (TODO: maybe earlier ;; versions do too...) === modified file 'src/ChangeLog' --- src/ChangeLog 2014-06-13 23:05:00 +0000 +++ src/ChangeLog 2014-06-15 00:06:30 +0000 @@ -1,3 +1,13 @@ +2014-06-15 Eli Zaretskii + + * xdisp.c (Fmove_point_visually): Don't use the glyph matrix + information if we are in the middle of executing a keyboard macro, + since redisplay doesn't update the screen until the macro is + finished. (Bug#17777) + + * alloc.c (cleanup_vector): Don't dereference a font driver + pointer if it is NULL. (Bug#17771) + 2014-06-13 Glenn Morris * Makefile.in ($(leimdir)/leim-list.el, $(srcdir)/macuvs.h) === modified file 'src/alloc.c' --- src/alloc.c 2014-06-11 17:54:07 +0000 +++ src/alloc.c 2014-06-15 00:06:30 +0000 @@ -2974,9 +2974,16 @@ && ((vector->header.size & PSEUDOVECTOR_SIZE_MASK) == FONT_OBJECT_MAX)) { - /* Attempt to catch subtle bugs like Bug#16140. */ - eassert (valid_font_driver (((struct font *) vector)->driver)); - ((struct font *) vector)->driver->close ((struct font *) vector); + struct font_driver *drv = ((struct font *) vector)->driver; + + /* The font driver might sometimes be NULL, e.g. if Emacs was + interrupted before it had time to set it up. */ + if (drv) + { + /* Attempt to catch subtle bugs like Bug#16140. */ + eassert (valid_font_driver (drv)); + drv->close ((struct font *) vector); + } } } === modified file 'src/xdisp.c' --- src/xdisp.c 2014-06-11 19:33:14 +0000 +++ src/xdisp.c 2014-06-15 00:06:30 +0000 @@ -98,7 +98,9 @@ This function attempts to redisplay a window by reusing parts of its existing display. It finds and reuses the part that was not - changed, and redraws the rest. + changed, and redraws the rest. (The "id" part in the function's + name stands for "insert/delete", not for "identification" or + somesuch.) . try_window @@ -113,6 +115,19 @@ optimizations were successful, redisplay calls redisplay_windows, which performs a full redisplay of all windows. + Note that there's one more important optimization up Emacs's + sleeve, but it is related to actually redrawing the potentially + changed portions of the window/frame, not to reproducing the + desired matrices of those potentially changed portions. Namely, + the function update_frame and its subroutines, which you will find + in dispnew.c, compare the desired matrices with the current + matrices, and only redraw the portions that changed. So it could + happen that the functions in this file for some reason decide that + the entire desired matrix needs to be regenerated from scratch, and + still only parts of the Emacs display, or even nothing at all, will + be actually delivered to the glass, because update_frame has found + that the new and the old screen contents are similar or identical. + Desired matrices. Desired matrices are always built per Emacs window. The function @@ -15746,7 +15761,51 @@ selected_window is redisplayed. We can return without actually redisplaying the window if fonts has been - changed on window's frame. In that case, redisplay_internal will retry. */ + changed on window's frame. In that case, redisplay_internal will retry. + + As one of the important parts of redisplaying a window, we need to + decide whether the previous window-start position (stored in the + window's w->start marker position) is still valid, and if it isn't, + recompute it. Some details about that: + + . The previous window-start could be in a continuation line, in + which case we need to recompute it when the window width + changes. See compute_window_start_on_continuation_line and its + call below. + + . The text that changed since last redisplay could include the + previous window-start position. In that case, we try to salvage + what we can from the current glyph matrix by calling + try_scrolling, which see. + + . Some Emacs command could force us to use a specific window-start + position by setting the window's force_start flag, or gently + propose doing that by setting the window's optional_new_start + flag. In these cases, we try using the specified start point if + that succeeds (i.e. the window desired matrix is successfully + recomputed, and point location is within the window). In case + of optional_new_start, we first check if the specified start + position is feasible, i.e. if it will allow point to be + displayed in the window. If using the specified start point + fails, e.g., if new fonts are needed to be loaded, we abort the + redisplay cycle and leave it up to the next cycle to figure out + things. + + . Note that the window's force_start flag is sometimes set by + redisplay itself, when it decides that the previous window start + point is fine and should be kept. Search for "goto force_start" + below to see the details. Like the values of window-start + specified outside of redisply, these internally deduced values + are tested for feasibility, and ignored if found to be + unfeasible. + + . Note that the function try_window, used to completely redisplay + a window, accepts the window's start point as its argument. + This is used several times in the redisplay code to control + where the window start will be, according to user options such + as scroll-conservatively, and also to ensure the screen line + showing point will be fully (as opposed to partially) visible on + display. */ static void redisplay_window (Lisp_Object window, bool just_this_one_p) @@ -15792,6 +15851,8 @@ eassert (XMARKER (w->start)->buffer == buffer); eassert (XMARKER (w->pointm)->buffer == buffer); + /* We come here again if we need to run window-text-change-functions + below. */ restart: reconsider_clip_changes (w); frame_line_height = default_line_pixel_height (w); @@ -15856,7 +15917,7 @@ && !current_buffer->prevent_redisplay_optimizations_p && !window_outdated (w)); - /* Run the window-bottom-change-functions + /* Run the window-text-change-functions if it is possible that the text on the screen has changed (either due to modification of the text, or any other reason). */ if (!current_matrix_up_to_date_p @@ -20685,6 +20746,7 @@ recorded in the glyphs, at least as long as the goal is on the screen. */ if (w->window_end_valid + && NILP (Vexecuting_kbd_macro) && !windows_or_buffers_changed && b && !b->clip_changed ------------------------------------------------------------ revno: 117334 committer: Ron Schnell branch nick: trunk timestamp: Sat 2014-06-14 16:57:34 -0400 message: Changed Dunnet so that if a lamp is in the room that would otherwise be dark, the player will not be eaten by a grue. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-06-13 23:05:00 +0000 +++ lisp/ChangeLog 2014-06-14 20:57:34 +0000 @@ -1,3 +1,6 @@ +2014-06-14 Ron Schnell + * play/dunnet.el If a lamp is in the room, you won't be eaten by a grue. + 2014-06-13 Glenn Morris * Makefile.in ($(lisp)/cus-load.el, $(lisp)/finder-inf.el) === modified file 'lisp/play/dunnet.el' --- lisp/play/dunnet.el 2014-01-01 07:43:34 +0000 +++ lisp/play/dunnet.el 2014-06-14 20:57:34 +0000 @@ -100,7 +100,8 @@ (defun dun-describe-room (room) (if (and (not (member (abs room) dun-light-rooms)) - (not (member obj-lamp dun-inventory))) + (not (member obj-lamp dun-inventory)) + (not (member obj-lamp (nth dun-current-room dun-room-objects)))) (dun-mprincl "It is pitch dark. You are likely to be eaten by a grue.") (dun-mprincl (cadr (nth (abs room) dun-rooms))) (if (and (and (or (member room dun-visited) @@ -615,7 +616,8 @@ (defun dun-move (dir) (if (and (not (member dun-current-room dun-light-rooms)) - (not (member obj-lamp dun-inventory))) + (not (member obj-lamp dun-inventory)) + (not (member obj-lamp (nth dun-current-room dun-room-objects)))) (progn (dun-mprinc "You trip over a grue and fall into a pit and break every bone in your ------------------------------------------------------------ revno: 117333 committer: Glenn Morris branch nick: trunk timestamp: Fri 2014-06-13 19:05:00 -0400 message: With GNU make, MFLAGS is not needed * Makefile.in (CC, CFLAGS, LDFLAGS, CPPFLAGS, abs_top_srcdir): Remove, no longer used. (lib, lib-src, lisp, nt, src, blessmail, install-arch-dep) (install-nt, install-strip, uninstall, uninstall-nt) (mostlyclean, clean, distclean, bootstrap-clean) (maintainer-clean, extraclean, TAGS, tags, check, $(DOCS)): ($(INSTALL_DOC), $(UNINSTALL_DOC), info, bootstrap, check-declare): GNU make automatically passes command-line arguments to sub-makes. * admin/unidata/Makefile.in (${DSTDIR}/charprop.el): GNU make automatically passes command-line arguments to sub-makes. * lib-src/Makefile.in (../lib/libgnu.a): GNU make automatically passes command-line arguments to sub-makes. * lisp/Makefile.in ($(lisp)/cus-load.el, $(lisp)/finder-inf.el) (autoloads, $(lisp)/subdirs.el, compile-main, leim, semantic, compile) (compile-always): GNU make automatically passes command-line arguments to sub-makes. * lwlib/Makefile.in ($(globals_h)): GNU make automatically passes command-line arguments to sub-makes. * src/Makefile.in ($(leimdir)/leim-list.el, $(srcdir)/macuvs.h) ($(lispsource)/international/charprop.el) ($(libsrc)/make-docfile$(EXEEXT), $(lwlibdir)/liblw.a) ($(oldXMenudir)/libXMenu11.a, ns-app, .el.elc) ($(lispsource)/loaddefs.el, bootstrap-emacs$(EXEEXT)): GNU make automatically passes command-line arguments to sub-makes. * test/automated/Makefile.in (compile-main): GNU make automatically passes command-line arguments to sub-makes. diff: === modified file 'ChangeLog' --- ChangeLog 2014-06-11 17:51:27 +0000 +++ ChangeLog 2014-06-13 23:05:00 +0000 @@ -1,3 +1,14 @@ +2014-06-13 Glenn Morris + + * Makefile.in (CC, CFLAGS, LDFLAGS, CPPFLAGS, abs_top_srcdir): + Remove, no longer used. + (lib, lib-src, lisp, nt, src, blessmail, install-arch-dep) + (install-nt, install-strip, uninstall, uninstall-nt) + (mostlyclean, clean, distclean, bootstrap-clean) + (maintainer-clean, extraclean, TAGS, tags, check, $(DOCS)): + ($(INSTALL_DOC), $(UNINSTALL_DOC), info, bootstrap, check-declare): + GNU make automatically passes command-line arguments to sub-makes. + 2014-06-11 Paul Eggert Use a shell function in configure.ac to cut down on code duplication. === modified file 'Makefile.in' --- Makefile.in 2014-06-10 02:15:49 +0000 +++ Makefile.in 2014-06-13 23:05:00 +0000 @@ -81,10 +81,6 @@ AUTOHEADER = @AUTOHEADER@ ACLOCAL = @ACLOCAL@ -CC=@CC@ -CFLAGS=@CFLAGS@ -LDFLAGS=@LDFLAGS@ -CPPFLAGS=@CPPFLAGS@ EXEEXT=@EXEEXT@ ### These help us choose version- and architecture-specific directories @@ -170,8 +166,6 @@ # We use $(srcdir) explicitly in dependencies so as not to depend on VPATH. srcdir=@srcdir@ abs_srcdir=@abs_srcdir@ -# MinGW CPPFLAGS may use this. -abs_top_srcdir=@abs_top_srcdir@ # Where the manpage source files are kept. mansrcdir=$(srcdir)/doc/man @@ -364,9 +358,7 @@ # These targets should be "${SUBDIR} without `src'". lib lib-src lisp nt: Makefile - cd $@ && $(MAKE) all $(MFLAGS) \ - CC='${CC}' CFLAGS='${CFLAGS}' CPPFLAGS='${CPPFLAGS}' \ - LDFLAGS='${LDFLAGS}' MAKE='${MAKE}' + cd $@ && $(MAKE) all # Pass to src/Makefile.in an additional BOOTSTRAPEMACS variable which # is either set to bootstrap-emacs (in case bootstrap-emacs has not been @@ -389,14 +381,10 @@ cd $@ || exit; \ boot=bootstrap-emacs$(EXEEXT); \ [ ! -x "$$boot" ] || boot=''; \ - $(MAKE) all $(MFLAGS) \ - CC='${CC}' CFLAGS='${CFLAGS}' CPPFLAGS='${CPPFLAGS}' \ - LDFLAGS='${LDFLAGS}' MAKE='${MAKE}' BOOTSTRAPEMACS="$$boot" \ - VCSWITNESS="$$vcswitness" + $(MAKE) all BOOTSTRAPEMACS="$$boot" VCSWITNESS="$$vcswitness" blessmail: Makefile src - cd lib-src && $(MAKE) maybe-blessmail $(MFLAGS) \ - MAKE='${MAKE}' archlibdir='$(archlibdir)' + cd lib-src && $(MAKE) maybe-blessmail # We used to have one rule per */Makefile.in, but that leads to race # conditions with parallel makes, so let's assume that the time stamp on @@ -489,11 +477,7 @@ ### Lisp files and DOC file to work properly. install-arch-dep: src install-arch-indep install-etcdoc install-$(NTDIR) umask 022; ${MKDIR_P} "$(DESTDIR)${bindir}" - cd lib-src && \ - $(MAKE) install $(MFLAGS) prefix="${prefix}" \ - exec_prefix="${exec_prefix}" bindir="${bindir}" \ - libexecdir="${libexecdir}" archlibdir="${archlibdir}" \ - INSTALL_STRIP=${INSTALL_STRIP} + cd lib-src && $(MAKE) install if test "${ns_self_contained}" = "no"; then \ ${INSTALL_PROGRAM} $(INSTALL_STRIP) src/emacs${EXEEXT} "$(DESTDIR)${bindir}/$(EMACSFULL)" || exit 1 ; \ chmod 1755 "$(DESTDIR)${bindir}/$(EMACSFULL)" || true; \ @@ -511,12 +495,7 @@ ### in nt/, and its Posix do-nothing shadow. install-: install-nt: - cd $(NTDIR) && \ - $(MAKE) install $(MFLAGS) prefix="${prefix}" \ - exec_prefix="${exec_prefix}" bindir="${bindir}" \ - libexecdir="${libexecdir}" archlibdir="${archlibdir}" \ - datadir="${datadir}" \ - INSTALL_STRIP=${INSTALL_STRIP} + cd $(NTDIR) && $(MAKE) install ## In the share directory, we are deleting: ## applications (with emacs.desktop, also found in etc/) @@ -729,19 +708,14 @@ ### Build Emacs and install it, stripping binaries while installing them. install-strip: - $(MAKE) $(MFLAGS) INSTALL_STRIP=-s install + $(MAKE) INSTALL_STRIP=-s install ### Delete all the installed files that the `install' target would ### create (but not the noninstalled files such as `make all' would create). ### ### Don't delete the lisp and etc directories if they're in the source tree. uninstall: uninstall-$(NTDIR) uninstall-doc - cd lib-src && \ - $(MAKE) $(MFLAGS) uninstall \ - prefix="${prefix}" exec_prefix="${exec_prefix}" \ - bindir="${bindir}" libexecdir="${libexecdir}" \ - archlibdir="${archlibdir}" - + cd lib-src && $(MAKE) uninstall -unset CDPATH; \ for dir in "$(DESTDIR)${lispdir}" "$(DESTDIR)${etcdir}" ; do \ if [ -d "$${dir}" ]; then \ @@ -790,11 +764,7 @@ ### in nt/, and its Posix do-nothing shadow. uninstall-: uninstall-nt: - cd $(NTDIR) && \ - $(MAKE) $(MFLAGS) uninstall \ - prefix="${prefix}" exec_prefix="${exec_prefix}" \ - bindir="${bindir}" libexecdir="${libexecdir}" \ - archlibdir="${archlibdir}" + cd $(NTDIR) && $(MAKE) uninstall # ==================== Cleaning up and miscellanea ==================== @@ -806,16 +776,16 @@ ### target for GCC does not delete `libgcc.a', because recompiling it ### is rarely necessary and takes a lot of time. mostlyclean: - cd src && $(MAKE) $(MFLAGS) mostlyclean - cd oldXMenu && $(MAKE) $(MFLAGS) mostlyclean - cd lwlib && $(MAKE) $(MFLAGS) mostlyclean - cd lib && $(MAKE) $(MFLAGS) mostlyclean - cd lib-src && $(MAKE) $(MFLAGS) mostlyclean - cd nt && $(MAKE) $(MFLAGS) mostlyclean - -cd doc/emacs && $(MAKE) $(MFLAGS) mostlyclean - -cd doc/misc && $(MAKE) $(MFLAGS) mostlyclean - -cd doc/lispref && $(MAKE) $(MFLAGS) mostlyclean - -cd doc/lispintro && $(MAKE) $(MFLAGS) mostlyclean + cd src && $(MAKE) mostlyclean + cd oldXMenu && $(MAKE) mostlyclean + cd lwlib && $(MAKE) mostlyclean + cd lib && $(MAKE) mostlyclean + cd lib-src && $(MAKE) mostlyclean + cd nt && $(MAKE) mostlyclean + -cd doc/emacs && $(MAKE) mostlyclean + -cd doc/misc && $(MAKE) mostlyclean + -cd doc/lispref && $(MAKE) mostlyclean + -cd doc/lispintro && $(MAKE) mostlyclean ### `clean' ### Delete all files from the current directory that are normally @@ -827,17 +797,17 @@ ### Delete `.dvi' files here if they are not part of the distribution. clean: -rm -f etc/emacs.tmpdesktop - cd src && $(MAKE) $(MFLAGS) clean - cd oldXMenu && $(MAKE) $(MFLAGS) clean - cd lwlib && $(MAKE) $(MFLAGS) clean - cd lib && $(MAKE) $(MFLAGS) clean - cd lib-src && $(MAKE) $(MFLAGS) clean - cd nt && $(MAKE) $(MFLAGS) clean - -cd doc/emacs && $(MAKE) $(MFLAGS) clean - -cd doc/misc && $(MAKE) $(MFLAGS) clean - -cd doc/lispref && $(MAKE) $(MFLAGS) clean - -cd doc/lispintro && $(MAKE) $(MFLAGS) clean - cd nextstep && $(MAKE) $(MFLAGS) clean + cd src && $(MAKE) clean + cd oldXMenu && $(MAKE) clean + cd lwlib && $(MAKE) clean + cd lib && $(MAKE) clean + cd lib-src && $(MAKE) clean + cd nt && $(MAKE) clean + -cd doc/emacs && $(MAKE) clean + -cd doc/misc && $(MAKE) clean + -cd doc/lispref && $(MAKE) clean + -cd doc/lispintro && $(MAKE) clean + cd nextstep && $(MAKE) clean ### `bootclean' ### Delete all files that need to be remade for a clean bootstrap. @@ -853,21 +823,21 @@ ${top_bootclean}; \ rm -f config.status config.log~ Makefile stamp-h1 ${SUBDIR_MAKEFILES} distclean: - cd src && $(MAKE) $(MFLAGS) distclean - cd oldXMenu && $(MAKE) $(MFLAGS) distclean - cd lwlib && $(MAKE) $(MFLAGS) distclean - cd lib && $(MAKE) $(MFLAGS) distclean - cd lib-src && $(MAKE) $(MFLAGS) distclean - cd nt && $(MAKE) $(MFLAGS) distclean - cd doc/emacs && $(MAKE) $(MFLAGS) distclean - cd doc/misc && $(MAKE) $(MFLAGS) distclean - cd doc/lispref && $(MAKE) $(MFLAGS) distclean - cd doc/lispintro && $(MAKE) $(MFLAGS) distclean - cd leim && $(MAKE) $(MFLAGS) distclean - cd lisp && $(MAKE) $(MFLAGS) distclean - cd nextstep && $(MAKE) $(MFLAGS) distclean + cd src && $(MAKE) distclean + cd oldXMenu && $(MAKE) distclean + cd lwlib && $(MAKE) distclean + cd lib && $(MAKE) distclean + cd lib-src && $(MAKE) distclean + cd nt && $(MAKE) distclean + cd doc/emacs && $(MAKE) distclean + cd doc/misc && $(MAKE) distclean + cd doc/lispref && $(MAKE) distclean + cd doc/lispintro && $(MAKE) distclean + cd leim && $(MAKE) distclean + cd lisp && $(MAKE) distclean + cd nextstep && $(MAKE) distclean for dir in test/automated admin/grammars admin/unidata; do \ - [ ! -d $$dir ] || (cd $$dir && $(MAKE) $(MFLAGS) distclean); \ + [ ! -d $$dir ] || (cd $$dir && $(MAKE) distclean); \ done ${top_distclean} @@ -875,21 +845,21 @@ ### Delete everything that can be reconstructed by `make' and that ### needs to be deleted in order to force a bootstrap from a clean state. bootstrap-clean: - cd src && $(MAKE) $(MFLAGS) bootstrap-clean - cd oldXMenu && $(MAKE) $(MFLAGS) maintainer-clean - cd lwlib && $(MAKE) $(MFLAGS) maintainer-clean - cd lib && $(MAKE) $(MFLAGS) maintainer-clean - cd lib-src && $(MAKE) $(MFLAGS) maintainer-clean - cd nt && $(MAKE) $(MFLAGS) maintainer-clean - -cd doc/emacs && $(MAKE) $(MFLAGS) maintainer-clean - -cd doc/misc && $(MAKE) $(MFLAGS) maintainer-clean - -cd doc/lispref && $(MAKE) $(MFLAGS) maintainer-clean - -cd doc/lispintro && $(MAKE) $(MFLAGS) maintainer-clean - cd leim && $(MAKE) $(MFLAGS) bootstrap-clean - cd lisp && $(MAKE) $(MFLAGS) bootstrap-clean - cd nextstep && $(MAKE) $(MFLAGS) maintainer-clean + cd src && $(MAKE) bootstrap-clean + cd oldXMenu && $(MAKE) maintainer-clean + cd lwlib && $(MAKE) maintainer-clean + cd lib && $(MAKE) maintainer-clean + cd lib-src && $(MAKE) maintainer-clean + cd nt && $(MAKE) maintainer-clean + -cd doc/emacs && $(MAKE) maintainer-clean + -cd doc/misc && $(MAKE) maintainer-clean + -cd doc/lispref && $(MAKE) maintainer-clean + -cd doc/lispintro && $(MAKE) maintainer-clean + cd leim && $(MAKE) bootstrap-clean + cd lisp && $(MAKE) bootstrap-clean + cd nextstep && $(MAKE) maintainer-clean for dir in test/automated admin/grammars admin/unidata; do \ - [ ! -d $$dir ] || (cd $$dir && $(MAKE) $(MFLAGS) bootstrap-clean); \ + [ ! -d $$dir ] || (cd $$dir && $(MAKE) bootstrap-clean); \ done [ ! -f config.log ] || mv -f config.log config.log~ rm -rf ${srcdir}/info @@ -910,11 +880,11 @@ ${top_distclean}; \ rm -fr autom4te.cache maintainer-clean: bootstrap-clean - cd src && $(MAKE) $(MFLAGS) maintainer-clean - cd leim && $(MAKE) $(MFLAGS) maintainer-clean - cd lisp && $(MAKE) $(MFLAGS) maintainer-clean + cd src && $(MAKE) maintainer-clean + cd leim && $(MAKE) maintainer-clean + cd lisp && $(MAKE) maintainer-clean for dir in test/automated admin/grammars admin/unidata; do \ - [ ! -d $$dir ] || (cd $$dir && $(MAKE) $(MFLAGS) maintainer-clean); \ + [ ! -d $$dir ] || (cd $$dir && $(MAKE) maintainer-clean); \ done ${top_maintainer_clean} @@ -923,7 +893,7 @@ ### the coding standards seem to come from. It's like distclean, but ### it deletes backup and autosave files too. extraclean: - for i in ${SUBDIR}; do (cd $$i; $(MAKE) $(MFLAGS) extraclean); done + for i in ${SUBDIR}; do (cd $$i; $(MAKE) extraclean); done ${top_maintainer_clean} -rm -f config-tmp-* -rm -f *~ \#* @@ -932,14 +902,14 @@ # even when the build directory and source dir are different. .PHONY: TAGS tags TAGS tags: lib lib-src src - cd src; $(MAKE) $(MFLAGS) tags + cd src && $(MAKE) tags check: all @if test ! -d test/automated; then \ echo "You do not seem to have the test/ directory."; \ echo "Maybe you are using a release tarfile, rather than a repository checkout."; \ else \ - cd test/automated && $(MAKE) $(MFLAGS) check; \ + cd test/automated && $(MAKE) check; \ fi dist: @@ -953,7 +923,7 @@ DOCS = $(DVIS) $(HTMLS) $(INFOS) $(PDFS) $(PSS) $(DOCS): - t=$@; IFS=-; set $$t; IFS=; cd doc/$$1 && $(MAKE) $(MFLAGS) $$2 + t=$@; IFS=-; set $$t; IFS=; cd doc/$$1 && $(MAKE) $$2 .PHONY: $(DOCS) docs pdf ps .PHONY: info dvi dist check html info-real info-dir check-info @@ -1002,7 +972,7 @@ ## Install non .info forms of the documentation. ## TODO add etc/refcards. $(INSTALL_DOC): - t=$@; IFS=-; set $$t; IFS=; cd doc/$$2 && $(MAKE) $(MFLAGS) $$1-$$3 + t=$@; IFS=-; set $$t; IFS=; cd doc/$$2 && $(MAKE) $$1-$$3 .PHONY: $(INSTALL_DOC) install-doc .PHONY: install-dvi install-html install-pdf install-ps @@ -1025,7 +995,7 @@ UNINSTALL_DOC = $(UNINSTALL_DVI) $(UNINSTALL_HTML) $(UNINSTALL_PDF) $(UNINSTALL_PS) $(UNINSTALL_DOC): - t=$@; IFS=-; set $$t; IFS=; cd doc/$$2 && $(MAKE) $(MFLAGS) $$1-$$3 + t=$@; IFS=-; set $$t; IFS=; cd doc/$$2 && $(MAKE) $$1-$$3 .PHONY: $(UNINSTALL_DOC) uninstall-doc .PHONY: uninstall-dvi uninstall-html uninstall-pdf uninstall-ps @@ -1052,7 +1022,7 @@ @if test "$(HAVE_MAKEINFO)" = "no"; then \ echo "Configured --without-makeinfo, not building manuals" ; \ else \ - $(MAKE) $(MFLAGS) info-real info-dir; \ + $(MAKE) info-real info-dir; \ fi ## build-aux/make-info-dir expects only certain dircategories. @@ -1092,8 +1062,8 @@ # * Do the actual build. bootstrap: bootstrap-clean cd $(srcdir) && ./autogen.sh - $(MAKE) $(MFLAGS) MAKEFILE_NAME=force-Makefile force-Makefile - $(MAKE) $(MFLAGS) all + $(MAKE) MAKEFILE_NAME=force-Makefile force-Makefile + $(MAKE) all .PHONY: check-declare @@ -1102,4 +1072,4 @@ echo "You must build Emacs to use this command"; \ exit 1; \ fi - cd lisp && $(MAKE) $(MFLAGS) $@ + cd lisp && $(MAKE) $@ === modified file 'admin/ChangeLog' --- admin/ChangeLog 2014-06-02 00:18:22 +0000 +++ admin/ChangeLog 2014-06-13 23:05:00 +0000 @@ -1,3 +1,8 @@ +2014-06-13 Glenn Morris + + * unidata/Makefile.in (${DSTDIR}/charprop.el): + GNU make automatically passes command-line arguments to sub-makes. + 2014-06-02 Paul Eggert Include sources used to create macuvs.h. === modified file 'admin/unidata/Makefile.in' --- admin/unidata/Makefile.in 2014-05-26 15:48:28 +0000 +++ admin/unidata/Makefile.in 2014-06-13 23:05:00 +0000 @@ -52,7 +52,7 @@ ## uni-*.el files just because .elc is missing. ## Same for UnicodeData.txt v unidata.txt. ${DSTDIR}/charprop.el: ${srcdir}/unidata-gen.el ${srcdir}/UnicodeData.txt - ${MAKE} ${MFLAGS} compile unidata.txt EMACS="${EMACS}" + ${MAKE} compile unidata.txt EMACS="${EMACS}" -if [ -f "$@" ]; then \ cd ${DSTDIR} && chmod +w charprop.el `sed -n 's/^;; FILE: //p' < charprop.el`; \ fi === modified file 'lib-src/ChangeLog' --- lib-src/ChangeLog 2014-05-26 16:55:28 +0000 +++ lib-src/ChangeLog 2014-06-13 23:05:00 +0000 @@ -1,3 +1,8 @@ +2014-06-13 Glenn Morris + + * Makefile.in (../lib/libgnu.a): + GNU make automatically passes command-line arguments to sub-makes. + 2014-05-26 Eli Zaretskii * ntlib.h (lseek): Don't redirect to _lseek. === modified file 'lib-src/Makefile.in' --- lib-src/Makefile.in 2014-05-18 18:57:04 +0000 +++ lib-src/Makefile.in 2014-06-13 23:05:00 +0000 @@ -304,7 +304,7 @@ etags *.[ch] ../lib/libgnu.a: $(config_h) - cd ../lib && $(MAKE) $(MFLAGS) libgnu.a + cd ../lib && $(MAKE) libgnu.a regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h $(config_h) ${CC} -c ${CPP_CFLAGS} ${srcdir}/../src/regex.c === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-06-13 19:37:52 +0000 +++ lisp/ChangeLog 2014-06-13 23:05:00 +0000 @@ -1,5 +1,10 @@ 2014-06-13 Glenn Morris + * Makefile.in ($(lisp)/cus-load.el, $(lisp)/finder-inf.el) + (autoloads, $(lisp)/subdirs.el, compile-main, leim, semantic, compile) + (compile-always): GNU make automatically passes + command-line arguments to sub-makes. + * calendar/calendar.el (calendar-generate-window): Remove pointless call to font-lock-fontify-buffer. === modified file 'lisp/Makefile.in' --- lisp/Makefile.in 2014-06-02 01:10:47 +0000 +++ lisp/Makefile.in 2014-06-13 23:05:00 +0000 @@ -168,7 +168,7 @@ # since they will never contain any useful information # (see finder-no-scan-regexp and custom-dependencies-no-scan-regexp). $(lisp)/cus-load.el: - $(MAKE) $(MFLAGS) custom-deps + $(MAKE) custom-deps custom-deps: doit $(setwins_almost); \ echo Directories: $$wins; \ @@ -177,7 +177,7 @@ -f custom-make-dependencies $$wins $(lisp)/finder-inf.el: - $(MAKE) $(MFLAGS) finder-data + $(MAKE) finder-data finder-data: doit $(setwins_finder); \ echo Directories: $$wins; \ @@ -200,7 +200,7 @@ --eval '(setq autoload-builtin-package-versions t)' \ --eval '(setq generated-autoload-file (expand-file-name (unmsys--file-name "$(srcdir)/loaddefs.el")))' \ -f batch-update-autoloads $$wins - $(MAKE) $(MFLAGS) obsolete-autoloads + $(MAKE) obsolete-autoloads # The obsolete/ subdirectory is normally not scanned for autoloads. # Sometimes we still want to autoload something from that directory, @@ -215,7 +215,7 @@ # This is required by the bootstrap-emacs target in ../src/Makefile, so # we know that if we have an emacs executable, we also have a subdirs.el. $(lisp)/subdirs.el: - $(MAKE) $(MFLAGS) update-subdirs + $(MAKE) update-subdirs update-subdirs: doit $(setwins_for_subdirs); \ for file in $$wins; do \ @@ -307,7 +307,7 @@ compile-first: $(COMPILE_FIRST) # In `compile-main' we could directly do -# ... | xargs $(MAKE) $(MFLAGS) EMACS="$(EMACS)" +# ... | xargs $(MAKE) EMACS="$(EMACS)" # and it works, but it generates a lot of messages like # make[2]: gnus/gnus-mlspl.elc is up to date. # so instead, we use "xargs echo" to split the list of file into manageable @@ -331,7 +331,7 @@ echo "$${el}c"; \ done | xargs $(XARGS_LIMIT) echo) | \ while read chunk; do \ - $(MAKE) $(MFLAGS) compile-targets EMACS="$(EMACS)" TARGETS="$$chunk"; \ + $(MAKE) compile-targets EMACS="$(EMACS)" TARGETS="$$chunk"; \ done .PHONY: compile-clean @@ -348,7 +348,7 @@ .PHONY: leim semantic leim: - cd ../leim && $(MAKE) $(MFLAGS) all EMACS="$(EMACS)" + cd ../leim && $(MAKE) all EMACS="$(EMACS)" # FIXME. Yuck. semantic: @@ -356,7 +356,7 @@ .*) EMACS="../${EMACS}" ;; \ *) EMACS="${EMACS}" ;; \ esac; \ - cd ../admin/grammars && $(MAKE) $(MFLAGS) all EMACS="$${EMACS}" + cd ../admin/grammars && $(MAKE) all EMACS="$${EMACS}" # Compile all Lisp files, but don't recompile those that are up to # date. Some .el files don't get compiled because they set the @@ -365,14 +365,14 @@ # Explicitly pass EMACS (sometimes ../src/bootstrap-emacs) to those # sub-makes that run rules that use it, for the sake of some non-GNU makes. compile: $(LOADDEFS) autoloads compile-first - $(MAKE) $(MFLAGS) compile-main EMACS="$(EMACS)" + $(MAKE) compile-main EMACS="$(EMACS)" # Compile all Lisp files. This is like `compile' but compiles files # unconditionally. Some files don't actually get compiled because they # set the local variable no-byte-compile. compile-always: doit cd $(lisp) && rm -f *.elc */*.elc */*/*.elc */*/*/*.elc - $(MAKE) $(MFLAGS) compile EMACS="$(EMACS)" + $(MAKE) compile EMACS="$(EMACS)" .PHONY: backup-compiled-files compile-after-backup === modified file 'lwlib/ChangeLog' --- lwlib/ChangeLog 2014-06-04 03:20:11 +0000 +++ lwlib/ChangeLog 2014-06-13 23:05:00 +0000 @@ -1,3 +1,8 @@ +2014-06-13 Glenn Morris + + * Makefile.in ($(globals_h)): + GNU make automatically passes command-line arguments to sub-makes. + 2014-06-04 Dmitry Antipov * lwlib-widget.h (widget_value) [USE_X_TOOLKIT]: Use X toolkit === modified file 'lwlib/Makefile.in' --- lwlib/Makefile.in 2014-01-01 07:43:34 +0000 +++ lwlib/Makefile.in 2014-06-13 23:05:00 +0000 @@ -80,7 +80,7 @@ src_h = $(config_h) $(lisp_h) $(globals_h) $(globals_h): - cd ../src && $(MAKE) $(MFLAGS) globals.h + cd ../src && $(MAKE) globals.h lwlib-utils.o: $(src_h) lwlib-utils.c lwlib-utils.h lwlib.h lwlib.o: $(src_h) lwlib.c lwlib.h lwlib-int.h lwlib-utils.h \ === modified file 'src/ChangeLog' --- src/ChangeLog 2014-06-13 15:55:48 +0000 +++ src/ChangeLog 2014-06-13 23:05:00 +0000 @@ -1,3 +1,12 @@ +2014-06-13 Glenn Morris + + * Makefile.in ($(leimdir)/leim-list.el, $(srcdir)/macuvs.h) + ($(lispsource)/international/charprop.el) + ($(libsrc)/make-docfile$(EXEEXT), $(lwlibdir)/liblw.a) + ($(oldXMenudir)/libXMenu11.a, ns-app, .el.elc) + ($(lispsource)/loaddefs.el, bootstrap-emacs$(EXEEXT)): + GNU make automatically passes command-line arguments to sub-makes. + 2014-06-13 Paul Eggert Avoid hangs in accept-process-output (Bug#17647). === modified file 'src/Makefile.in' --- src/Makefile.in 2014-06-03 07:28:07 +0000 +++ src/Makefile.in 2014-06-13 23:05:00 +0000 @@ -414,11 +414,11 @@ .PHONY: all $(leimdir)/leim-list.el: bootstrap-emacs$(EXEEXT) - cd ../leim && $(MAKE) $(MFLAGS) leim-list.el EMACS="$(bootstrap_exe)" + cd ../leim && $(MAKE) leim-list.el EMACS="$(bootstrap_exe)" $(srcdir)/macuvs.h $(lispsource)/international/charprop.el: \ bootstrap-emacs$(EXEEXT) - cd ../admin/unidata && $(MAKE) $(MFLAGS) all EMACS="../$(bootstrap_exe)" + cd ../admin/unidata && $(MAKE) all EMACS="../$(bootstrap_exe)" ## The dumped Emacs is as functional and more efficient than ## bootstrap-emacs, so we replace the latter with the former. @@ -459,7 +459,7 @@ $(libsrc)/make-docfile -a $(etc)/DOC -d $(lispsource) `sed -n -e 's| \\\\||' -e 's|^[ ]*$$(lispsource)/||p' $(srcdir)/lisp.mk` $(libsrc)/make-docfile$(EXEEXT): - cd $(libsrc); $(MAKE) $(MFLAGS) make-docfile$(EXEEXT) + cd $(libsrc); $(MAKE) make-docfile$(EXEEXT) buildobj.h: Makefile for i in $(ALLOBJS); do \ @@ -499,13 +499,9 @@ ## The following oldxmenu-related rules are only (possibly) used if ## HAVE_X11 && !USE_GTK, but there is no harm in always defining them. $(lwlibdir)/liblw.a: $(config_h) globals.h lisp.h FORCE - cd $(lwlibdir) && \ - $(MAKE) $(MFLAGS) CC='$(CC)' CFLAGS='$(CFLAGS)' MAKE='$(MAKE)' \ - liblw.a + cd $(lwlibdir) && $(MAKE) liblw.a $(oldXMenudir)/libXMenu11.a: FORCE - cd $(oldXMenudir) && \ - $(MAKE) $(MFLAGS) CC='$(CC)' CFLAGS='$(CFLAGS)' MAKE='$(MAKE)' \ - libXMenu11.a + cd $(oldXMenudir) && $(MAKE) libXMenu11.a FORCE: .PHONY: FORCE @@ -523,7 +519,7 @@ -o $@ $(ntsource)/emacs.rc ns-app: emacs$(EXEEXT) - cd ../nextstep && $(MAKE) $(MFLAGS) all + cd ../nextstep && $(MAKE) all .PHONY: mostlyclean clean bootstrap-clean distclean maintainer-clean .PHONY: versionclean extraclean @@ -621,7 +617,7 @@ ## separately below. ## With GNU Make, we would just say "%.el : %.elc $(BOOTSTRAPEMACS)" .el.elc: - @cd ../lisp; $(MAKE) $(MFLAGS) compile-onefile \ + @cd ../lisp && $(MAKE) compile-onefile \ THEFILE=$< EMACS="$(bootstrap_exe)" ## Since the .el.elc rule cannot specify an extra dependency, we do it here. @@ -633,12 +629,12 @@ VCSWITNESS = $(lispsource)/loaddefs.el: $(BOOTSTRAPEMACS) $(VCSWITNESS) - cd ../lisp; $(MAKE) $(MFLAGS) autoloads EMACS="$(bootstrap_exe)" + cd ../lisp && $(MAKE) autoloads EMACS="$(bootstrap_exe)" ## Dump an Emacs executable named bootstrap-emacs containing the ## files from loadup.el in source form. bootstrap-emacs$(EXEEXT): temacs$(EXEEXT) - cd ../lisp; $(MAKE) $(MFLAGS) update-subdirs + cd ../lisp && $(MAKE) update-subdirs if test "$(CANNOT_DUMP)" = "yes"; then \ rm -f bootstrap-emacs$(EXEEXT); \ ln temacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \ @@ -648,7 +644,7 @@ mv -f emacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \ fi @: Compile some files earlier to speed up further compilation. - cd ../lisp; $(MAKE) $(MFLAGS) compile-first EMACS="$(bootstrap_exe)" + cd ../lisp && $(MAKE) compile-first EMACS="$(bootstrap_exe)" ## Insert either autodeps.mk (if AUTO_DEPEND), else deps.mk. @deps_frag@ === modified file 'test/ChangeLog' --- test/ChangeLog 2014-06-05 14:42:45 +0000 +++ test/ChangeLog 2014-06-13 23:05:00 +0000 @@ -1,3 +1,8 @@ +2014-06-13 Glenn Morris + + * automated/Makefile.in (compile-main): + GNU make automatically passes command-line arguments to sub-makes. + 2014-06-05 Michal Nazarewicz * automated/tildify-tests.el (tildify-test--test): Optimise the test === modified file 'test/automated/Makefile.in' --- test/automated/Makefile.in 2014-04-11 06:51:49 +0000 +++ test/automated/Makefile.in 2014-06-13 23:05:00 +0000 @@ -84,7 +84,7 @@ echo "$${el}c"; \ done | xargs $(XARGS_LIMIT) echo | \ while read chunk; do \ - $(MAKE) $(MFLAGS) compile-targets EMACS="$(EMACS)" TARGETS="$$chunk"; \ + $(MAKE) compile-targets EMACS="$(EMACS)" TARGETS="$$chunk"; \ done # Erase left-over .elc files that do not have a corresponding .el file. ------------------------------------------------------------ Use --include-merged or -n0 to see merged revisions.