emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/native-comp fcce8dd 2/2: Merge remote-tracking branch 'savannah/


From: Andrea Corallo
Subject: feature/native-comp fcce8dd 2/2: Merge remote-tracking branch 'savannah/master' into HEAD
Date: Fri, 3 Apr 2020 14:07:26 -0400 (EDT)

branch: feature/native-comp
commit fcce8dd3614c4217ef7f908a059c0f5731517782
Merge: 9bf9550 00f7744
Author: Andrea Corallo <address@hidden>
Commit: Andrea Corallo <address@hidden>

    Merge remote-tracking branch 'savannah/master' into HEAD
---
 etc/NEWS                              | 21 ++++++++++++++
 lisp/calendar/time-date.el            |  2 ++
 lisp/emacs-lisp/find-func.el          |  1 +
 lisp/files.el                         |  7 +----
 lisp/net/dns.el                       | 22 +++++++++------
 lisp/play/gomoku.el                   | 46 ++++++++++++++++++++++++-------
 lisp/subr.el                          |  7 +----
 lisp/textmodes/texinfo.el             | 13 +++++++--
 src/process.c                         | 16 ++++-------
 test/lisp/calendar/time-date-tests.el |  4 ++-
 test/lisp/net/network-stream-tests.el | 52 +++++++++++++++++++++++++++++++++++
 11 files changed, 146 insertions(+), 45 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 7e578f8..fa33364 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -93,6 +93,11 @@ line numbers that were previously jumped to.
 ** When 'suggest-key-bindings' is non-nil, the completion list of 'M-x'
 shows equivalent key bindings for all commands that have them.
 
+---
+** Movement commands in 'gomoku-mode' are fixed.
+'gomoku-move-sw' and 'gomoku-move-ne' now work correctly, and
+horizontal movements now stop at the edge of the board.
+
 
 * Changes in Specialized Modes and Packages in Emacs 28.1
 
@@ -236,6 +241,12 @@ case-insensitive matching of messages when the old 
behaviour is
 required, but the recommended solution is to use a correctly matching
 regexp instead.
 
+** Texinfo
+
+---
+*** New customizable option 'texinfo-texi2dvi-options'.
+This is used when invoking 'texi2dvi' from 'texinfo-tex-buffer'.
+
 
 * New Modes and Packages in Emacs 28.1
 
@@ -306,6 +317,16 @@ optional argument specifying whether to follow symbolic 
links.
 ** 'parse-time-string' can now parse ISO 8601 format strings,
 such as "2020-01-15T16:12:21-08:00".
 
+---
+** 'make-network-process', 'make-serial-process' :coding behavior change.
+Previously, passing ":coding nil" to either of these functions would
+override any non-nil binding for 'coding-system-for-read' and
+'coding-system-for-write'.  For consistency with 'make-process' and
+'make-pipe-process', passing ":coding nil" is now ignored.  No code in
+Emacs depended on the previous behavior; if you really want the
+process' coding-system to be nil, use 'set-process-coding-system'
+after the process has been created, or pass in ":coding '(nil nil)".
+
 
 * Changes in Emacs 28.1 on Non-Free Operating Systems
 
