* bug#26820: 26.0.50; DNS mode and IPv6 reverse zones
@ 2017-05-07 18:51 Peder O. Klingenberg
2017-05-07 18:58 ` Peder O. Klingenberg
0 siblings, 1 reply; 5+ messages in thread
From: Peder O. Klingenberg @ 2017-05-07 18:51 UTC (permalink / raw)
To: 26820
Last week I was trying to set up reverse delegations for some newly
assigned IPv6 address space. It was... painful.
IPv6 addresses are ugly enough in their normal format, but when used in
a reverse zone, they need to be converted to individual nibbles
separated by dots, reversed, and have .ip6.arpa. appended. The result
is less than human friendly.
So I've written a new feature for dns-mode.el that allows me to mostly
relate to the normal IPv6 format, and convert automatically to the
nibble format. I can for instance do this in a (part of a) zone file,
where I'm only interested in defining hosts in the last 16 bits of the
address:
$ORIGIN 2a0a:3dc0:10::/112
::1/-112 IN PTR www.example.com.
And then, by pressing C-c C-e on each of the IPv6 addresses, end up with
the necessary
$ORIGIN 0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.0.0.0.c.d.3.a.0.a.2.ip6.arpa.
1.0.0.0 IN PTR www.example.com.
Assuming I'm doing this as I type, I can then yank the last
standard-format address, do a minimal edit, C-c C-e again, and continue
typing to define the next PTR record.
I'm hoping this sounds useful to other people as well. I'll pass along
the patch as soon as I get a bug# to attach to it. :)
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#26820: 26.0.50; DNS mode and IPv6 reverse zones
2017-05-07 18:51 bug#26820: 26.0.50; DNS mode and IPv6 reverse zones Peder O. Klingenberg
@ 2017-05-07 18:58 ` Peder O. Klingenberg
2017-05-21 0:22 ` Glenn Morris
0 siblings, 1 reply; 5+ messages in thread
From: Peder O. Klingenberg @ 2017-05-07 18:58 UTC (permalink / raw)
To: 26820
[-- Attachment #1: Type: text/plain, Size: 372 bytes --]
peder@klingenberg.no (Peder O. Klingenberg) writes:
> I'll pass along the patch as soon as I get a bug# to attach to it. :)
As promised, here's the patch. I even wrote tests, which is a first for
me. I couldn't find dns-mode documented in any manual, so I haven't
written any info docs, but the docstrings should hopefully give enough
information to use the feature.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Command-to-convert-IPv6-addresses-in-zone-files.patch --]
[-- Type: text/x-patch, Size: 9146 bytes --]
From 8fe87aafd6aa77f5d4c1ac126e2d2e7e69ce236c Mon Sep 17 00:00:00 2001
From: "Peder O. Klingenberg" <peder@klingenberg.no>
Date: Sun, 7 May 2017 17:58:41 +0200
Subject: [PATCH] Command to convert IPv6 addresses in zone files
* lisp/textmodes/dns-mode.el (dns-mode-ipv6-to-nibbles):
New command to convert IPv6 addresses to a format suitable for
reverse lookup zone files.
(dns-mode-reverse-and-expand-ipv6): The algorithm central to
the command above.
(dns-mode-map, dns-mode-menu): Key and menu item for the new
command.
* test/lisp/textmodes/dns-mode-tests.el (dns-mode-ipv6-conversion)
(dns-mode-ipv6-text-replacement): Tests for new functionality
in dns-mode.el
(bug#26820)
---
etc/NEWS | 8 +++
lisp/textmodes/dns-mode.el | 102 +++++++++++++++++++++++++++++++++-
test/lisp/textmodes/dns-mode-tests.el | 58 +++++++++++++++++++
3 files changed, 167 insertions(+), 1 deletion(-)
create mode 100644 test/lisp/textmodes/dns-mode-tests.el
diff --git a/etc/NEWS b/etc/NEWS
index 4599efd7da..293ef4f960 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -784,6 +784,14 @@ file.
*** Emacs does no longer prompt the user before killing Flymake
processes on exit.
+** DNS mode
+
++++
+*** DNS mode has a tool to convert IPv6 addresses
+Reverse zones for IPv6 needs IPv6 addresses spelled out in a
+cumbersome format. A new command 'dns-mode-ipv6-to-nibbles' helps
+with the conversion.
+
\f
* New Modes and Packages in Emacs 26.1
diff --git a/lisp/textmodes/dns-mode.el b/lisp/textmodes/dns-mode.el
index 01f509d913..6f2f40cd2c 100644
--- a/lisp/textmodes/dns-mode.el
+++ b/lisp/textmodes/dns-mode.el
@@ -113,6 +113,7 @@ dns-mode-syntax-table
(defvar dns-mode-map
(let ((map (make-sparse-keymap)))
(define-key map "\C-c\C-s" 'dns-mode-soa-increment-serial)
+ (define-key map "\C-c\C-e" 'dns-mode-ipv6-to-nibbles)
map)
"Keymap for DNS master file mode.")
@@ -124,7 +125,8 @@ dns-mode-menu
(easy-menu-define dns-mode-menu dns-mode-map
"DNS Menu."
'("DNS"
- ["Increment SOA serial" dns-mode-soa-increment-serial t]))
+ ["Increment SOA serial" dns-mode-soa-increment-serial t]
+ ["Convert IPv6 address to nibbles" dns-mode-ipv6-to-nibbles t]))
;; Mode.
@@ -220,6 +222,104 @@ dns-mode-soa-maybe-increment-serial
;; We return nil in case this is used in write-contents-functions.
nil)))
+;;;###autoload
+(defun dns-mode-ipv6-to-nibbles (negate-prefix-p)
+ "Replace an IPv6 address around or preceeding point by its
+ip6.arpa-representation for use in reverse zone files. The
+replaced address is placed in the kill ring.
+
+The address can be a complete address (no prefix designator), can
+have a normal prefix designator (e.g. /48), in which case only
+the required number of nibbles are output, or can have a negative
+prefix designator (e.g. /-112), in which case only the parts of
+the address *not* covered by the absolute value of the prefix
+length is output, as a relative address (without .ip6.arpa. at
+the end). This is useful when $ORIGIN is specified in the zone
+file.
+
+If called with a prefix argument (C-u), the value of the detected
+prefix length is negated.
+
+Examples:
+
+2001:db8::12 =>
+2.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.
+
+2001:db8::12/32 =>
+8.b.d.0.1.0.0.2.ip6.arpa.
+
+2001:db8::12/-32 =>
+2.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0
+
+::42/112 (with C-u prefix) =>
+2.4.0.0"
+ (interactive "P")
+ (skip-syntax-backward " ")
+ (skip-syntax-backward "w_.")
+ (re-search-forward "\\([[:xdigit:]:]+\\)\\(/-?[0-9]\\{2,3\\}\\)?")
+ (kill-new (match-string 0))
+ (let ((address (match-string 1))
+ (prefix-length (match-string 2)))
+ (if prefix-length
+ (progn
+ (setq prefix-length (string-to-number (substring prefix-length 1)))
+ (if negate-prefix-p
+ (setq prefix-length (* -1 prefix-length)))))
+ (replace-match (save-match-data
+ (dns-mode-reverse-and-expand-ipv6 address prefix-length)))))
+
+(defun dns-mode-reverse-and-expand-ipv6 (address &optional prefix-length)
+ "Convert an IPv6 address to (parts of) an ip6.arpa nibble format.
+
+ADDRESS must be an IPv6 address in the usual colon-separaated
+format, without a prefix designator at the end. PREFIX-LENGTH,
+if given, must be a number whose absolute value is the length in
+bits of the network part of the address.
+
+If PREFIX-LENGTH is `nil', an absolute address is returned
+representing the full IPv6 address.
+
+If PREFIX-LENGTH is positive, an absolute address is returned
+representing the network prefix indicated.
+
+If PREFIX-LENGTH is negative, a relative address is returned
+representing the host parts of the address with respect to the
+indicated network prefix.
+
+See `dns-mode-ipv6-to-nibbles' for examples."
+ (let* ((chunks (split-string address ":"))
+ (prefix-length-nibbles (if prefix-length
+ (ceiling (abs prefix-length) 4)
+ 32))
+ (filler-chunks (- 8 (length (remove "" chunks))))
+ (expanded-address (apply #'concat
+ (loop with filler-done = nil
+ for chunk in chunks
+ if (and (not filler-done)
+ (string= "" chunk))
+ append (prog1
+ (loop repeat filler-chunks
+ collect "0000")
+ (setq filler-done t))
+ else
+ if (not (string= "" chunk))
+ collect (format "%04x" (string-to-number chunk 16)))))
+ (rev-address-nibbles (nreverse (if (and prefix-length
+ (minusp prefix-length))
+ (substring expanded-address prefix-length-nibbles)
+ (substring expanded-address 0 prefix-length-nibbles)))))
+ (with-temp-buffer
+ (loop for char across rev-address-nibbles
+ do
+ (insert char)
+ (insert "."))
+ (if (and prefix-length
+ (minusp prefix-length))
+ (delete-char -1)
+ (insert "ip6.arpa."))
+ (insert " ")
+ (buffer-string))))
+
(provide 'dns-mode)
;;; dns-mode.el ends here
diff --git a/test/lisp/textmodes/dns-mode-tests.el b/test/lisp/textmodes/dns-mode-tests.el
new file mode 100644
index 0000000000..34e86201d8
--- /dev/null
+++ b/test/lisp/textmodes/dns-mode-tests.el
@@ -0,0 +1,58 @@
+;;; dns-mode-tests.el --- Test suite for dns-mode -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2017 Free Software Foundation, Inc.
+
+;; Author: Peder O. Klingenberg <peder@klingenberg.no>
+;; Keywords: dns zone
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'ert)
+(require 'dns-mode)
+
+;;; IPv6 reverse zones
+(ert-deftest dns-mode-ipv6-conversion ()
+ (let ((address "2001:db8::42"))
+ (should (equal (dns-mode-reverse-and-expand-ipv6 address)
+ "2.4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa. "))
+ (should (equal (dns-mode-reverse-and-expand-ipv6 address 32)
+ "8.b.d.0.1.0.0.2.ip6.arpa. "))
+ (should (equal (dns-mode-reverse-and-expand-ipv6 address -112)
+ "2.4.0.0 "))))
+
+(ert-deftest dns-mode-ipv6-text-replacement ()
+ (let ((address "2001:db8::42/32"))
+ (with-temp-buffer
+ ;; Conversion with point directly after address
+ (insert address)
+ (dns-mode-ipv6-to-nibbles nil)
+ (should (equal (buffer-string) "8.b.d.0.1.0.0.2.ip6.arpa. "))
+ ;; Kill ring contains the expected
+ (erase-buffer)
+ (yank)
+ (should (equal (buffer-string) address))
+ ;; Point at beginning of address (and prefix arg to command)
+ (goto-char (point-min))
+ (dns-mode-ipv6-to-nibbles t)
+ (should (equal (buffer-string) "2.4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 "))
+ ;; Point separated from address by whitespace
+ (erase-buffer)
+ (insert address)
+ (insert " ")
+ (dns-mode-ipv6-to-nibbles nil)
+ (should (equal (buffer-string) "8.b.d.0.1.0.0.2.ip6.arpa. ")))))
--
2.11.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* bug#26820: 26.0.50; DNS mode and IPv6 reverse zones
2017-05-07 18:58 ` Peder O. Klingenberg
@ 2017-05-21 0:22 ` Glenn Morris
2017-05-21 19:56 ` Peder O. Klingenberg
0 siblings, 1 reply; 5+ messages in thread
From: Glenn Morris @ 2017-05-21 0:22 UTC (permalink / raw)
To: Peder O. Klingenberg; +Cc: 26820
Thanks, but:
In dns-mode-reverse-and-expand-ipv6:
~/dns-mode.el:330:41:Warning: reference to free variable ‘with’
~/dns-mode.el:330:46:Warning: reference to free variable ‘filler-done’
~/dns-mode.el:330:58:Warning: reference to free variable ‘=’
~/dns-mode.el:331:41:Warning: reference to free variable ‘for’
~/dns-mode.el:331:45:Warning: reference to free variable ‘chunk’
~/dns-mode.el:331:51:Warning: reference to free variable ‘in’
~/dns-mode.el:332:41:Warning: reference to free variable ‘if’
~/dns-mode.el:334:41:Warning: reference to free variable ‘append’
~/dns-mode.el:335:58:Warning: reference to free variable ‘repeat’
~/dns-mode.el:336:58:Warning: reference to free variable ‘collect’
~/dns-mode.el:337:56:Warning: assignment to free variable ‘filler-done’
~/dns-mode.el:338:41:Warning: reference to free variable ‘else’
~/dns-mode.el:346:17:Warning: reference to free variable ‘char’
~/dns-mode.el:346:22:Warning: reference to free variable ‘across’
~/dns-mode.el:347:13:Warning: reference to free variable ‘do’
In end of data:
~/dns-mode.el:360:1:Warning: the following functions are not known to be
defined: loop, minusp
which is due to using stuff from cl.el without requiring it.
And in any case, the cl-lib versions should be used instead these days.
Please could you revise that? TIA.
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#26820: 26.0.50; DNS mode and IPv6 reverse zones
2017-05-21 0:22 ` Glenn Morris
@ 2017-05-21 19:56 ` Peder O. Klingenberg
2017-05-24 0:36 ` Glenn Morris
0 siblings, 1 reply; 5+ messages in thread
From: Peder O. Klingenberg @ 2017-05-21 19:56 UTC (permalink / raw)
To: Glenn Morris; +Cc: 26820
[-- Attachment #1: Type: text/plain, Size: 291 bytes --]
Glenn Morris <rgm@gnu.org> writes:
> And in any case, the cl-lib versions should be used instead these days.
> Please could you revise that? TIA.
Revised patch attached, using the cl-lib versions. dns-mode.el now
compiles without warnings in emacs -Q. Thank you for taking an
interest.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Command-to-convert-IPv6-addresses-in-zone-files.patch --]
[-- Type: text/x-patch, Size: 9203 bytes --]
From 784308bc7b85c9012f89294fec478f43b0f1f210 Mon Sep 17 00:00:00 2001
From: "Peder O. Klingenberg" <peder@klingenberg.no>
Date: Sun, 7 May 2017 17:58:41 +0200
Subject: [PATCH] Command to convert IPv6 addresses in zone files
* lisp/textmodes/dns-mode.el (dns-mode-ipv6-to-nibbles):
New command to convert IPv6 addresses to a format suitable for
reverse lookup zone files.
(dns-mode-reverse-and-expand-ipv6): The algorithm central to
the command above.
(dns-mode-map, dns-mode-menu): Key and menu item for the new
command.
* test/lisp/textmodes/dns-mode-tests.el (dns-mode-ipv6-conversion)
(dns-mode-ipv6-text-replacement): Tests for new functionality
in dns-mode.el
(bug#26820)
---
etc/NEWS | 8 +++
lisp/textmodes/dns-mode.el | 102 +++++++++++++++++++++++++++++++++-
test/lisp/textmodes/dns-mode-tests.el | 58 +++++++++++++++++++
3 files changed, 167 insertions(+), 1 deletion(-)
create mode 100644 test/lisp/textmodes/dns-mode-tests.el
diff --git a/etc/NEWS b/etc/NEWS
index 4599efd7da..293ef4f960 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -784,6 +784,14 @@ file.
*** Emacs does no longer prompt the user before killing Flymake
processes on exit.
+** DNS mode
+
++++
+*** DNS mode has a tool to convert IPv6 addresses
+Reverse zones for IPv6 needs IPv6 addresses spelled out in a
+cumbersome format. A new command 'dns-mode-ipv6-to-nibbles' helps
+with the conversion.
+
\f
* New Modes and Packages in Emacs 26.1
diff --git a/lisp/textmodes/dns-mode.el b/lisp/textmodes/dns-mode.el
index 01f509d913..88d9c6bee6 100644
--- a/lisp/textmodes/dns-mode.el
+++ b/lisp/textmodes/dns-mode.el
@@ -113,6 +113,7 @@ dns-mode-syntax-table
(defvar dns-mode-map
(let ((map (make-sparse-keymap)))
(define-key map "\C-c\C-s" 'dns-mode-soa-increment-serial)
+ (define-key map "\C-c\C-e" 'dns-mode-ipv6-to-nibbles)
map)
"Keymap for DNS master file mode.")
@@ -124,7 +125,8 @@ dns-mode-menu
(easy-menu-define dns-mode-menu dns-mode-map
"DNS Menu."
'("DNS"
- ["Increment SOA serial" dns-mode-soa-increment-serial t]))
+ ["Increment SOA serial" dns-mode-soa-increment-serial t]
+ ["Convert IPv6 address to nibbles" dns-mode-ipv6-to-nibbles t]))
;; Mode.
@@ -220,6 +222,104 @@ dns-mode-soa-maybe-increment-serial
;; We return nil in case this is used in write-contents-functions.
nil)))
+;;;###autoload
+(defun dns-mode-ipv6-to-nibbles (negate-prefix-p)
+ "Replace an IPv6 address around or preceeding point by its
+ip6.arpa-representation for use in reverse zone files. The
+replaced address is placed in the kill ring.
+
+The address can be a complete address (no prefix designator), can
+have a normal prefix designator (e.g. /48), in which case only
+the required number of nibbles are output, or can have a negative
+prefix designator (e.g. /-112), in which case only the parts of
+the address *not* covered by the absolute value of the prefix
+length is output, as a relative address (without .ip6.arpa. at
+the end). This is useful when $ORIGIN is specified in the zone
+file.
+
+If called with a prefix argument (C-u), the value of the detected
+prefix length is negated.
+
+Examples:
+
+2001:db8::12 =>
+2.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.
+
+2001:db8::12/32 =>
+8.b.d.0.1.0.0.2.ip6.arpa.
+
+2001:db8::12/-32 =>
+2.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0
+
+::42/112 (with C-u prefix) =>
+2.4.0.0"
+ (interactive "P")
+ (skip-syntax-backward " ")
+ (skip-syntax-backward "w_.")
+ (re-search-forward "\\([[:xdigit:]:]+\\)\\(/-?[0-9]\\{2,3\\}\\)?")
+ (kill-new (match-string 0))
+ (let ((address (match-string 1))
+ (prefix-length (match-string 2)))
+ (if prefix-length
+ (progn
+ (setq prefix-length (string-to-number (substring prefix-length 1)))
+ (if negate-prefix-p
+ (setq prefix-length (* -1 prefix-length)))))
+ (replace-match (save-match-data
+ (dns-mode-reverse-and-expand-ipv6 address prefix-length)))))
+
+(defun dns-mode-reverse-and-expand-ipv6 (address &optional prefix-length)
+ "Convert an IPv6 address to (parts of) an ip6.arpa nibble format.
+
+ADDRESS must be an IPv6 address in the usual colon-separaated
+format, without a prefix designator at the end. PREFIX-LENGTH,
+if given, must be a number whose absolute value is the length in
+bits of the network part of the address.
+
+If PREFIX-LENGTH is `nil', an absolute address is returned
+representing the full IPv6 address.
+
+If PREFIX-LENGTH is positive, an absolute address is returned
+representing the network prefix indicated.
+
+If PREFIX-LENGTH is negative, a relative address is returned
+representing the host parts of the address with respect to the
+indicated network prefix.
+
+See `dns-mode-ipv6-to-nibbles' for examples."
+ (let* ((chunks (split-string address ":"))
+ (prefix-length-nibbles (if prefix-length
+ (ceiling (abs prefix-length) 4)
+ 32))
+ (filler-chunks (- 8 (length (remove "" chunks))))
+ (expanded-address (apply #'concat
+ (cl-loop with filler-done = nil
+ for chunk in chunks
+ if (and (not filler-done)
+ (string= "" chunk))
+ append (prog1
+ (cl-loop repeat filler-chunks
+ collect "0000")
+ (setq filler-done t))
+ else
+ if (not (string= "" chunk))
+ collect (format "%04x" (string-to-number chunk 16)))))
+ (rev-address-nibbles (nreverse (if (and prefix-length
+ (cl-minusp prefix-length))
+ (substring expanded-address prefix-length-nibbles)
+ (substring expanded-address 0 prefix-length-nibbles)))))
+ (with-temp-buffer
+ (cl-loop for char across rev-address-nibbles
+ do
+ (insert char)
+ (insert "."))
+ (if (and prefix-length
+ (cl-minusp prefix-length))
+ (delete-char -1)
+ (insert "ip6.arpa."))
+ (insert " ")
+ (buffer-string))))
+
(provide 'dns-mode)
;;; dns-mode.el ends here
diff --git a/test/lisp/textmodes/dns-mode-tests.el b/test/lisp/textmodes/dns-mode-tests.el
new file mode 100644
index 0000000000..34e86201d8
--- /dev/null
+++ b/test/lisp/textmodes/dns-mode-tests.el
@@ -0,0 +1,58 @@
+;;; dns-mode-tests.el --- Test suite for dns-mode -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2017 Free Software Foundation, Inc.
+
+;; Author: Peder O. Klingenberg <peder@klingenberg.no>
+;; Keywords: dns zone
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'ert)
+(require 'dns-mode)
+
+;;; IPv6 reverse zones
+(ert-deftest dns-mode-ipv6-conversion ()
+ (let ((address "2001:db8::42"))
+ (should (equal (dns-mode-reverse-and-expand-ipv6 address)
+ "2.4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa. "))
+ (should (equal (dns-mode-reverse-and-expand-ipv6 address 32)
+ "8.b.d.0.1.0.0.2.ip6.arpa. "))
+ (should (equal (dns-mode-reverse-and-expand-ipv6 address -112)
+ "2.4.0.0 "))))
+
+(ert-deftest dns-mode-ipv6-text-replacement ()
+ (let ((address "2001:db8::42/32"))
+ (with-temp-buffer
+ ;; Conversion with point directly after address
+ (insert address)
+ (dns-mode-ipv6-to-nibbles nil)
+ (should (equal (buffer-string) "8.b.d.0.1.0.0.2.ip6.arpa. "))
+ ;; Kill ring contains the expected
+ (erase-buffer)
+ (yank)
+ (should (equal (buffer-string) address))
+ ;; Point at beginning of address (and prefix arg to command)
+ (goto-char (point-min))
+ (dns-mode-ipv6-to-nibbles t)
+ (should (equal (buffer-string) "2.4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 "))
+ ;; Point separated from address by whitespace
+ (erase-buffer)
+ (insert address)
+ (insert " ")
+ (dns-mode-ipv6-to-nibbles nil)
+ (should (equal (buffer-string) "8.b.d.0.1.0.0.2.ip6.arpa. ")))))
--
2.11.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* bug#26820: 26.0.50; DNS mode and IPv6 reverse zones
2017-05-21 19:56 ` Peder O. Klingenberg
@ 2017-05-24 0:36 ` Glenn Morris
0 siblings, 0 replies; 5+ messages in thread
From: Glenn Morris @ 2017-05-24 0:36 UTC (permalink / raw)
To: 26820-done
Version: 26.1
Thanks; tweaked and applied as 8f6550b.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-05-24 0:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-07 18:51 bug#26820: 26.0.50; DNS mode and IPv6 reverse zones Peder O. Klingenberg
2017-05-07 18:58 ` Peder O. Klingenberg
2017-05-21 0:22 ` Glenn Morris
2017-05-21 19:56 ` Peder O. Klingenberg
2017-05-24 0:36 ` Glenn Morris
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.