unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#28688: 26.0.60; Making ucs-names hash tables breaks aa2u, counsel packages
@ 2017-10-03 15:40 Kaushal Modi
  2017-10-03 16:13 ` Kaushal Modi
  0 siblings, 1 reply; 8+ messages in thread
From: Kaushal Modi @ 2017-10-03 15:40 UTC (permalink / raw)
  To: mvoteiza, 28688

[-- Attachment #1: Type: text/plain, Size: 2071 bytes --]

Hi Mark,

Can you please review the aa2u package in GNU Elpa?

https://elpa.gnu.org/packages/ascii-art-to-unicode.html

In there, there is this function which triggers error after this change[1]:

(defun aa2u-1c (stringifier &rest components)
  "Apply STRINGIFIER to COMPONENTS; return the UCS char w/ this name.
The char is a string (of length one), with two properties:

  aa2u-stringifier
  aa2u-components

Their values are STRINGIFIER and COMPONENTS, respectively."
  (let ((s (string (cdr (assoc-string (apply stringifier components)
                                      (ucs-names))))))
    (propertize s
                'aa2u-stringifier stringifier
                'aa2u-components components)))

Can you please update the package so that it works whether ucs-names is a
hash-table or a list?

I also realized that it broke the counsel-unicode-char interactive function
in the counsel.el package too:

(defun counsel-unicode-char (&optional count)
  "Insert COUNT copies of a Unicode character at point.
COUNT defaults to 1."
  (interactive "p")
  (let ((minibuffer-allow-text-properties t)
        (ivy-sort-max-size (expt 256 6)))
    (setq ivy-completion-beg (point))
    (setq ivy-completion-end (point))
    (ivy-read "Unicode name: "
              (nreverse
               (mapcar (lambda (x)
                         (propertize
                          (format "%06X % -60s%c" (cdr x) (car x) (cdr x))
                          'result (cdr x)))
                       (ucs-names)))
              :action (lambda (char)
                        (with-ivy-window
                          (delete-region ivy-completion-beg
ivy-completion-end)
                          (setq ivy-completion-beg (point))
                          (insert-char (get-text-property 0 'result char)
count)
                          (setq ivy-completion-end (point))))
              :history 'counsel-unicode-char-history
              :sort t)))

[1]:
http://git.savannah.gnu.org/cgit/emacs.git/commit/?h=emacs-26&id=96c2c098aeed5c85733577ebbdaf33af6fbb59e9
-- 

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 3250 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#28688: 26.0.60; Making ucs-names hash tables breaks aa2u, counsel packages
  2017-10-03 15:40 bug#28688: 26.0.60; Making ucs-names hash tables breaks aa2u, counsel packages Kaushal Modi
@ 2017-10-03 16:13 ` Kaushal Modi
  2017-10-03 16:47   ` Kaushal Modi
  2017-10-03 19:42   ` Thien-Thi Nguyen
  0 siblings, 2 replies; 8+ messages in thread
From: Kaushal Modi @ 2017-10-03 16:13 UTC (permalink / raw)
  To: 28688; +Cc: Mark Oteiza, ttn@gnu.org, Oleh Krehel


