1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-28 07:45:00 +00:00

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)
This commit is contained in:
Michael Albinus 2020-11-25 22:13:33 +01:00
parent b5e34c34bc
commit 67a8bdb90c
18 changed files with 36 additions and 36 deletions

View 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"))
;;

View 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))))

View 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))))))

View 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)

View 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

View 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))

View 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"))

View 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))

View 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."

View 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)))

View 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))

View 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.

View 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)))

View 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

View 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)

View 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

View 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)

View 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)