unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#17759: 24.4.50; Missing 'ascii-character props
@ 2014-06-12 10:32 Eli Barzilay
  2014-06-13  6:30 ` Juri Linkov
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Barzilay @ 2014-06-12 10:32 UTC (permalink / raw)
  To: 17759

In the current development version this:

    (get 'kp-7 'ascii-character)

no longer works.  It seems to have been removed in what git shows as
revision 7f3c6d9a:

  Author: Juri Linkov <juri@jurta.org>
  Date:   2013-12-13 03:03:04 +0200

  * lisp/simple.el <Keypad support>: Remove key bindings duplicated
    with bindings.el.

Perhaps the intention is to use only key definitions as the mappings,
but there is surely code that broke with the change.  (At least
"calculator.el" did, but I'll fix it if it was intentional.)

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!





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

* bug#17759: 24.4.50; Missing 'ascii-character props
  2014-06-12 10:32 bug#17759: 24.4.50; Missing 'ascii-character props Eli Barzilay
@ 2014-06-13  6:30 ` Juri Linkov
  2014-06-13 12:46   ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Juri Linkov @ 2014-06-13  6:30 UTC (permalink / raw)
  To: Eli Barzilay; +Cc: 17759

> In the current development version this:
>
>     (get 'kp-7 'ascii-character)
>
> no longer works.  It seems to have been removed in what git shows as
> revision 7f3c6d9a:
>
>   Author: Juri Linkov <juri@jurta.org>
>   Date:   2013-12-13 03:03:04 +0200
>
>   * lisp/simple.el <Keypad support>: Remove key bindings duplicated
>     with bindings.el.
>
> Perhaps the intention is to use only key definitions as the mappings,
> but there is surely code that broke with the change.  (At least
> "calculator.el" did, but I'll fix it if it was intentional.)

Thanks for noticing.  This should be fixed by this patch:

=== modified file 'lisp/bindings.el'
--- lisp/bindings.el	2014-03-20 17:14:45 +0000
+++ lisp/bindings.el	2014-06-13 06:30:04 +0000
@@ -1076,9 +1076,13 @@ (let ((modifiers '(nil (control) (meta)
 	      (kp-add ?+) (kp-subtract ?-) (kp-multiply ?*) (kp-divide ?/))))
   (dolist (pair keys)
     (dolist (mod modifiers)
-      (define-key function-key-map
-	(vector (append mod (list (nth 0 pair))))
-	(vector (append mod (list (nth 1 pair))))))))
+      (let ((keypad (nth 0 pair))
+	    (normal (nth 1 pair)))
+	(when (and (characterp normal) (eq (char-charset normal) 'ascii))
+	  (put keypad 'ascii-character normal))
+	(define-key function-key-map
+	  (vector (append mod (list keypad)))
+	  (vector (append mod (list normal))))))))
 
 (define-key function-key-map [backspace] [?\C-?])
 (define-key function-key-map [delete] [?\C-?])






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

* bug#17759: 24.4.50; Missing 'ascii-character props
  2014-06-13  6:30 ` Juri Linkov
@ 2014-06-13 12:46   ` Stefan Monnier
  2014-06-14  9:50     ` Juri Linkov
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2014-06-13 12:46 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Eli Barzilay, 17759

> +	(when (and (characterp normal) (eq (char-charset normal) 'ascii))

Do you really need the (eq (char-charset normal) 'ascii) test?

The `ascii-character' property doesn't have to be "ascii", really (the
name is just a historical accident which dates back to many moons ago
when ascii meant "plain text"), IIRC it just has to be a "real"
character as opposed to something with modifiers like ?\M-\A-x.


        Stefan





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

* bug#17759: 24.4.50; Missing 'ascii-character props
  2014-06-13 12:46   ` Stefan Monnier
@ 2014-06-14  9:50     ` Juri Linkov
  2014-06-14 21:15       ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Juri Linkov @ 2014-06-14  9:50 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Eli Barzilay, 17759-done

>> +	(when (and (characterp normal) (eq (char-charset normal) 'ascii))
>
> Do you really need the (eq (char-charset normal) 'ascii) test?
>
> The `ascii-character' property doesn't have to be "ascii", really (the
> name is just a historical accident which dates back to many moons ago
> when ascii meant "plain text"), IIRC it just has to be a "real"
> character as opposed to something with modifiers like ?\M-\A-x.

Yes, the name is confusing, so I installed it without the ascii test.





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

* bug#17759: 24.4.50; Missing 'ascii-character props
  2014-06-14  9:50     ` Juri Linkov
@ 2014-06-14 21:15       ` Stefan Monnier
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2014-06-14 21:15 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Eli Barzilay, 17759-done

>>> +	(when (and (characterp normal) (eq (char-charset normal) 'ascii))
>> Do you really need the (eq (char-charset normal) 'ascii) test?
>> The `ascii-character' property doesn't have to be "ascii", really (the
>> name is just a historical accident which dates back to many moons ago
>> when ascii meant "plain text"), IIRC it just has to be a "real"
>> character as opposed to something with modifiers like ?\M-\A-x.

> Yes, the name is confusing, so I installed it without the ascii test.

I think we could largely get rid of this ascii-character property: it's
only used in `read-char' and in 99% of the case we could advantageously
replace `read-char' with something that uses `read-key' instead (where
the translation from an event to a character is done via
function-key-map instead of ascii-character).


        Stefan





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

end of thread, other threads:[~2014-06-14 21:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-12 10:32 bug#17759: 24.4.50; Missing 'ascii-character props Eli Barzilay
2014-06-13  6:30 ` Juri Linkov
2014-06-13 12:46   ` Stefan Monnier
2014-06-14  9:50     ` Juri Linkov
2014-06-14 21:15       ` Stefan Monnier

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).