branch: externals/compat
commit 21b6e6fb26d18e948a1a113a87313db2b465699d
Author: Philip Kaludercic <phil...@posteo.net>
Commit: Philip Kaludercic <phil...@posteo.net>

    Add null-device
    
    The implementation is based on tramp-compat.
---
 MANUAL       |  1 +
 compat-28.el | 12 ++++++++++++
 2 files changed, 13 insertions(+)

diff --git a/MANUAL b/MANUAL
index f7219f2cb1..2e6f6f8f84 100644
--- a/MANUAL
+++ b/MANUAL
@@ -396,6 +396,7 @@ provided by Compat by default:
   Files]].
 - Function: file-backup-file-names :: See [[info:elisp#Backup Names][(elisp) 
Backup Names]].
 - Function: make-lock-file-name :: Defined in ~files.el~.
+- Function: null-device :: Defined in ~files.el~.
 
 These functions are prefixed with ~compat~ prefix, and are only loaded
 when ~compat-28~ is required:
diff --git a/compat-28.el b/compat-28.el
index 2f8c330355..f6f78b955a 100644
--- a/compat-28.el
+++ b/compat-28.el
@@ -685,6 +685,18 @@ onwards does."
     ".#" (file-name-nondirectory filename))
    (file-name-directory filename)))
 
+;;;; Defined in files-x.el
+
+(declare-function tramp-tramp-file-p "tramp" (name))
+
+;;* UNTESTED
+(compat-defun null-device ()
+  "Return the best guess for the null device."
+  (require 'tramp)
+  (if (tramp-tramp-file-p default-directory)
+      "/dev/null"
+    null-device))
+
 ;;;; Defined in minibuffer.el
 
 (compat-defun format-prompt (prompt default &rest format-args)

Reply via email to