]> git.eshelyaron.com Git - emacs.git/commitdiff
Use null-device where appropriate
authorMichael Albinus <michael.albinus@gmx.de>
Wed, 25 Nov 2020 21:13:33 +0000 (22:13 +0100)
committerMichael Albinus <michael.albinus@gmx.de>
Wed, 25 Nov 2020 21:13:33 +0000 (22:13 +0100)
* 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)

18 files changed:
lisp/cedet/ede/pmake.el
lisp/eshell/esh-io.el
lisp/filesets.el
lisp/gnus/gnus-fun.el
lisp/gnus/mml2015.el
lisp/gnus/smime.el
lisp/org/ob-picolisp.el
lisp/org/ob-screen.el
lisp/play/fortune.el
lisp/progmodes/cperl-mode.el
lisp/progmodes/sh-script.el
lisp/shell.el
lisp/term.el
lisp/vc/diff-mode.el
lisp/vc/ediff-mult.el
lisp/vc/ediff-ptch.el
lisp/vc/vc.el
lisp/wdired.el

index 9d9a95fd763ae077b57eaea858f31a79d9091182..2e3256f4be52f59a7e7d498798fdaa934613544d 100644 (file)
@@ -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"))
          ;;
index b4154861908fea799d01fbccbde4bbf3ce3e1cf9..b0443a4acee70dfe4c394bd26de1cd889f589f57 100644 (file)
@@ -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))))
index 473f2858ddd9ca6a4ba7c4d0739fe2e645458727..883871c4d804bd5b86bc82066f24b97c5bf422ab 100644 (file)
@@ -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))))))
index 3218649761ab1e76707dffc7a1f29a3637ef9f3b..b6d6aa49298aad165ddc870172dbed6d2d8d1700 100644 (file)
@@ -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)
index 45c9bbfe905c6c17c309c6c747bf1d32d420b90c..0765d7b245ddabab5bafd923e7228e2cc07c6936 100644 (file)
@@ -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
index eb27fee88ce8f62958843a3344e97e9b0375180d..08d45e5315546fa23e473770801e683922fd5c66 100644 (file)
@@ -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))
index ec2a228456ae512df218eda8202758e5dd4bbfb5..bf31197d48642394cafe97608640f004247e0eed 100644 (file)
@@ -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"))
index 837c18f840790c100072f33679e975493dbb4f02..f663c9d197c0d4fc381e35a8a853e7c90075630b 100644 (file)
@@ -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))
index c180fd06c34ea1c09ec092d96257e3951bdaf1a4..ce40aba8e2e7dcd836949d448f1d29fb8199915a 100644 (file)
@@ -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."
index 7a24bfcbebae69d632750e9348bacc25edf07cf2..dd36c68c87261a8aae60c36ae52dd411347d5af6 100644 (file)
@@ -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)))
index 3b24cabe8bdcdf9783b61165588df45a561e33e0..b7327e75583ae55f11a24f4cd8cd0fce663639c5 100644 (file)
@@ -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))
 
 
 
index 43ad58774b84df5a4557fbac8c89b225087dd559..51937cdeef3bffdce4f469e279b1db742534506c 100644 (file)
@@ -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.
index ca64d28d9b3ae68f47d64ce0aeceff55fdca7cc5..148d7a7c286fcbfa409d008698ff762bb50862b3 100644 (file)
@@ -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)))
 
index 0a90613604778e91ef9084ab05fe424b1ab58dba..51f418031699d7c920e098066a3708a7e11eb368 100644 (file)
@@ -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
index c977291a524e41dc35feb84ca4296afef0f07e7b..b48377815a4fca09394fe93ce2377b36064d69cc 100644 (file)
@@ -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)
index f6af5a45550634c1a3d45951775b74ed5347ad9a..08640fcece9c8bbeee4e80d98d9d5e039e57696d 100644 (file)
@@ -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
index 83f2596865f80a064cfd335ee0258e4c17799da1..1a246119a694732ad6126a03b4bcc56b27832b07 100644 (file)
@@ -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)
index bb32da3e3a2eee772b5163b575a4c89ac1270f55..ebe19613943915caa1f1ed3347c10b03f5f42ab2 100644 (file)
@@ -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)