diff --git a/lisp/calendar/time-date.el b/lisp/calendar/time-date.el
index e2402de..eeb0992 100644
--- a/lisp/calendar/time-date.el
+++ b/lisp/calendar/time-date.el
@@ -355,6 +355,8 @@ is output until the first non-zero unit is encountered."
 
 (defun date-days-in-month (year month)
   "The number of days in MONTH in YEAR."
+  (unless (and (numberp month) (<= 1 month 12))
+    (error "Month %s is invalid" month))
   (if (= month 2)
       (if (date-leap-year-p year)
           29
diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el
index fa87b25..efbcfb3 100644
--- a/lisp/emacs-lisp/find-func.el
+++ b/lisp/emacs-lisp/find-func.el
@@ -287,6 +287,7 @@ Interactively, prompt for LIBRARY using the one at or near 
point."
       (switch-to-buffer (find-file-noselect (find-library-name library)))
     (run-hooks 'find-function-after-hook)))
 
+;;;###autoload
 (defun read-library-name ()
   "Read and return a library name, defaulting to the one near point.
 
diff --git a/lisp/files.el b/lisp/files.el
index 55a0958..beafdac 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -1103,12 +1103,7 @@ well as `load-file-rep-suffixes').
 
 See Info node `(emacs)Lisp Libraries' for more details.
 See `load-file' for a different interface to `load'."
-  (interactive
-   (let (completion-ignored-extensions)
-     (list (completing-read "Load library: "
-                            (apply-partially 'locate-file-completion-table
-                                             load-path
-                                             (get-load-suffixes))))))
+  (interactive (list (read-library-name)))
   (load library))
 
 (defun file-remote-p (file &optional identification connected)
diff --git a/lisp/net/dns.el b/lisp/net/dns.el
index 78d4827..177df4e 100644
--- a/lisp/net/dns.el
+++ b/lisp/net/dns.el
@@ -315,8 +315,8 @@ If TCP-P, the first two bytes of the package with be the 
length field."
 (defun dns-set-servers ()
   "Set `dns-servers' to a list of DNS servers or nil if none are found.
 Parses \"/etc/resolv.conf\" or calls \"nslookup\"."
+  (setq dns-servers nil)
   (or (when (file-exists-p "/etc/resolv.conf")
-       (setq dns-servers nil)
        (with-temp-buffer
          (insert-file-contents "/etc/resolv.conf")
          (goto-char (point-min))
@@ -327,9 +327,9 @@ Parses \"/etc/resolv.conf\" or calls \"nslookup\"."
        (with-temp-buffer
          (call-process "nslookup" nil t nil "localhost")
          (goto-char (point-min))
-         (re-search-forward
-          "^Address:[ \t]*\\([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\\)" nil t)
-         (setq dns-servers (list (match-string 1))))))
+          (when (re-search-forward
+          "^Address:[ 
\t]*\\([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\\|[[:xdigit:]:]*\\)" nil t)
+             (setq dns-servers (list (match-string 1)))))))
   (when (fboundp 'network-interface-list)
     (setq dns-servers-valid-for-interfaces (network-interface-list))))
 
@@ -357,7 +357,9 @@ Parses \"/etc/resolv.conf\" or calls \"nslookup\"."
   `(let ((server ,server)
         (coding-system-for-read 'binary)
         (coding-system-for-write 'binary))
-     (if (fboundp 'make-network-process)
+     (if (and
+          (fboundp 'make-network-process)
+          (featurep 'make-network-process '(:type datagram)))
         (make-network-process
          :name "dns"
          :coding 'binary
@@ -365,9 +367,9 @@ Parses \"/etc/resolv.conf\" or calls \"nslookup\"."
          :host server
          :service "domain"
          :type 'datagram)
-       ;; Older versions of Emacs doesn't have
-       ;; `make-network-process', so we fall back on opening a TCP
-       ;; connection to the DNS server.
+       ;; Older versions of Emacs do not have `make-network-process',
+       ;; and on MS-Windows datagram sockets are not supported, so we
+       ;; fall back on opening a TCP connection to the DNS server.
        (open-network-stream "dns" (current-buffer) server "domain"))))
 
 (defvar dns-cache (make-vector 4096 0))
@@ -400,7 +402,9 @@ If REVERSEP, look up an IP address."
          type 'PTR))
 
   (if (not dns-servers)
-      (message "No DNS server configuration found")
+      (progn
+        (message "No DNS server configuration found")
+        nil)
     (with-temp-buffer
       (set-buffer-multibyte nil)
       (let ((process (condition-case ()
diff --git a/lisp/play/gomoku.el b/lisp/play/gomoku.el
index 6e0061d..4033986 100644
--- a/lisp/play/gomoku.el
+++ b/lisp/play/gomoku.el
@@ -110,8 +110,8 @@ One useful value to include is `turn-on-font-lock' to 
highlight the pieces."
     (define-key map "u" 'gomoku-move-ne)                   ; u
     (define-key map "b" 'gomoku-move-sw)                   ; b
     (define-key map "n" 'gomoku-move-se)                   ; n
-    (define-key map "h" 'backward-char)                            ; h
-    (define-key map "l" 'forward-char)                     ; l
+    (define-key map "h" 'gomoku-move-left)                 ; h
+    (define-key map "l" 'gomoku-move-right)                ; l
     (define-key map "j" 'gomoku-move-down)                 ; j
     (define-key map "k" 'gomoku-move-up)                   ; k
 
@@ -119,11 +119,13 @@ One useful value to include is `turn-on-font-lock' to 
highlight the pieces."
     (define-key map [kp-9] 'gomoku-move-ne)
     (define-key map [kp-1] 'gomoku-move-sw)
     (define-key map [kp-3] 'gomoku-move-se)
-    (define-key map [kp-4] 'backward-char)
-    (define-key map [kp-6] 'forward-char)
+    (define-key map [kp-4] 'gomoku-move-left)
+    (define-key map [kp-6] 'gomoku-move-right)
     (define-key map [kp-2] 'gomoku-move-down)
     (define-key map [kp-8] 'gomoku-move-up)
 
+    (define-key map "\C-b" 'gomoku-move-left)              ; C-b
+    (define-key map "\C-f" 'gomoku-move-right)             ; C-f
     (define-key map "\C-n" 'gomoku-move-down)              ; C-n
     (define-key map "\C-p" 'gomoku-move-up)                ; C-p
 
@@ -146,6 +148,10 @@ One useful value to include is `turn-on-font-lock' to 
highlight the pieces."
     (define-key map [mouse-2] 'gomoku-mouse-play)
     (define-key map [drag-mouse-2] 'gomoku-mouse-play)
 
+    (define-key map [remap backward-char] 'gomoku-move-left)
+    (define-key map [remap left-char] 'gomoku-move-left)
+    (define-key map [remap forward-char] 'gomoku-move-right)
+    (define-key map [remap right-char] 'gomoku-move-right)
     (define-key map [remap previous-line] 'gomoku-move-up)
     (define-key map [remap next-line] 'gomoku-move-down)
     (define-key map [remap move-beginning-of-line] 'gomoku-beginning-of-line)
@@ -954,6 +960,11 @@ If the game is finished, this command requests for another 
game."
         ;; 2 instead of 1 because WINDOW-HEIGHT includes the mode line !
         gomoku-square-height)))
 
+(defun gomoku-point-x ()
+  "Return the board column where point is."
+  (1+ (/ (- (current-column) gomoku-x-offset)
+        gomoku-square-width)))
+
 (defun gomoku-point-y ()
   "Return the board row where point is."
   (1+ (/ (- (count-lines (point-min) (point))
@@ -1143,13 +1154,28 @@ If the game is finished, this command requests for 
another game."
           (skip-chars-forward gomoku--intangible-chars)
           (when (eobp)
             (skip-chars-backward gomoku--intangible-chars)
-            (forward-char -1)))
+            (gomoku-move-left)))
       (skip-chars-backward gomoku--intangible-chars)
       (if (bobp)
           (skip-chars-forward gomoku--intangible-chars)
-        (forward-char -1))))
+        (gomoku-move-left))))
   (setq gomoku--last-pos (point)))
 
+;; forward-char and backward-char don't always move the right number
+;; of characters. Also, these functions check if you're on the edge of
+;; the screen.
+(defun gomoku-move-right ()
+  "Move point right one column on the Gomoku board."
+  (interactive)
+  (when (< (gomoku-point-x) gomoku-board-width)
+    (forward-char gomoku-square-width)))
+
+(defun gomoku-move-left ()
+  "Move point left one column on the Gomoku board."
+  (interactive)
+  (when (> (gomoku-point-x) 1)
+    (backward-char gomoku-square-width)))
+
 ;; previous-line and next-line don't work right with intangible newlines
 (defun gomoku-move-down ()
   "Move point down one row on the Gomoku board."
@@ -1171,25 +1197,25 @@ If the game is finished, this command requests for 
another game."
   "Move point North East on the Gomoku board."
   (interactive)
   (gomoku-move-up)
-  (forward-char))
+  (gomoku-move-right))
 
 (defun gomoku-move-se ()
   "Move point South East on the Gomoku board."
   (interactive)
   (gomoku-move-down)
-  (forward-char))
+  (gomoku-move-right))
 
 (defun gomoku-move-nw ()
   "Move point North West on the Gomoku board."
   (interactive)
   (gomoku-move-up)
-  (backward-char))
+  (gomoku-move-left))
 
 (defun gomoku-move-sw ()
   "Move point South West on the Gomoku board."
   (interactive)
   (gomoku-move-down)
-  (backward-char))
+  (gomoku-move-left))
 
 (defun gomoku-beginning-of-line ()
   "Move point to first square on the Gomoku board row."
diff --git a/lisp/subr.el b/lisp/subr.el
index 70f33ee..70a74fb 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2301,12 +2301,7 @@ is used instead of `load-path'.
 When called from a program, the file name is normally returned as a
 string.  When run interactively, the argument INTERACTIVE-CALL is t,
 and the file name is displayed in the echo area."
-  (interactive (list (completing-read "Locate library: "
-                                     (apply-partially
-                                       'locate-file-completion-table
-                                       load-path (get-load-suffixes)))
-                    nil nil
-                    t))
+  (interactive (list (read-library-name) nil nil t))
   (let ((file (locate-file library
                           (or path load-path)
                           (append (unless nosuffix (get-load-suffixes))
diff --git a/lisp/textmodes/texinfo.el b/lisp/textmodes/texinfo.el
index 438cb77..66378cb 100644
--- a/lisp/textmodes/texinfo.el
+++ b/lisp/textmodes/texinfo.el
@@ -958,6 +958,12 @@ to jump to the corresponding spot in the Texinfo source 
file."
   :type 'string
   :group 'texinfo)
 
+(defcustom texinfo-texi2dvi-options ""
+  "Command line options for `texinfo-texi2dvi-command'."
+  :type 'string
+  :group 'texinfo
+  :version "28.1")
+
 (defcustom texinfo-tex-command "tex"
   "Command used by `texinfo-tex-region' to run TeX on a region."
   :type 'string
@@ -1002,9 +1008,10 @@ The value of `texinfo-tex-trailer' is appended to the 
temporary file after the r
   (interactive)
   (require 'tex-mode)
   (let ((tex-command texinfo-texi2dvi-command)
-       ;; Disable tex-start-options-string.  texi2dvi would not
-       ;; understand anything specified here.
-       (tex-start-options-string ""))
+       (tex-start-options texinfo-texi2dvi-options)
+       ;; Disable tex-start-commands.  texi2dvi would not understand
+       ;; anything specified here.
+        (tex-start-commands ""))
     (tex-buffer)))
 
 (defun texinfo-texindex ()
diff --git a/src/process.c b/src/process.c
index 07881d6..e6d18fb 100644
--- a/src/process.c
+++ b/src/process.c
@@ -3188,14 +3188,12 @@ usage:  (make-serial-process &rest ARGS)  */)
                       BUF_ZV_BYTE (XBUFFER (buffer)));
     }
 
-  tem = Fplist_member (contact, QCcoding);
-  if (!NILP (tem) && (!CONSP (tem) || !CONSP (XCDR (tem))))
-    tem = Qnil;
+  tem = Fplist_get (contact, QCcoding);
 
   val = Qnil;
   if (!NILP (tem))
     {
-      val = XCAR (XCDR (tem));
+      val = tem;
       if (CONSP (val))
        val = XCAR (val);
     }
@@ -3209,7 +3207,7 @@ usage:  (make-serial-process &rest ARGS)  */)
   val = Qnil;
   if (!NILP (tem))
     {
-      val = XCAR (XCDR (tem));
+      val = tem;
       if (CONSP (val))
        val = XCDR (val);
     }
@@ -3244,16 +3242,14 @@ set_network_socket_coding_system (Lisp_Object proc, 
Lisp_Object host,
   Lisp_Object coding_systems = Qt;
   Lisp_Object val;
 
-  tem = Fplist_member (contact, QCcoding);
-  if (!NILP (tem) && (!CONSP (tem) || !CONSP (XCDR (tem))))
-    tem = Qnil;  /* No error message (too late!).  */
+  tem = Fplist_get (contact, QCcoding);
 
   /* Setup coding systems for communicating with the network stream.  */
   /* Qt denotes we have not yet called Ffind_operation_coding_system.  */
 
   if (!NILP (tem))
     {
-      val = XCAR (XCDR (tem));
+      val = tem;
       if (CONSP (val))
        val = XCAR (val);
     }
@@ -3287,7 +3283,7 @@ set_network_socket_coding_system (Lisp_Object proc, 
Lisp_Object host,
 
   if (!NILP (tem))
     {
-      val = XCAR (XCDR (tem));
+      val = tem;
       if (CONSP (val))
        val = XCDR (val);
     }
diff --git a/test/lisp/calendar/time-date-tests.el 
b/test/lisp/calendar/time-date-tests.el
index 4c8f18a..3eecc67 100644
--- a/test/lisp/calendar/time-date-tests.el
+++ b/test/lisp/calendar/time-date-tests.el
@@ -31,7 +31,9 @@
 (ert-deftest test-days-in-month ()
   (should (= (date-days-in-month 2004 2) 29))
   (should (= (date-days-in-month 2004 3) 31))
-  (should-not (= (date-days-in-month 1900 3) 28)))
+  (should-not (= (date-days-in-month 1900 3) 28))
+  (should-error (date-days-in-month 2020 15))
+  (should-error (date-days-in-month 2020 'foo)))
 
 (ert-deftest test-ordinal ()
   (should (equal (date-ordinal-to-time 2008 271)
diff --git a/test/lisp/net/network-stream-tests.el 
b/test/lisp/net/network-stream-tests.el
index 2868654..7a98254 100644
--- a/test/lisp/net/network-stream-tests.el
+++ b/test/lisp/net/network-stream-tests.el
@@ -724,4 +724,56 @@
     44777
     (vector :nowait t))))
 
+(ert-deftest check-network-process-coding-system-bind ()
+  "Check that binding coding-system-for-{read,write} works."
+  (let* ((coding-system-for-read 'binary)
+         (coding-system-for-write 'utf-8-unix)
+         (server
+         (make-network-process
+          :name "server"
+          :server t
+          :noquery t
+          :family 'ipv4
+          :service t
+          :host 'local))
+         (coding (process-coding-system server)))
+    (should (eq (car coding) 'binary))
+    (should (eq (cdr coding) 'utf-8-unix))
+    (delete-process server)))
+
+(ert-deftest check-network-process-coding-system-no-override ()
+  "Check that coding-system-for-{read,write} is not overridden by :coding nil."
+  (let* ((coding-system-for-read 'binary)
+         (coding-system-for-write 'utf-8-unix)
+         (server
+         (make-network-process
+          :name "server"
+          :server t
+          :noquery t
+          :family 'ipv4
+          :service t
+          :coding nil
+          :host 'local))
+         (coding (process-coding-system server)))
+    (should (eq (car coding) 'binary))
+    (should (eq (cdr coding) 'utf-8-unix))
+    (delete-process server)))
+
+(ert-deftest check-network-process-coding-system-override ()
+  "Check that :coding non-nil overrides coding-system-for-{read,write}."
+  (let* ((coding-system-for-read 'binary)
+         (coding-system-for-write 'utf-8-unix)
+         (server
+         (make-network-process
+          :name "server"
+          :server t
+          :noquery t
+          :family 'ipv4
+          :service t
+          :coding 'georgian-academy
+          :host 'local))
+         (coding (process-coding-system server)))
+    (should (eq (car coding) 'georgian-academy))
+    (should (eq (cdr coding) 'georgian-academy))
+    (delete-process server)))
 ;;; network-stream-tests.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]