emacs-diffs
[Top][All Lists]
Advanced

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

master 707124d2b9: Make 'run-dig' command obsolete in favor of 'dig'


From: Stefan Kangas
Subject: master 707124d2b9: Make 'run-dig' command obsolete in favor of 'dig'
Date: Thu, 7 Jul 2022 05:35:41 -0400 (EDT)

branch: master
commit 707124d2b92780b4f21d72c7c62899e074fa8ced
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>

    Make 'run-dig' command obsolete in favor of 'dig'
    
    * lisp/net/net-utils.el (run-dig): Redefine in terms of `dig' and make
    obsolete.  (Bug#56432).
    (dig-program): Delete duplicate defcustom; it is also in dig.el.
    (dig-program-options): Move from here...
    * lisp/net/dig.el (dig-program-options): ...to here.
    (dig-invoke): Respect 'dig-program-options'.
    (dig): Prompt for DNS server when given double prefix argument.
---
 etc/NEWS              |  3 +++
 lisp/net/dig.el       | 25 ++++++++++++++++++++-----
 lisp/net/net-utils.el | 22 ++--------------------
 3 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 2013260c15..39c3aabb11 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2042,6 +2042,9 @@ back the old behavior.
 This command prompts for a recently opened file in the minibuffer, and
 visits it.
 
+---
+*** The 'run-dig' command is now obsolete; use 'dig' instead.
+
 ---
 ** The autoarg.el library is now marked obsolete.
 This library provides the 'autoarg-mode' and 'autoarg-kp-mode' minor
diff --git a/lisp/net/dig.el b/lisp/net/dig.el
index 81ddade109..0ac6399e87 100644
--- a/lisp/net/dig.el
+++ b/lisp/net/dig.el
@@ -44,6 +44,11 @@
   "Name of dig (domain information groper) binary."
   :type 'file)
 
+(defcustom dig-program-options nil
+  "Options for the dig program."
+  :type '(repeat string)
+  :version "26.1")
+
 (defcustom dig-dns-server nil
   "DNS server to query.
 If nil, use system defaults."
@@ -59,8 +64,8 @@ If nil, use system defaults."
   :type 'sexp)
 
 (defun dig-invoke (domain &optional
-                         query-type query-class query-option
-                         dig-option server)
+                       query-type query-class query-option
+                       dig-option server)
   "Call dig with given arguments and return buffer containing output.
 DOMAIN is a string with a DNS domain.  QUERY-TYPE is an optional
 string with a DNS type.  QUERY-CLASS is an optional string with a DNS
@@ -79,7 +84,8 @@ and is a commonly available debugging tool."
     (push domain cmdline)
     (if server (push (concat "@" server) cmdline)
       (if dig-dns-server (push (concat "@" dig-dns-server) cmdline)))
-    (apply #'call-process dig-program nil buf nil cmdline)
+    (apply #'call-process dig-program nil buf nil
+           (append dig-program-options cmdline))
     buf))
 
 (defun dig-extract-rr (domain &optional type class)
@@ -140,12 +146,21 @@ Buffer should contain output generated by `dig-invoke'."
                   query-type query-class query-option dig-option server)
   "Query addresses of a DOMAIN using dig.
 See `dig-invoke' for an explanation for the parameters.
-When called interactively, DOMAIN is prompted for.  If given a prefix,
-also prompt for the QUERY-TYPE parameter."
+When called interactively, DOMAIN is prompted for.
+
+If given a \\[universal-argument] prefix, also prompt \
+for the QUERY-TYPE parameter.
+
+If given a \\[universal-argument] \\[universal-argument] \
+prefix, also prompt for the SERVER parameter."
   (interactive
    (list (read-string "Host: ")
          (and current-prefix-arg
               (read-string "Query type: "))))
+  (when (>= (car current-prefix-arg) 16)
+    (let ((serv (read-from-minibuffer "Name server: ")))
+      (when (not (equal serv ""))
+        (setq server serv))))
   (pop-to-buffer-same-window
    (dig-invoke domain query-type query-class query-option dig-option server))
   (goto-char (point-min))
diff --git a/lisp/net/net-utils.el b/lisp/net/net-utils.el
index 411b6ed413..ea1dd0f3ca 100644
--- a/lisp/net/net-utils.el
+++ b/lisp/net/net-utils.el
@@ -176,15 +176,6 @@ This variable is only used if the variable
 `comint-use-prompt-regexp' is non-nil."
   :type  'regexp)
 
-(defcustom dig-program "dig"
-  "Program to query DNS information."
-  :type  'string)
-
-(defcustom dig-program-options nil
-  "Options for the dig program."
-  :type '(repeat string)
-  :version "26.1")
-
 (defcustom ftp-program "ftp"
   "Program to run to do FTP transfers."
   :type  'string)
@@ -633,20 +624,11 @@ DNS resolution.
 Interactively, prompt for NAME-SERVER if invoked with prefix argument.
 
 This command uses `dig-program' for looking up the DNS information."
+  (declare (obsolete dig "29.1"))
   (interactive
    (list (read-from-minibuffer "Lookup host: " (net-utils-machine-at-point))
          (if current-prefix-arg (read-from-minibuffer "Name server: "))))
-  (let ((options
-         (append dig-program-options (list host)
-                 (if name-server (list (concat "@" name-server))))))
-  (net-utils-run-program
-   "Dig"
-   (concat "** "
-          (mapconcat #'identity
-                     (list "Dig" host dig-program)
-                     " ** "))
-   dig-program
-   options)))
+  (dig host nil nil nil nil name-server))
 
 (autoload 'comint-exec "comint")
 (declare-function comint-watch-for-password-prompt "comint" (string))



reply via email to

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