emacs-bug-tracker
[Top][All Lists]
Advanced

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

[Emacs-bug-tracker] bug#8386: closed ([patch] capitalization bug in NATO


From: GNU bug Tracking System
Subject: [Emacs-bug-tracker] bug#8386: closed ([patch] capitalization bug in NATO)
Date: Thu, 07 Apr 2011 03:27:02 +0000

Your message dated Wed, 06 Apr 2011 23:26:29 -0400
with message-id <address@hidden>
and subject line Re: [patch] capitalization bug in NATO
has caused the GNU bug report #8386,
regarding [patch] capitalization bug in NATO
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
8386: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8386
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: [patch] capitalization bug in NATO Date: Thu, 31 Mar 2011 00:46:57 -0400
Follow-up to my initial contribution of NATO alphabetization in #2288,
I noticed that `denato-region' will not always work because `rassoc'
is being case-sensitive.

I've provided a command to operate on strings as a test suite, where

(nato-string "echo mike alfa charlie sierra" t)

should give "emacs", but it does not.

The following will work since the capitalization jives with internals.

(nato-string "Echo Mike Alfa Charlie Sierra" t)

Attached is a proposed patch.

Thanks.
/a

2011-03-31  Aaron S. Hawley  <address@hidden>

        * play/morse.el (denato-region): Decoding NATO alphabet encodings
        should be done case-insensitive.
        (nato-string): New function.

--- lisp/play/morse.el  2011-03-07 07:35:25 +0000
+++ lisp/play/morse.el  2011-03-31 04:25:45 +0000
@@ -231,7 +231,7 @@
        (if (null (looking-at "[a-z]+"))
            (forward-char 1)
          (setq str (buffer-substring (match-beginning 0) (match-end 0)))
-         (if (null (setq nato (rassoc str nato-alphabet)))
+         (if (null (setq nato (rassoc (capitalize str) nato-alphabet)))
              (goto-char (match-end 0))
            (replace-match
                  (if (string-equal "(" (car nato))
@@ -240,6 +240,18 @@
            (if (looking-at "-")
                (delete-char 1))))))))

+(defun nato-string (string &optional arg)
+  "Convert NATO phonetic alphabet in STRING to ordinary ASCII text."
+  (interactive "sConvert to NATO: \nP")
+  (with-temp-buffer
+    (insert string)
+    (if arg
+        (denato-region (point-min) (point-max))
+      (nato-region (point-min) (point-max)))
+    (if (interactive-p)
+        (message (buffer-string))
+      (buffer-string))))
+
 (provide 'morse)

 ;;; morse.el ends here

-- 
In general, we reserve the right to have a poor
memory--the computer, however, is supposed to
remember!  Poor computer.  -- Guy Lewis Steele Jr.

Attachment: morse.el.diff
Description: Binary data


--- End Message ---
--- Begin Message --- Subject: Re: [patch] capitalization bug in NATO Date: Wed, 06 Apr 2011 23:26:29 -0400 User-agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)
(no need to cc me on reports)

"Aaron S. Hawley" wrote:

> -       (if (null (setq nato (rassoc str nato-alphabet)))
> +       (if (null (setq nato (rassoc (capitalize str) nato-alphabet)))

Applied.

> +(defun nato-string (string &optional arg)

I don't see a need for this command.


--- End Message ---

reply via email to

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