emacs-diffs
[Top][All Lists]
Advanced

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

master 67a8bdb: Use null-device where appropriate


From: Michael Albinus
Subject: master 67a8bdb: Use null-device where appropriate
Date: Wed, 25 Nov 2020 16:13:41 -0500 (EST)

branch: master
commit 67a8bdb90c9b5865b7f17290c7135b1a5458c36d
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    Use null-device where appropriate
    
    * lisp/filesets.el (filesets-select-command):
    * lisp/shell.el (shell-mode):
    * lisp/term.el (term-exec-1):
    * lisp/wdired.el (wdired-do-symlink-changes):
    * lisp/cedet/ede/pmake.el (ede-proj-makefile-create):
    * lisp/eshell/esh-io.el (eshell-set-output-handle):
    * lisp/gnus/gnus-fun.el (gnus-grab-cam-x-face):
    * lisp/gnus/mml2015.el (mml2015-epg-key-image):
    * lisp/gnus/smime.el (smime-noverify-region):
    * lisp/org/ob-picolisp.el (org-babel-execute:picolisp):
    * lisp/org/ob-screen.el (org-babel-prep-session:screen)
    (org-babel-prep-session:screen):
    * lisp/play/fortune.el (fortune-quiet-strfile-options):
    * lisp/progmodes/cperl-mode.el (cperl-pod2man-build-command):
    * lisp/progmodes/sh-script.el (sh-tmp-file):
    * lisp/vc/diff-mode.el (diff-add-log-current-defuns)
    (diff--font-lock-prettify):
    * lisp/vc/ediff-mult.el (ediff-patch-file-form-meta):
    * lisp/vc/ediff-ptch.el (ediff-map-patch-buffer)
    (ediff-fixup-patch-map, ediff-dispatch-file-patching-job):
    * lisp/vc/vc.el (vc-diff-internal): Use null-device or      (null-device),
    respectively.  (Bug#3736)
---
 lisp/cedet/ede/pmake.el      |  2 +-
 lisp/eshell/esh-io.el        |  3 +--
 lisp/filesets.el             |  4 ++--
 lisp/gnus/gnus-fun.el        |  4 ++--
 lisp/gnus/mml2015.el         |  5 +++--
 lisp/gnus/smime.el           |  2 +-
 lisp/org/ob-picolisp.el      |  6 +++---
 lisp/org/ob-screen.el        |  2 +-
 lisp/play/fortune.el         |  2 +-
 lisp/progmodes/cperl-mode.el |  2 +-
 lisp/progmodes/sh-script.el  |  8 ++++----
 lisp/shell.el                |  2 +-
 lisp/term.el                 |  4 ++--
 lisp/vc/diff-mode.el         |  6 +++---
 lisp/vc/ediff-mult.el        |  2 +-
 lisp/vc/ediff-ptch.el        | 14 +++++++-------
 lisp/vc/vc.el                |  2 +-
 lisp/wdired.el               |  2 +-
 18 files changed, 36 insertions(+), 36 deletions(-)

diff --git a/lisp/cedet/ede/pmake.el b/lisp/cedet/ede/pmake.el
index 9d9a95f..2e3256f 100644
--- a/lisp/cedet/ede/pmake.el
+++ b/lisp/cedet/ede/pmake.el
@@ -180,7 +180,7 @@ MFILENAME is the makefile to generate."
          ;;
          ;; NOTE: This is GNU Make specific.
          (if (and (oref this automatic-dependencies) df)
-             (insert "DEPS_MAGIC := $(shell mkdir .deps > /dev/null "
+             (insert "DEPS_MAGIC := $(shell mkdir .deps > " null-device " "
                      "2>&1 || :)\n"
                      "-include $(DEP_FILES)\n\n"))
          ;;
diff --git a/lisp/eshell/esh-io.el b/lisp/eshell/esh-io.el
index b415486..b0443a4 100644
--- a/lisp/eshell/esh-io.el
+++ b/lisp/eshell/esh-io.el
@@ -382,8 +382,7 @@ it defaults to `insert'."
   "Set handle INDEX, using MODE, to point to TARGET."
   (when target
     (if (and (stringp target)
-            (or (string= target null-device)
-                (string= target "/dev/null")))
+             (string= target (null-device)))
        (aset eshell-current-handles index nil)
       (let ((where (eshell-get-target target mode))
            (current (car (aref eshell-current-handles index))))
diff --git a/lisp/filesets.el b/lisp/filesets.el
index 473f285..883871c 100644
--- a/lisp/filesets.el
+++ b/lisp/filesets.el
@@ -203,8 +203,8 @@ key is supported."
 (defun filesets-select-command (cmd-list)
   "Select one command from CMD-LIST -- a string with space separated names."
   (let ((this (shell-command-to-string
-              (format "which --skip-alias %s 2> /dev/null | head -n 1"
-                      cmd-list))))
+              (format "which --skip-alias %s 2> %s | head -n 1"
+                      cmd-list null-device))))
     (if (equal this "")
        nil
       (file-name-nondirectory (substring this 0 (- (length this) 1))))))
diff --git a/lisp/gnus/gnus-fun.el b/lisp/gnus/gnus-fun.el
index 3218649..b6d6aa4 100644
--- a/lisp/gnus/gnus-fun.el
+++ b/lisp/gnus/gnus-fun.el
@@ -286,8 +286,8 @@ colors of the displayed X-Faces."
     (setq file (car file))
     (with-temp-buffer
       (shell-command
-       (format "pnmcut -left 110 -top 30 -width 144 -height 144 '%s' | ppmnorm 
2>/dev/null | pnmscale -width 48 | ppmtopgm | pgmtopbm -threshold -value 0.92 | 
pbmtoxbm | compface"
-              file)
+       (format "pnmcut -left 110 -top 30 -width 144 -height 144 '%s' | ppmnorm 
2>%s | pnmscale -width 48 | ppmtopgm | pgmtopbm -threshold -value 0.92 | 
pbmtoxbm | compface"
+              file null-device)
        (current-buffer))
       ;;(sleep-for 3)
       (delete-file file)
diff --git a/lisp/gnus/mml2015.el b/lisp/gnus/mml2015.el
index 45c9bbf..0765d7b 100644
--- a/lisp/gnus/mml2015.el
+++ b/lisp/gnus/mml2015.el
@@ -735,8 +735,9 @@ If set, it overrides the setting of 
`mml2015-sign-with-sender'."
     (let* ((coding-system-for-write 'binary)
            (coding-system-for-read 'binary)
            (data (shell-command-to-string
-                  (format "%s --list-options no-show-photos --attribute-fd 3 
--list-keys %s 3>&1 >/dev/null 2>&1"
-                          (shell-quote-argument epg-gpg-program) key-id))))
+                  (format "%s --list-options no-show-photos --attribute-fd 3 
--list-keys %s 3>&1 >%s 2>&1"
+                          (shell-quote-argument epg-gpg-program)
+                         key-id null-device))))
       (when (> (length data) 0)
         (insert (substring data 16))
        (condition-case nil
diff --git a/lisp/gnus/smime.el b/lisp/gnus/smime.el
index eb27fee..08d45e5 100644
--- a/lisp/gnus/smime.el
+++ b/lisp/gnus/smime.el
@@ -398,7 +398,7 @@ Any details (stdout and stderr) are left in the buffer 
specified by
 `smime-details-buffer'."
   (smime-new-details-buffer)
   (if (apply 'smime-call-openssl-region b e (list smime-details-buffer t)
-            "smime" "-verify" "-noverify" "-out" '("/dev/null"))
+            "smime" "-verify" "-noverify" "-out" `(,null-device))
       t
     (insert-buffer-substring smime-details-buffer)
     nil))
diff --git a/lisp/org/ob-picolisp.el b/lisp/org/ob-picolisp.el
index ec2a228..bf31197 100644
--- a/lisp/org/ob-picolisp.el
+++ b/lisp/org/ob-picolisp.el
@@ -111,11 +111,11 @@ This function is called by `org-babel-execute-src-block'."
           (cond
            ((or (member "code" result-params)
                 (member "pp" result-params))
-            (format "(pretty (out \"/dev/null\" %s))" full-body))
+            (format "(pretty (out \"%s\" %s))" null-device full-body))
            ((and (member "value" result-params) (not session))
-            (format "(print (out \"/dev/null\" %s))" full-body))
+            (format "(print (out \"%s\" %s))" null-device full-body))
            ((member "value" result-params)
-            (format "(out \"/dev/null\" %s)" full-body))
+            (format "(out \"%s\" %s)" null-device full-body))
            (t full-body)))
          (result
           (if (not (string= session-name "none"))
diff --git a/lisp/org/ob-screen.el b/lisp/org/ob-screen.el
index 837c18f..f663c9d 100644
--- a/lisp/org/ob-screen.el
+++ b/lisp/org/ob-screen.el
@@ -62,7 +62,7 @@ In case you want to use a different screen than one selected 
by your $PATH")
          (process-name (concat "org-babel: terminal (" session ")")))
     (apply 'start-process process-name "*Messages*"
            terminal `("-T" ,(concat "org-babel: " session) "-e" 
,org-babel-screen-location
-                     "-c" "/dev/null" "-mS" ,(concat "org-babel-session-" 
session)
+                     "-c" ,null-device "-mS" ,(concat "org-babel-session-" 
session)
                      ,cmd))
     ;; XXX: Is there a better way than the following?
     (while (not (org-babel-screen-session-socketname session))
diff --git a/lisp/play/fortune.el b/lisp/play/fortune.el
index c180fd0..ce40aba 100644
--- a/lisp/play/fortune.el
+++ b/lisp/play/fortune.el
@@ -96,7 +96,7 @@ Normally you won't have a reason to change it."
   "Options to pass to the strfile program (a string)."
   :type 'string)
 
-(defcustom fortune-quiet-strfile-options "> /dev/null"
+(defcustom fortune-quiet-strfile-options (concat "> " null-device)
   "Text added to the command for running `strfile'.
 By default it discards the output produced by `strfile'.
 Set this to \"\" if you would like to see the output."
diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el
index 7a24bfc..dd36c68 100644
--- a/lisp/progmodes/cperl-mode.el
+++ b/lisp/progmodes/cperl-mode.el
@@ -8156,7 +8156,7 @@ the appropriate statement modifier."
 
 (defun cperl-pod2man-build-command ()
   "Builds the entire background manpage and cleaning command."
-  (let ((command (concat pod2man-program " %s 2>/dev/null"))
+  (let ((command (concat pod2man-program " %s 2>" null-device))
         (flist (and (boundp 'Man-filter-list) Man-filter-list)))
     (while (and flist (car flist))
       (let ((pcom (car (car flist)))
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 3b24cab..b7327e7 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -2801,12 +2801,12 @@ t means to return a list of all possible completions of 
STRING.
            (not (bolp))
            ?\n)
        "exit:\n"
-       "rm $tmp* >&/dev/null" > \n)
+       "rm $tmp* >&" null-device > \n)
   (es (file-name-nondirectory (buffer-file-name))
       > "local( signals = $signals sighup sigint;" \n
       > "tmp = `{ mktemp -t " str ".XXXXXX } ) {" \n
       > "catch @ e {" \n
-      > "rm $tmp^* >[2]/dev/null" \n
+      > "rm $tmp^* >[2]" null-device \n
       "throw $e" \n
       "} {" > \n
       _ \n
@@ -2816,10 +2816,10 @@ t means to return a list of all possible completions of 
STRING.
         7 "EXIT")
   (rc (file-name-nondirectory (buffer-file-name))
       > "tmp = `{ mktemp -t " str ".XXXXXX }" \n
-      "fn sigexit { rm $tmp^* >[2]/dev/null }" \n)
+      "fn sigexit { rm $tmp^* >[2]" null-device " }" \n)
   (sh (file-name-nondirectory (buffer-file-name))
       > "TMP=`mktemp -t " str ".XXXXXX`" \n
-      "trap \"rm $TMP* 2>/dev/null\" " ?0 \n))
+      "trap \"rm $TMP* 2>" null-device "\" " ?0 \n))
 
 
 
