commit 0cfe3ee457e010816f5f85ee9d4a362f8b9f045c (HEAD, refs/remotes/origin/master) Author: Mark Oteiza Date: Wed Mar 15 01:12:48 2017 -0400 Write a named function * lisp/comint.el (comint-nonblank-p): New function. (comint-input-filter): Use it. diff --git a/lisp/comint.el b/lisp/comint.el index 7bac30598f..a01ecd3dbf 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -387,8 +387,7 @@ See also `completion-at-point'. This is a good thing to set in mode hooks.") -(defvar comint-input-filter - (function (lambda (str) (not (string-match "\\`\\s *\\'" str)))) +(defvar comint-input-filter #'comint-nonblank-p "Predicate for filtering additions to input history. Takes one argument, the input. If non-nil, the input may be saved on the input history list. Default is to save anything that isn't all whitespace.") @@ -857,6 +856,10 @@ series of processes in the same Comint buffer. The hook (set-process-coding-system proc decoding encoding)) proc)) +(defun comint-nonblank-p (str) + "Return non-nil if STR contains non-whitespace syntax." + (not (string-match "\\`\\s *\\'" str))) + (defun comint-insert-input (event) "In a Comint buffer, set the current input to the previous input at point. If there is no previous input at point, run the command specified commit d5260473dea4a86907614cf5fae9ec43f6cdccd4 Author: Mark Oteiza Date: Wed Mar 15 00:42:25 2017 -0400 Replace more nested ifs with cond This is a continuation of 0db5ba4 "Replace nested ifs with cond". * lisp/play/dunnet.el (dun-special-object, dun-inven, dun-drop): (dun-drop-check, dun-swim, dun-break): Use when and cond where appropriate. (dun-examine): Fix indentation. (dun-doverb): Use when. (dun-read-line): Refactor. diff --git a/lisp/play/dunnet.el b/lisp/play/dunnet.el index 8b9bb037e9..677946262c 100644 --- a/lisp/play/dunnet.el +++ b/lisp/play/dunnet.el @@ -1227,72 +1227,65 @@ treasures for points?" "4" "four") ;;; or lack thereof, depends on certain conditions. (defun dun-special-object () - (if (= dun-current-room computer-room) - (if dun-computer - (dun-mprincl -"The panel lights are flashing in a seemingly organized pattern.") - (dun-mprincl "The panel lights are steady and motionless."))) + (cond + ((= dun-current-room computer-room) + (if dun-computer + (dun-mprincl + "The panel lights are flashing in a seemingly organized pattern.") + (dun-mprincl "The panel lights are steady and motionless."))) - (if (and (= dun-current-room red-room) - (not (member obj-towel (nth red-room dun-room-objects)))) - (dun-mprincl "There is a hole in the floor here.")) + ((and (= dun-current-room red-room) + (not (member obj-towel (nth red-room dun-room-objects)))) + (dun-mprincl "There is a hole in the floor here.")) - (if (and (= dun-current-room marine-life-area) dun-black) - (dun-mprincl + ((and (= dun-current-room marine-life-area) dun-black) + (dun-mprincl "The room is lit by a black light, causing the fish, and some of your objects, to give off an eerie glow.")) - (if (and (= dun-current-room fourth-vermont-intersection) dun-hole) - (progn - (if (not dun-inbus) - (progn - (dun-mprincl "You fall into a hole in the ground.") - (setq dun-current-room vermont-station) - (dun-describe-room vermont-station)) - (progn - (dun-mprincl -"The bus falls down a hole in the ground and explodes.") - (dun-die "burning"))))) - - (if (> dun-current-room endgame-computer-room) - (progn - (if (not dun-correct-answer) - (dun-endgame-question) - (dun-mprincl "Your question is:") - (dun-mprincl dun-endgame-question)))) + ((and (= dun-current-room fourth-vermont-intersection) dun-hole) + (if (not dun-inbus) + (progn + (dun-mprincl "You fall into a hole in the ground.") + (setq dun-current-room vermont-station) + (dun-describe-room vermont-station)) + (dun-mprincl "The bus falls down a hole in the ground and explodes.") + (dun-die "burning"))) + + ((> dun-current-room endgame-computer-room) + (if (not dun-correct-answer) + (dun-endgame-question) + (dun-mprincl "Your question is:") + (dun-mprincl dun-endgame-question))) - (if (= dun-current-room sauna) - (progn - (dun-mprincl (nth dun-sauna-level '( + ((= dun-current-room sauna) + (dun-mprincl (nth dun-sauna-level '( "It is normal room temperature in here." "It is luke warm in here." "It is comfortably hot in here." "It is refreshingly hot in here." "You are dead now."))) - (if (= dun-sauna-level 3) - (progn - (if (or (member obj-rms dun-inventory) - (member obj-rms (nth dun-current-room dun-room-objects))) - (progn - (dun-mprincl -"You notice the wax on your statuette beginning to melt, until it completely + (when (= dun-sauna-level 3) + (when (or (member obj-rms dun-inventory) + (member obj-rms (nth dun-current-room dun-room-objects))) + (dun-mprincl + "You notice the wax on your statuette beginning to melt, until it completely melts off. You are left with a beautiful diamond!") - (if (member obj-rms dun-inventory) - (progn - (dun-remove-obj-from-inven obj-rms) - (setq dun-inventory (append dun-inventory - (list obj-diamond)))) - (dun-remove-obj-from-room dun-current-room obj-rms) - (dun-replace dun-room-objects dun-current-room - (append (nth dun-current-room dun-room-objects) - (list obj-diamond)))))) - (if (or (member obj-floppy dun-inventory) - (member obj-floppy (nth dun-current-room dun-room-objects))) - (progn - (dun-mprincl -"You notice your floppy disk beginning to melt. As you grab for it, the + (if (member obj-rms dun-inventory) + (progn + (dun-remove-obj-from-inven obj-rms) + (setq dun-inventory (append dun-inventory + (list obj-diamond)))) + (dun-remove-obj-from-room dun-current-room obj-rms) + (dun-replace dun-room-objects dun-current-room + (append (nth dun-current-room dun-room-objects) + (list obj-diamond))))) + (when (or (member obj-floppy dun-inventory) + (member obj-floppy (nth dun-current-room dun-room-objects))) + (dun-mprincl + "You notice your floppy disk beginning to melt. As you grab for it, the disk bursts into flames, and disintegrates.") - (dun-remove-obj-from-inven obj-floppy) - (dun-remove-obj-from-room dun-current-room obj-floppy)))))))) + (dun-remove-obj-from-inven obj-floppy) + (dun-remove-obj-from-room dun-current-room obj-floppy)))))) (defun dun-die (murderer) @@ -1312,14 +1305,12 @@ disk bursts into flames, and disintegrates.") (defun dun-inven (_args) (dun-mprincl "You currently have:") (dolist (curobj dun-inventory) - (if curobj - (progn - (dun-mprincl (cadr (nth curobj dun-objects))) - (if (and (= curobj obj-jar) dun-jar) - (progn - (dun-mprincl "The jar contains:") - (dolist (x dun-jar) - (dun-mprincl " " (cadr (nth x dun-objects)))))))))) + (when curobj + (dun-mprincl (cadr (nth curobj dun-objects))) + (when (and (= curobj obj-jar) dun-jar) + (dun-mprincl "The jar contains:") + (dolist (x dun-jar) + (dun-mprincl " " (cadr (nth x dun-objects)))))))) (defun dun-shake (obj) (let ((objnum (dun-objnum-from-args-std obj))) @@ -1354,46 +1345,42 @@ on your head.") (when (setq objnum (dun-objnum-from-args-std obj)) (if (not (member objnum dun-inventory)) (dun-mprincl "You don't have that.") - (progn - (dun-remove-obj-from-inven objnum) - (dun-replace dun-room-objects dun-current-room - (append (nth dun-current-room dun-room-objects) - (list objnum))) - (dun-mprincl "Done.") - (if (member objnum (list obj-food obj-weight obj-jar)) - (dun-drop-check objnum)))))))) + (dun-remove-obj-from-inven objnum) + (dun-replace dun-room-objects dun-current-room + (append (nth dun-current-room dun-room-objects) + (list objnum))) + (dun-mprincl "Done.") + (if (member objnum (list obj-food obj-weight obj-jar)) + (dun-drop-check objnum))))))) ;;; Dropping certain things causes things to happen. (defun dun-drop-check (objnum) - (if (and (= objnum obj-food) (= dun-room bear-hangout) - (member obj-bear (nth bear-hangout dun-room-objects))) - (progn - (dun-mprincl + (cond + ((and (= objnum obj-food) (= dun-room bear-hangout) + (member obj-bear (nth bear-hangout dun-room-objects))) + (dun-mprincl "The bear takes the food and runs away with it. He left something behind.") - (dun-remove-obj-from-room dun-current-room obj-bear) - (dun-remove-obj-from-room dun-current-room obj-food) - (dun-replace dun-room-objects dun-current-room - (append (nth dun-current-room dun-room-objects) - (list obj-key))))) - - (if (and (= objnum obj-jar) (member obj-nitric dun-jar) - (member obj-glycerine dun-jar)) - (progn - (dun-mprincl - "As the jar impacts the ground it explodes into many pieces.") - (setq dun-jar nil) - (dun-remove-obj-from-room dun-current-room obj-jar) - (if (= dun-current-room fourth-vermont-intersection) - (progn - (setq dun-hole t) - (setq dun-current-room vermont-station) - (dun-mprincl + (dun-remove-obj-from-room dun-current-room obj-bear) + (dun-remove-obj-from-room dun-current-room obj-food) + (dun-replace dun-room-objects dun-current-room + (append (nth dun-current-room dun-room-objects) + (list obj-key)))) + + ((and (= objnum obj-jar) (member obj-nitric dun-jar) + (member obj-glycerine dun-jar)) + (dun-mprincl "As the jar impacts the ground it explodes into many pieces.") + (setq dun-jar nil) + (dun-remove-obj-from-room dun-current-room obj-jar) + (when (= dun-current-room fourth-vermont-intersection) + (setq dun-hole t) + (setq dun-current-room vermont-station) + (dun-mprincl "The explosion causes a hole to open up in the ground, which you fall -through."))))) +through."))) - (if (and (= objnum obj-weight) (= dun-current-room maze-button-room)) - (dun-mprincl "A passageway opens."))) + ((and (= objnum obj-weight) (= dun-current-room maze-button-room)) + (dun-mprincl "A passageway opens.")))) ;;; Give long description of current room, or an object. @@ -1416,7 +1403,7 @@ through."))))) ((>= objnum 0) (if (and (= objnum obj-bone) (= dun-current-room marine-life-area) dun-black) - (dun-mprincl + (dun-mprincl "In this light you can see some writing on the bone. It says: For an explosive time, go to Fourth St. and Vermont.") (if (nth objnum dun-physobj-desc) @@ -1942,18 +1929,18 @@ as you release it, the passageway closes.")) (setq dun-black t)))))) (defun dun-swim (_args) - (if (not (member dun-current-room (list lakefront-north lakefront-south))) - (dun-mprincl "I see no water!") - (if (not (member obj-life dun-inventory)) - (progn - (dun-mprincl + (cond + ((not (member dun-current-room (list lakefront-north lakefront-south))) + (dun-mprincl "I see no water!")) + ((not (member obj-life dun-inventory)) + (dun-mprincl "You dive in the water, and at first notice it is quite cold. You then start to get used to it as you realize that you never really learned how to swim.") - (dun-die "drowning")) - (if (= dun-current-room lakefront-north) - (setq dun-current-room lakefront-south) - (setq dun-current-room lakefront-north))))) + (dun-die "drowning")) + ((= dun-current-room lakefront-north) + (setq dun-current-room lakefront-south)) + (t (setq dun-current-room lakefront-north)))) (defun dun-score (_args) @@ -2043,46 +2030,43 @@ the ground, then putting some kind of treasure in it, and filling the hole with dirt again. After this, you immediately wake up."))) (defun dun-break (obj) - (let (objnum) - (if (not (member obj-axe dun-inventory)) - (dun-mprincl "You have nothing you can use to break things.") - (when (setq objnum (dun-objnum-from-args-std obj)) - (if (member objnum dun-inventory) - (progn - (dun-mprincl + (if (not (member obj-axe dun-inventory)) + (dun-mprincl "You have nothing you can use to break things.") + (let ((objnum (dun-objnum-from-args-std obj))) + (when objnum + (cond + ((member objnum dun-inventory) + (dun-mprincl "You take the object in your hands and swing the axe. Unfortunately, you miss the object and slice off your hand. You bleed to death.") - (dun-die "an axe")) - (if (not (or (member objnum (nth dun-current-room dun-room-objects)) - (member objnum - (nth dun-current-room dun-room-silents)))) - (dun-mprincl "I don't see that here.") - (if (= objnum obj-cable) - (progn - (dun-mprincl + (dun-die "an axe")) + ((not (or (member objnum (nth dun-current-room dun-room-objects)) + (member objnum + (nth dun-current-room dun-room-silents)))) + (dun-mprincl "I don't see that here.")) + ((= objnum obj-cable) + (dun-mprincl "As you break the ethernet cable, everything starts to blur. You collapse -for a moment, then straighten yourself up. -") - (dun-replace dun-room-objects gamma-computing-center - (append - (nth gamma-computing-center dun-room-objects) - dun-inventory)) - (if (member obj-key dun-inventory) - (progn - (setq dun-inventory (list obj-key)) - (dun-remove-obj-from-room - gamma-computing-center obj-key)) - (setq dun-inventory nil)) - (setq dun-current-room computer-room) - (setq dun-ethernet nil) - (dun-mprincl "Connection closed.") - (dun-unix-interface)) - (if (< objnum 0) - (progn - (dun-mprincl "Your axe shatters into a million pieces.") - (dun-remove-obj-from-inven obj-axe)) - (dun-mprincl "Your axe breaks it into a million pieces.") - (dun-remove-obj-from-room dun-current-room objnum))))))))) +for a moment, then straighten yourself up.\n") + (dun-replace dun-room-objects gamma-computing-center + (append + (nth gamma-computing-center dun-room-objects) + dun-inventory)) + (if (member obj-key dun-inventory) + (progn + (setq dun-inventory (list obj-key)) + (dun-remove-obj-from-room gamma-computing-center obj-key)) + (setq dun-inventory nil)) + (setq dun-current-room computer-room) + (setq dun-ethernet nil) + (dun-mprincl "Connection closed.") + (dun-unix-interface)) + ((< objnum 0) + (dun-mprincl "Your axe shatters into a million pieces.") + (dun-remove-obj-from-inven obj-axe)) + (t + (dun-mprincl "Your axe breaks it into a million pieces.") + (dun-remove-obj-from-room dun-current-room objnum))))))) (defun dun-drive (_args) (if (not dun-inbus) @@ -2178,8 +2162,7 @@ for a moment, then straighten yourself up. ;;; function associated with the verb, and passes along the other words. (defun dun-doverb (ignore verblist verb rest) - (if (not verb) - nil + (when verb (if (member (intern verb) ignore) (if (not (car rest)) -1 (dun-doverb ignore verblist (car rest) (cdr rest))) @@ -2250,9 +2233,9 @@ for a moment, then straighten yourself up. ;;; Read a line, in window mode (defun dun-read-line () - (let (line) - (setq line (read-string "")) - (dun-mprinc line) line)) + (let ((line (read-string ""))) + (dun-mprinc line) + line)) ;;; Insert something into the window buffer commit c66aaa61639e72a70a4f2c4bc73645048caebe53 Author: Noam Postavsky Date: Tue Mar 14 09:23:08 2017 -0400 Recomplexify ‘delete-trailing-whitespace’ by treating \n as whitespace again Mostly reverts "Simplify ‘delete-trailing-whitespace’ by not treating \n as whitespace" from 2016-07-04. Setting \n to non-whitespace causes the regex engine to backtrack a lot when searching for "\\s-+$" (Bug#26079). * lisp/simple.el (delete-trailing-whitespace): Don't change newline syntax, search for "\\s-$" and then skip backward over trailing whitespace. diff --git a/lisp/simple.el b/lisp/simple.el index f110c6f326..369fbf7192 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -633,10 +633,9 @@ buffer if the variable `delete-trailing-lines' is non-nil." (with-syntax-table (make-syntax-table (syntax-table)) ;; Don't delete formfeeds, even if they are considered whitespace. (modify-syntax-entry ?\f "_") - ;; Treating \n as non-whitespace makes things easier. - (modify-syntax-entry ?\n "_") - (while (re-search-forward "\\s-+$" end-marker t) - (let ((b (match-beginning 0)) (e (match-end 0))) + (while (re-search-forward "\\s-$" end-marker t) + (skip-syntax-backward "-" (line-beginning-position)) + (let ((b (point)) (e (match-end 0))) (when (region-modifiable-p b e) (delete-region b e))))) (if end commit fac0bb9cf76072941ae9dc9c7019929eb1a0f1dd Author: Paul Eggert Date: Tue Mar 14 13:44:11 2017 -0700 Merge from gnulib This incorporates: 2017-03-14 snippets: move unadjusted snippet sources to lib 2017-03-14 gnulib-tool: fix typo in comment output 2017-03-14 snippets: work around GNU Make 3.82 VPATH 2017-03-13 gnulib-tool: minor --gnu-make fixups 2017-03-12 gnulib-tool: new option --gnu-make * .gitignore: Remove lib/arg-nonnull.h, lib/c++defs.h, lib/warn-on-use.h. Change exception from build-aux/snippet/_Noreturn.h to lib/_Noreturn.h. * admin/authors.el (authors-renamed-files-regexps): * admin/notes/copyright, make-dist: The snippet files moved from build-aux/snippet to lib. * lib/_Noreturn.h: Rename from build-aux/snippet/_Noreturn.h. * lib/arg-nonnull.h: Rename from build-aux/snippet/arg-nonnull.h. * lib/c++defs.h: Rename from build-aux/snippet/c++defs.h. * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate. * lib/warn-on-use.h: Rename from build-aux/snippet/warn-on-use.h. diff --git a/.gitignore b/.gitignore index e8eb4fdeae..f5265ff1ef 100644 --- a/.gitignore +++ b/.gitignore @@ -57,9 +57,7 @@ src/epaths.h # C-level sources built by 'make'. lib/alloca.h -lib/arg-nonnull.h lib/byteswap.h -lib/c++defs.h lib/dirent.h lib/errno.h lib/execinfo.h @@ -76,7 +74,6 @@ lib/string.h lib/sys/ lib/time.h lib/unistd.h -lib/warn-on-use.h src/buildobj.h src/globals.h src/lisp.mk @@ -274,7 +271,7 @@ etc/emacs.tmpdesktop # Microsoft-related builds and installations. *.in-h _* -!build-aux/snippet/_Noreturn.h +!lib/_Noreturn.h /bin/ /BIN/ /data/ diff --git a/admin/authors.el b/admin/authors.el index 69f1c96983..d8f56fd925 100644 --- a/admin/authors.el +++ b/admin/authors.el @@ -980,7 +980,7 @@ Elements are (OLDNAME . NEWNAME).") ;; Cf authors-renamed-files-alist. (defconst authors-renamed-files-regexps '(("\\`\\(arg-nonnull\\|c\\+\\+defs\\|warn-on-use\\)\\.h\\'" - "build-aux/snippet/\\&") + "lib/\\&") ("\\`\\(ebuild\\|emacs\\|install\\|fast-install\\)\\.cmd\\'" "\\1.bat") ("\\`\\(book-spine\\|cl\\|forms\\|functions\\|gnus\\|sc\\|texinfo\\|vip\\)\ \\.texinfo\\'" "\\1.texi") diff --git a/admin/notes/copyright b/admin/notes/copyright index 16144fb852..66c69ac027 100644 --- a/admin/notes/copyright +++ b/admin/notes/copyright @@ -541,10 +541,6 @@ alone (may import them from Gnulib again). These are: build-aux/depcomp build-aux/missing build-aux/move-if-change - build-aux/snippet/_Noreturn.h - build-aux/snippet/arg-nonnull.h - build-aux/snippet/c++defs.h - build-aux/snippet/warn-on-use.h doc/man/texinfo.tex lib/*.[ch] lib/gnulib.mk diff --git a/build-aux/snippet/_Noreturn.h b/lib/_Noreturn.h similarity index 100% rename from build-aux/snippet/_Noreturn.h rename to lib/_Noreturn.h diff --git a/build-aux/snippet/arg-nonnull.h b/lib/arg-nonnull.h similarity index 100% rename from build-aux/snippet/arg-nonnull.h rename to lib/arg-nonnull.h diff --git a/build-aux/snippet/c++defs.h b/lib/c++defs.h similarity index 100% rename from build-aux/snippet/c++defs.h rename to lib/c++defs.h diff --git a/lib/gnulib.mk b/lib/gnulib.mk index 7a0de1b440..4109e7f6af 100644 --- a/lib/gnulib.mk +++ b/lib/gnulib.mk @@ -25,6 +25,7 @@ MOSTLYCLEANFILES += core *.stackdump +# No GNU Make output. noinst_LIBRARIES += libgnu.a @@ -873,81 +874,48 @@ EXTRA_DIST += signal.in.h ## begin gnulib module snippet/_Noreturn # Because this Makefile snippet defines a variable used by other -# gnulib Makefile snippets, it must be present in all Makefile.am that +# gnulib Makefile snippets, it must be present in all makefiles that # need it. This is ensured by the applicability 'all' defined above. -_NORETURN_H=$(top_srcdir)/build-aux/snippet/_Noreturn.h +_NORETURN_H=$(srcdir)/_Noreturn.h -EXTRA_DIST += $(top_srcdir)/build-aux/snippet/_Noreturn.h +EXTRA_DIST += _Noreturn.h ## end gnulib module snippet/_Noreturn ## begin gnulib module snippet/arg-nonnull -# The BUILT_SOURCES created by this Makefile snippet are not used via #include -# statements but through direct file reference. Therefore this snippet must be -# present in all Makefile.am that need it. This is ensured by the applicability -# 'all' defined above. - -BUILT_SOURCES += arg-nonnull.h -# The arg-nonnull.h that gets inserted into generated .h files is the same as -# build-aux/snippet/arg-nonnull.h, except that it has the copyright header cut -# off. -arg-nonnull.h: $(top_srcdir)/build-aux/snippet/arg-nonnull.h - $(AM_V_GEN)rm -f $@-t $@ && \ - sed -n -e '/GL_ARG_NONNULL/,$$p' \ - < $(top_srcdir)/build-aux/snippet/arg-nonnull.h \ - > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t +# Because this Makefile snippet defines a variable used by other +# gnulib Makefile snippets, it must be present in all makefiles that +# need it. This is ensured by the applicability 'all' defined above. -ARG_NONNULL_H=arg-nonnull.h +ARG_NONNULL_H=$(srcdir)/arg-nonnull.h -EXTRA_DIST += $(top_srcdir)/build-aux/snippet/arg-nonnull.h +EXTRA_DIST += arg-nonnull.h ## end gnulib module snippet/arg-nonnull ## begin gnulib module snippet/c++defs -# The BUILT_SOURCES created by this Makefile snippet are not used via #include -# statements but through direct file reference. Therefore this snippet must be -# present in all Makefile.am that need it. This is ensured by the applicability -# 'all' defined above. - -BUILT_SOURCES += c++defs.h -# The c++defs.h that gets inserted into generated .h files is the same as -# build-aux/snippet/c++defs.h, except that it has the copyright header cut off. -c++defs.h: $(top_srcdir)/build-aux/snippet/c++defs.h - $(AM_V_GEN)rm -f $@-t $@ && \ - sed -n -e '/_GL_CXXDEFS/,$$p' \ - < $(top_srcdir)/build-aux/snippet/c++defs.h \ - > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += c++defs.h c++defs.h-t +# Because this Makefile snippet defines a variable used by other +# gnulib Makefile snippets, it must be present in all makefiles that +# need it. This is ensured by the applicability 'all' defined above. -CXXDEFS_H=c++defs.h +CXXDEFS_H=$(srcdir)/c++defs.h -EXTRA_DIST += $(top_srcdir)/build-aux/snippet/c++defs.h +EXTRA_DIST += c++defs.h ## end gnulib module snippet/c++defs ## begin gnulib module snippet/warn-on-use -BUILT_SOURCES += warn-on-use.h -# The warn-on-use.h that gets inserted into generated .h files is the same as -# build-aux/snippet/warn-on-use.h, except that it has the copyright header cut -# off. -warn-on-use.h: $(top_srcdir)/build-aux/snippet/warn-on-use.h - $(AM_V_GEN)rm -f $@-t $@ && \ - sed -n -e '/^.ifndef/,$$p' \ - < $(top_srcdir)/build-aux/snippet/warn-on-use.h \ - > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t +# Because this Makefile snippet defines a variable used by other +# gnulib Makefile snippets, it must be present in all makefiles that +# need it. This is ensured by the applicability 'all' defined above. -WARN_ON_USE_H=warn-on-use.h +WARN_ON_USE_H=$(srcdir)/warn-on-use.h -EXTRA_DIST += $(top_srcdir)/build-aux/snippet/warn-on-use.h +EXTRA_DIST += warn-on-use.h ## end gnulib module snippet/warn-on-use diff --git a/build-aux/snippet/warn-on-use.h b/lib/warn-on-use.h similarity index 100% rename from build-aux/snippet/warn-on-use.h rename to lib/warn-on-use.h diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index a3e30fd736..bf7afa51bf 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 @@ -787,6 +787,8 @@ changequote([, ])dnl AC_SUBST([LIBGNU_LIBDEPS]) LIBGNU_LTLIBDEPS="$gl_ltlibdeps" AC_SUBST([LIBGNU_LTLIBDEPS]) + LIBTESTS_LIBDEPS="$gltests_libdeps" + AC_SUBST([LIBTESTS_LIBDEPS]) ]) # Like AC_LIBOBJ, except that the module name goes @@ -847,11 +849,8 @@ AC_DEFUN([gltests_LIBSOURCES], [ # gnulib-tool and may be removed by future gnulib-tool invocations. AC_DEFUN([gl_FILE_LIST], [ build-aux/gitlog-to-changelog - build-aux/snippet/_Noreturn.h - build-aux/snippet/arg-nonnull.h - build-aux/snippet/c++defs.h - build-aux/snippet/warn-on-use.h build-aux/update-copyright + lib/_Noreturn.h lib/acl-errno-valid.c lib/acl-internal.c lib/acl-internal.h @@ -860,10 +859,12 @@ AC_DEFUN([gl_FILE_LIST], [ lib/alloca.in.h lib/allocator.c lib/allocator.h + lib/arg-nonnull.h lib/at-func.c lib/binary-io.c lib/binary-io.h lib/byteswap.in.h + lib/c++defs.h lib/c-ctype.c lib/c-ctype.h lib/c-strcase.h @@ -995,6 +996,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/utimens.h lib/verify.h lib/vla.h + lib/warn-on-use.h lib/xalloc-oversized.h m4/00gnulib.m4 m4/absolute-header.m4 @@ -1104,4 +1106,9 @@ AC_DEFUN([gl_FILE_LIST], [ m4/warnings.m4 m4/wchar_t.m4 m4/wint_t.m4 + tests=lib/_Noreturn.h + tests=lib/arg-nonnull.h + tests=lib/c++defs.h + tests=lib/dummy.c + tests=lib/warn-on-use.h ]) diff --git a/make-dist b/make-dist index 4054075e3a..5370d03891 100755 --- a/make-dist +++ b/make-dist @@ -366,7 +366,7 @@ ln aclocal.m4 CONTRIBUTE ${tempdir} echo "Creating subdirectories" for subdir in site-lisp \ leim leim/CXTERM-DIC leim/MISC-DIC leim/SKK-DIC \ - build-aux build-aux/snippet \ + build-aux \ src src/bitmaps lib lib-src oldXMenu lwlib \ nt nt/inc nt/inc/sys nt/inc/arpa nt/inc/netinet nt/icons \ `find etc lisp admin test -type d` \ @@ -424,10 +424,6 @@ echo "Making links to 'build-aux'" ln update-copyright update-subdirs ../${tempdir}/build-aux ln dir_top make-info-dir ar-lib ../${tempdir}/build-aux) -echo "Making links to 'build-aux/snippet'" -(cd build-aux/snippet - ln *.h ../../${tempdir}/build-aux/snippet) - echo "Making links to 'src'" ### Don't distribute the configured versions of ### config.in, paths.in, buildobj.h, or Makefile.in. @@ -446,13 +442,12 @@ echo "Making links to 'src/bitmaps'" ln README *.xbm ../../${tempdir}/src/bitmaps) echo "Making links to 'lib'" -(snippet_h=`(cd build-aux/snippet && ls *.h)` - cd lib - ln [a-zA-Z]*.[ch] ../${tempdir}/lib +(cd lib + ln [a-zA-Z_]*.[ch] ../${tempdir}/lib ln gnulib.mk Makefile.am Makefile.in ../${tempdir}/lib cd ../${tempdir}/lib script='/[*]/d; s/\.in\.h$/.h/' - rm -f `(echo "$snippet_h"; ls *.in.h) | sed "$script"`) + rm -f `ls *.in.h | sed "$script"`) echo "Making links to 'lib-src'" (cd lib-src commit 5a64d78854998c2ed6d9b8de1b593d8462b8fa39 Merge: a568d0a7d4 726c6c97ca Author: Michael Albinus Date: Tue Mar 14 15:52:32 2017 +0100 Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs commit a568d0a7d4b62d0b92ecd6450bef1b9a5ac8ae9a Author: Michael Albinus Date: Tue Mar 14 15:52:16 2017 +0100 Reenable lost Tramp test case * test/lisp/net/tramp-tests.el (tramp-test24-file-name-completion): Reenable lost test case. diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 6965b49a8e..45b4ff2f5a 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -1529,7 +1529,14 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (member (format "%s:" method) (file-name-all-completions (substring method 0 1) "/")))) - (unless (or (zerop (length method)) (zerop (length host))) + (unless (zerop (length host)) + (let ((tramp-default-method (or method tramp-default-method))) + (should + (member + (format "-:%s:" host) + (file-name-all-completions + (format "-:%s" (substring host 0 1)) "/"))))) + (unless (or (zerop (length method)) (zerop (length host))) (should (member (format "%s:%s:" method host) commit 726c6c97ca8f14ad6db67b8d526aca93e88432de Author: Alan Third Date: Mon Mar 13 15:03:11 2017 +0000 Revert "Remove NSEvent loop from ns_select (bug#25265)" This reverts commit 3bd2e9e975ed29daaf03ca7559e4664aade0674f. diff --git a/src/nsterm.m b/src/nsterm.m index 4748cd3e13..b03ad52621 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -4108,9 +4108,6 @@ in certain situations (rapid incoming events). struct input_event event; char c; - NSDate *timeout_date = nil; - NSEvent *ns_event; - NSTRACE_WHEN (NSTRACE_GROUP_EVENTS, "ns_select"); #ifdef HAVE_NATIVE_FS @@ -4173,58 +4170,65 @@ in certain situations (rapid incoming events). { /* No file descriptor, just a timeout, no need to wake fd_handler */ double time = timespectod (*timeout); - timeout_date = [NSDate dateWithTimeIntervalSinceNow: time]; + timed_entry = [[NSTimer scheduledTimerWithTimeInterval: time + target: NSApp + selector: + @selector (timeout_handler:) + userInfo: 0 + repeats: NO] + retain]; + } + else /* No timeout and no file descriptors, can this happen? */ + { + /* Send appdefined so we exit from the loop */ + ns_send_appdefined (-1); } - /* Listen for a new NSEvent. */ - ns_event = [NSApp nextEventMatchingMask: NSEventMaskAny - untilDate: timeout_date - inMode: NSDefaultRunLoopMode - dequeue: NO]; + block_input (); + ns_init_events (&event); + + [NSApp run]; + ns_finish_events (); if (nr > 0 && readfds) { c = 's'; emacs_write_sig (selfds[1], &c, 1); } + unblock_input (); + + t = last_appdefined_event_data; - if (ns_event != nil) + if (t != NO_APPDEFINED_DATA) { - if ([ns_event type] == NSEventTypeApplicationDefined) - { - if ([ns_event data1] < 0) - { - /* The NX_APPDEFINED event we received was a timeout. */ - result = 0; - } - else - { - /* Received back from select () in fd_handler; copy the results */ - pthread_mutex_lock (&select_mutex); - if (readfds) *readfds = select_readfds; - if (writefds) *writefds = select_writefds; - pthread_mutex_unlock (&select_mutex); - result = [ns_event data1]; - } + last_appdefined_event_data = NO_APPDEFINED_DATA; - /* Remove the NX_APPDEFINED event from the queue as it's no - longer needed. */ - [NSApp nextEventMatchingMask: NSEventMaskAny - untilDate: nil - inMode: NSDefaultRunLoopMode - dequeue: YES]; + if (t == -2) + { + /* The NX_APPDEFINED event we received was a timeout. */ + result = 0; } - else + else if (t == -1) { - /* A real NSEvent came in. */ + /* The NX_APPDEFINED event we received was the result of + at least one real input event arriving. */ errno = EINTR; result = -1; } + else + { + /* Received back from select () in fd_handler; copy the results */ + pthread_mutex_lock (&select_mutex); + if (readfds) *readfds = select_readfds; + if (writefds) *writefds = select_writefds; + pthread_mutex_unlock (&select_mutex); + result = t; + } } else { - /* Reading from the NSEvent queue timed out. */ - result = 0; + errno = EINTR; + result = -1; } return result; commit 9bfa797395104d39bfe73e9c1d07b67b5838e0dd Author: Alan Third Date: Mon Mar 13 15:02:37 2017 +0000 Revert "Add missing timeout value in ns_select" This reverts commit a65236214d9202fb69a6ba5169d4ac1a4bcb0b0d. diff --git a/src/nsterm.m b/src/nsterm.m index 05435697cf..4748cd3e13 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -4168,16 +4168,10 @@ in certain situations (rapid incoming events). /* Inform fd_handler that select should be called */ c = 'g'; emacs_write_sig (selfds[1], &c, 1); - - /* We rely on fd_handler timing out to cause - nextEventMatchingMask below to return, so set it's timeout to - an unreasonably long time. */ - timeout_date = [NSDate distantFuture]; } else if (nr == 0 && timeout) { - /* No file descriptor, just a timeout, no need to wake - fd_handler. Set nextEventMatchingMask timeout. */ + /* No file descriptor, just a timeout, no need to wake fd_handler */ double time = timespectod (*timeout); timeout_date = [NSDate dateWithTimeIntervalSinceNow: time]; } commit ea5a7f990dc56ab92b04d668fcf72bb330bf2d78 Author: Alan Third Date: Tue Mar 7 14:45:03 2017 +0000 Remove old macOS compatibility code * src/nsimage.m, src/nsmenu.m, src/nsterm.m: Remove code only for macOS versions below 10.6 as they are not supported in Emacs 25+. diff --git a/src/nsimage.m b/src/nsimage.m index 51367915e1..cc8abf7609 100644 --- a/src/nsimage.m +++ b/src/nsimage.m @@ -179,13 +179,6 @@ @implementation EmacsImage return nil; } - /* The next two lines cause the DPI of the image to be ignored. - This seems to be the behavior users expect. */ -#ifdef NS_IMPL_COCOA -#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 - [image setScalesWhenResized: YES]; -#endif -#endif [image setSize: NSMakeSize([imgRep pixelsWide], [imgRep pixelsHigh])]; [image setName: [NSString stringWithUTF8String: SSDATA (file)]]; @@ -355,13 +348,6 @@ - (void) setPixmapData if ([bmr numberOfPlanes] >= 3) [bmr getBitmapDataPlanes: pixmapData]; - /* The next two lines cause the DPI of the image to be ignored. - This seems to be the behavior users expect. */ -#ifdef NS_IMPL_COCOA -#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 - [self setScalesWhenResized: YES]; -#endif -#endif [self setSize: NSMakeSize([bmr pixelsWide], [bmr pixelsHigh])]; break; diff --git a/src/nsmenu.m b/src/nsmenu.m index 5c6442ad0e..59ea3855ed 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m @@ -1519,11 +1519,6 @@ @implementation EmacsDialogPanel area.size.width = ICONSIZE; area.size.height= ICONSIZE; img = [[NSImage imageNamed: @"NSApplicationIcon"] copy]; -#ifdef NS_IMPL_COCOA -#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 - [img setScalesWhenResized: YES]; -#endif -#endif [img setSize: NSMakeSize (ICONSIZE, ICONSIZE)]; imgView = [[NSImageView alloc] initWithFrame: area]; [imgView setImage: img]; diff --git a/src/nsterm.m b/src/nsterm.m index f985786e19..05435697cf 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -5936,31 +5936,6 @@ flag set (this is probably a bug in the OS). } -#ifdef NS_IMPL_COCOA -/* Needed to pick up Ctrl-tab and possibly other events that Mac OS X - decided not to send key-down for. - See http://osdir.com/ml/editors.vim.mac/2007-10/msg00141.html - This only applies on Tiger and earlier. - If it matches one of these, send it on to keyDown. */ --(void)keyUp: (NSEvent *)theEvent -{ - int flags = [theEvent modifierFlags]; - int code = [theEvent keyCode]; - - NSTRACE ("[EmacsView keyUp:]"); - - if (floor (NSAppKitVersionNumber) <= 824 /*NSAppKitVersionNumber10_4*/ && - code == 0x30 && (flags & NSEventModifierFlagControl) && !(flags & NSEventModifierFlagCommand)) - { - if (NS_KEYLOG) - fprintf (stderr, "keyUp: passed test"); - ns_fake_keydown = YES; - [self keyDown: theEvent]; - } -} -#endif - - /* implementation (called through super interpretKeyEvents:]). */ commit 19a04b4c327aab2ac7c3089adf891aa8078ef19c Author: Michael Albinus Date: Tue Mar 14 15:10:40 2017 +0100 Tune `tramp-completion-file-name-regexp-unified' * lisp/net/tramp.el (tramp-completion-file-name-regexp-unified): Extend this regexp to match also "/". diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index b1f001a95d..aadf09e48f 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -879,7 +879,7 @@ initial value is overwritten by the car of `tramp-file-name-structure'.") ;;;###autoload (defconst tramp-completion-file-name-regexp-unified (concat - "\\`" + "\\`/\\(" ;; Optional multi hop. "\\([^/|:]+:[^/|:]*|\\)*" ;; Last hop. @@ -890,7 +890,7 @@ initial value is overwritten by the car of `tramp-file-name-structure'.") "[^/|:]+") ;; Method separator, user name and host name. "\\(:[^/|:]*\\)?" - "\\'") + "\\)?\\'") "Value for `tramp-completion-file-name-regexp' for unified remoting. See `tramp-file-name-structure' for more explanations.