diff --git a/lisp/cedet/ede/pmake.el b/lisp/cedet/ede/pmake.el index 9d9a95fd763..2e3256f4be5 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 b4154861908..b0443a4acee 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 473f2858ddd..883871c4d80 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 3218649761a..b6d6aa49298 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 45c9bbfe905..0765d7b245d 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 eb27fee88ce..08d45e53155 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 ec2a228456a..bf31197d486 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 837c18f8407..f663c9d197c 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 c180fd06c34..ce40aba8e2e 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 7a24bfcbeba..dd36c68c872 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 3b24cabe8bd..b7327e75583 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 43ad58774b8..51937cdeef3 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 ca64d28d9b3..148d7a7c286 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 0a906136047..51f41803169 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 c977291a524..b48377815a4 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 f6af5a45550..08640fcece9 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 83f2596865f..1a246119a69 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 bb32da3e3a2..ebe19613943 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)