diff --git a/lisp/shell.el b/lisp/shell.el
index 43ad587..51937cd 100644
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -605,7 +605,7 @@ buffer."
                       (t "~/.history")))))
       (if (or (equal comint-input-ring-file-name "")
              (equal (file-truename comint-input-ring-file-name)
-                    (file-truename "/dev/null")))
+                    (file-truename null-device)))
          (setq comint-input-ring-file-name nil))
       ;; Arrange to write out the input ring on exit, if the shell doesn't
       ;; do this itself.
diff --git a/lisp/term.el b/lisp/term.el
index ca64d28..148d7a7 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -1572,9 +1572,9 @@ Nil if unknown.")
             process-environment))
     (apply #'start-process name buffer
           "/bin/sh" "-c"
-          (format "stty -nl echo rows %d columns %d sane 2>/dev/null;\
+          (format "stty -nl echo rows %d columns %d sane 2>%s;\
 if [ $1 = .. ]; then shift; fi; exec \"$@\""
-                  term-height term-width)
+                  term-height term-width null-device)
           ".."
           command switches)))
 
diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index 0a90613..51f4180 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -2326,7 +2326,7 @@ where DEFUN... is a list of function names found in FILE."
                       ;; would look for non-existent files like
                       ;; /dev/null.
                       (diff-find-source-location
-                       (not (equal "/dev/null"
+                       (not (equal null-device
                                    (car (diff-hunk-file-names t))))))
                      (other-buf nil)
                      (goto-otherbuf
@@ -2567,8 +2567,8 @@ fixed, visit it in a buffer."
                  (concat "diff.*\n"
                          "\\(?:\\(?:new file\\|deleted\\).*\n\\)?"
                          "\\(?:index.*\n\\)?"
-                         "--- \\(?:/dev/null\\|a/\\(.*\\)\\)\n"
-                         "\\+\\+\\+ \\(?:/dev/null\\|b/\\(.*\\)\\)\n"))))
+                         "--- \\(?:" null-device "\\|a/\\(.*\\)\\)\n"
+                         "\\+\\+\\+ \\(?:" null-device "\\|b/\\(.*\\)\\)\n"))))
         (put-text-property (match-beginning 0)
                            (or (match-beginning 2) (match-beginning 1))
                            'display (propertize
diff --git a/lisp/vc/ediff-mult.el b/lisp/vc/ediff-mult.el
index c977291..b483778 100644
--- a/lisp/vc/ediff-mult.el
+++ b/lisp/vc/ediff-mult.el
@@ -2317,7 +2317,7 @@ If this is a session registry buffer then just bury it."
         (meta-patchbuf ediff-meta-patchbufer)
         session-buf beg-marker end-marker)
 