[-- Attachment #1.1: Type: text/plain, Size: 438 bytes --]

Here is my patch for fixing the aa2u package (attached). I have copied
Thien-Thi Nguyen, aa2u's maintainer to verify it. Please commit it if all
looks good; I don't have commit rights, but have my FSF copyright
assignment on file.

Also copying Oleh as I couldn't figure out how to fix counsel-unicode-char.
ivy-read accepts a COLLECTION which is a list.. so now we need to convert
the hash table back to list for that?
-- 

Kaushal Modi

[-- Attachment #1.2: Type: text/html, Size: 605 bytes --]

[-- Attachment #2: 0001-Adapt-to-ucs-names-now-being-a-hash-table.patch --]
[-- Type: application/octet-stream, Size: 1785 bytes --]

From d861357312804be8749044ea22707f37cc88e39e Mon Sep 17 00:00:00 2001
From: Kaushal Modi <kaushal.modi@gmail.com>
Date: Tue, 3 Oct 2017 12:04:21 -0400
Subject: [PATCH] Adapt to ucs-names now being a hash table

* packages/ascii-art-to-unicode/ascii-art-to-unicode.el (aa2u-1c): Use gethash
  if ucs-names returns a hash table.  Make the package function in emacs 26.1
  as well as older versions.

(http://git.savannah.gnu.org/cgit/emacs.git/commit/?h=emacs-26&id=96c2c098aeed5c85733577ebbdaf33af6fbb59e9)
---
 packages/ascii-art-to-unicode/ascii-art-to-unicode.el | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/packages/ascii-art-to-unicode/ascii-art-to-unicode.el b/packages/ascii-art-to-unicode/ascii-art-to-unicode.el
index 92236628b..f7458aed8 100644
--- a/packages/ascii-art-to-unicode/ascii-art-to-unicode.el
+++ b/packages/ascii-art-to-unicode/ascii-art-to-unicode.el
@@ -4,7 +4,7 @@
 
 ;; Author: Thien-Thi Nguyen <ttn@gnu.org>
 ;; Maintainer: Thien-Thi Nguyen <ttn@gnu.org>
-;; Version: 1.9
+;; Version: 2.0
 ;; Keywords: ascii, unicode, box-drawing
 ;; URL: http://www.gnuvola.org/software/aa2u/
 
@@ -145,8 +145,11 @@ The char is a string (of length one), with two properties:
   aa2u-components
 
 Their values are STRINGIFIER and COMPONENTS, respectively."
-  (let ((s (string (cdr (assoc-string (apply stringifier components)
-                                      (ucs-names))))))
+  (let* ((ucs-map (ucs-names))
+         (key (apply stringifier components))
+         (s (string (if (hash-table-p ucs-map)
+                        (gethash key ucs-map)
+                   (cdr (assoc-string key ucs-map))))))
     (propertize s
                 'aa2u-stringifier stringifier
                 'aa2u-components components)))
-- 
2.14.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* bug#28688: 26.0.60; Making ucs-names hash tables breaks aa2u, counsel packages
  2017-10-03 16:13 ` Kaushal Modi
@ 2017-10-03 16:47   ` Kaushal Modi
  2017-10-03 21:42     ` Kaushal Modi
  2017-10-03 19:42   ` Thien-Thi Nguyen
  1 sibling, 1 reply; 8+ messages in thread
From: Kaushal Modi @ 2017-10-03 16:47 UTC (permalink / raw)
  To: 28688; +Cc: Mark Oteiza, ttn@gnu.org, Oleh Krehel

[-- Attachment #1: Type: text/plain, Size: 568 bytes --]

On Tue, Oct 3, 2017 at 12:13 PM Kaushal Modi <kaushal.modi@gmail.com> wrote:

> Also copying Oleh as I couldn't figure out how to fix
> counsel-unicode-char. ivy-read accepts a COLLECTION which is a list.. so
> now we need to convert the hash table back to list for that?
>

Hi Oleh,

As I later learn, ivy-read accept hash tables too; I have submitted a PR[1]
on the swiper repo and have confirmed the fix to work on emacs 26.1. I am
assuming you will later assimilate that change back in GNU Elpa.

[1]: https://github.com/abo-abo/swiper/pull/1223
-- 

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 1077 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#28688: 26.0.60; Making ucs-names hash tables breaks aa2u, counsel packages
  2017-10-03 16:13 ` Kaushal Modi
  2017-10-03 16:47   ` Kaushal Modi
@ 2017-10-03 19:42   ` Thien-Thi Nguyen
  1 sibling, 0 replies; 8+ messages in thread
From: Thien-Thi Nguyen @ 2017-10-03 19:42 UTC (permalink / raw)
  To: 28688

[-- Attachment #1: Type: text/plain, Size: 657 bytes --]


() Kaushal Modi <kaushal.modi@gmail.com>
() Tue, 03 Oct 2017 16:13:26 +0000

   Here is my patch for fixing the aa2u package (attached). I
   have copied Thien-Thi Nguyen, aa2u's maintainer to verify it.

Thanks for the tip.  I decided to install a different change --
commit c00a5552907204 -- which does the swizzling at load-time.

[cc dropped]

-- 
Thien-Thi Nguyen -----------------------------------------------
 (defun responsep (query)
   (pcase (context query)
     (`(technical ,ml) (correctp ml))
     ...))                              748E A0E8 1CB8 A748 9BFA
--------------------------------------- 6CE4 6703 2224 4C80 7502

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#28688: 26.0.60; Making ucs-names hash tables breaks aa2u, counsel packages
  2017-10-03 16:47   ` Kaushal Modi
@ 2017-10-03 21:42     ` Kaushal Modi
  2017-10-04  6:03       ` Thien-Thi Nguyen
  0 siblings, 1 reply; 8+ messages in thread
From: Kaushal Modi @ 2017-10-03 21:42 UTC (permalink / raw)
  To: 28688-done; +Cc: Mark Oteiza, ttn@gnu.org, Oleh Krehel

[-- Attachment #1: Type: text/plain, Size: 400 bytes --]

@Oleh: Thanks for merging the PR. Hopefully you'll update GNU Elpa soon.
@Thien-Thi Thanks for fixing this quick.

I confirm ucs-names to be happy once again in both aa2u and counsel.

Closing this bug.

PS: @Thien-Thi: Strangely, I just noticed your reply here[1], but I never
got that email in my inbox.

[1]: http://lists.gnu.org/archive/html/bug-gnu-emacs/2017-10/msg00129.html
-- 

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 726 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#28688: 26.0.60; Making ucs-names hash tables breaks aa2u, counsel packages
  2017-10-03 21:42     ` Kaushal Modi
@ 2017-10-04  6:03       ` Thien-Thi Nguyen
  2017-10-04  8:20         ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Thien-Thi Nguyen @ 2017-10-04  6:03 UTC (permalink / raw)
  To: kaushal.modi, 28688

[-- Attachment #1: Type: text/plain, Size: 729 bytes --]


() Kaushal Modi <kaushal.modi@gmail.com>
() Tue, 03 Oct 2017 21:42:59 +0000

   I just noticed your reply here[1], but I never
   got that email in my inbox.

Probably because i dropped all but the debbugs addr in the reply
and set headers Mail-Followup-To and Reply-To to point there as
well.  Is that a problem?  (Is there a more idiomatic approach?)

(In contrast, in this reply, i include you explicitly in To.)

-- 
Thien-Thi Nguyen -----------------------------------------------
 (defun responsep (query)
   (pcase (context query)
     (`(technical ,ml) (correctp ml))
     ...))                              748E A0E8 1CB8 A748 9BFA
--------------------------------------- 6CE4 6703 2224 4C80 7502


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#28688: 26.0.60; Making ucs-names hash tables breaks aa2u, counsel packages
  2017-10-04  6:03       ` Thien-Thi Nguyen
@ 2017-10-04  8:20         ` Eli Zaretskii
  2017-10-04 10:11           ` Thien-Thi Nguyen
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2017-10-04  8:20 UTC (permalink / raw)
  To: Thien-Thi Nguyen; +Cc: 28688

> From: Thien-Thi Nguyen <ttn@gnu.org>
> Date: Wed, 04 Oct 2017 08:03:32 +0200
> 
>    I just noticed your reply here[1], but I never
>    got that email in my inbox.
> 
> Probably because i dropped all but the debbugs addr in the reply
> and set headers Mail-Followup-To and Reply-To to point there as
> well.  Is that a problem?

Yes, it's a problem: debbugs doesn't automatically CC's people not
subscribed to the mailing list, and AFAIK doesn't even try to track
them.

You should always include all the addressees when you reply to bug
reports.

Thanks.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#28688: 26.0.60; Making ucs-names hash tables breaks aa2u, counsel packages
  2017-10-04  8:20         ` Eli Zaretskii
@ 2017-10-04 10:11           ` Thien-Thi Nguyen
  0 siblings, 0 replies; 8+ messages in thread
From: Thien-Thi Nguyen @ 2017-10-04 10:11 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 28688

[-- Attachment #1: Type: text/plain, Size: 747 bytes --]


() Eli Zaretskii <eliz@gnu.org>
() Wed, 04 Oct 2017 11:20:21 +0300

   > [...] dropped all but the debbugs addr in the reply
   > Is that a problem?

   Yes, it's a problem: debbugs doesn't automatically CC's
   people not subscribed to the mailing list, and AFAIK doesn't
   even try to track them.

   You should always include all the addressees when you reply
   to bug reports.

Thanks for explaining.  I'll do so henceforth.

-- 
Thien-Thi Nguyen -----------------------------------------------
 (defun responsep (query)
   (pcase (context query)
     (`(technical ,ml) (correctp ml))
     ...))                              748E A0E8 1CB8 A748 9BFA
--------------------------------------- 6CE4 6703 2224 4C80 7502


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-10-04 10:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-03 15:40 bug#28688: 26.0.60; Making ucs-names hash tables breaks aa2u, counsel packages Kaushal Modi
2017-10-03 16:13 ` Kaushal Modi
2017-10-03 16:47   ` Kaushal Modi
2017-10-03 21:42     ` Kaushal Modi
2017-10-04  6:03       ` Thien-Thi Nguyen
2017-10-04  8:20         ` Eli Zaretskii
2017-10-04 10:11           ` Thien-Thi Nguyen
2017-10-03 19:42   ` Thien-Thi Nguyen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).