-    (if (or (file-directory-p file) (string-match "/dev/null" file))
+    (if (or (file-directory-p file) (string-match null-device file))
        (user-error "`%s' is not an ordinary file" (file-name-as-directory 
file)))
     (setq session-buf (ediff-get-session-buffer info)
          beg-marker (ediff-get-session-objB-name info)
diff --git a/lisp/vc/ediff-ptch.el b/lisp/vc/ediff-ptch.el
index f6af5a4..08640fc 100644
--- a/lisp/vc/ediff-ptch.el
+++ b/lisp/vc/ediff-ptch.el
@@ -193,7 +193,7 @@ program."
     (let ((count 0)
          (mark1 (point-min-marker))
          (mark1-end (point-min))
-         (possible-file-names '("/dev/null" . "/dev/null"))
+         (possible-file-names `(,null-device . ,null-device))
          mark2-end mark2 filenames
          beg1 beg2 end1 end2
          patch-map opoint)
@@ -217,10 +217,10 @@ program."
            (setq possible-file-names
                  (cons (if (and beg1 end1)
                            (buffer-substring beg1 end1)
-                         "/dev/null")
+                         null-device)
                        (if (and beg2 end2)
                            (buffer-substring beg2 end2)
-                         "/dev/null")))
+                         null-device)))
             ;; Remove file junk (Bug#26084).
             (while (re-search-backward
                     (concat "^\\(?:" diff-file-junk-re "\\)") mark1-end t)
@@ -309,12 +309,12 @@ program."
                                   (file-exists-p (cdr m2)))
                          (setq base-dir1 (car m1)
                                base-dir2 (car m2))))))))
-             (or (string= (car proposed-file-names) "/dev/null")
+             (or (string= (car proposed-file-names) null-device)
                  (setcar proposed-file-names
                          (ediff-file-name-sans-prefix
                           (car proposed-file-names) base-dir1)))
              (or (string=
-                  (cdr proposed-file-names) "/dev/null")
+                  (cdr proposed-file-names) null-device)
                  (setcdr proposed-file-names
                          (ediff-file-name-sans-prefix
                           (cdr proposed-file-names) base-dir2)))
@@ -323,7 +323,7 @@ program."
 
     ;; take the given file name into account
     (or (file-directory-p filename)
-       (string= "/dev/null" filename)
+       (string= null-device filename)
        (setcar (ediff-get-session-objA (car ediff-patch-map))
                (cons (file-name-nondirectory filename)
                      (file-name-nondirectory filename))))
@@ -582,7 +582,7 @@ optional argument, then use it."
         patch-buf
         (if (and ediff-patch-map
                  (not (string-match-p
-                       "^/dev/null"
+                       (concat "^" null-device)
                        ;; this is the file to patch
                        (ediff-get-session-objA-name (car ediff-patch-map))))
                  (> (length
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 83f2596..1a24611 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -1774,7 +1774,7 @@ Return t if the buffer had changes, nil otherwise."
               ;; Diff it against /dev/null.
               (apply #'vc-do-command buffer
                      (if async 'async 1) "diff" file
-                     (append (vc-switches nil 'diff) '("/dev/null"))))))
+                     (append (vc-switches nil 'diff) `(,(null-device)))))))
         (setq files (nreverse filtered))))
     (vc-call-backend (car vc-fileset) 'diff files rev1 rev2 buffer async)
     (set-buffer buffer)
diff --git a/lisp/wdired.el b/lisp/wdired.el
index bb32da3..ebe1961 100644
--- a/lisp/wdired.el
+++ b/lisp/wdired.el
@@ -763,7 +763,7 @@ If OLD, return the old target.  If MOVE, move point before 
it."
       (unless (equal link-to-new link-to-ori)
         (setq changes t)
         (if (equal link-to-new "") ;empty filename!
-            (setq link-to-new "/dev/null"))
+            (setq link-to-new (null-device)))
         (condition-case err
             (progn
               (delete-file link-from)



reply via email to

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