unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#553: 23.0.60; Unknown button type `quail-keyboard-layout-button'
@ 2008-07-12 22:04 Juri Linkov
  0 siblings, 0 replies; 4+ messages in thread
From: Juri Linkov @ 2008-07-12 22:04 UTC (permalink / raw)
  To: emacs-pretest-bug

1. `emacs -Q'
2. `M-: (require 'help-mode) RET'
   or run any Help command that loads this mode
3. Activate an input method by C-\
4. Click `mouse-3' on the input method's indicator
   on the mode-line

It fills the *Help* buffer with the text only until
it tries to create a button, and fails with the error
"make-text-button: Unknown button type `quail-keyboard-layout-button'".

This is because `quail-help-init' fails to define new button types.
It currently has the form:

(defun quail-help-init ()
  (unless (featurep 'help-mode)
    (require 'help-mode)
    (define-button-type 'quail-keyboard-layout-button
      :supertype 'help-xref
      'help-function '(lambda (layout)
			(help-setup-xref `(quail-keyboard-layout-button ,layout)
					 nil)
			(quail-show-keyboard-layout layout))
      'help-echo (purecopy "mouse-2, RET: show keyboard layout"))

    (define-button-type 'quail-keyboard-customize-button
      :supertype 'help-customize-variable
      'help-echo (purecopy "mouse-2, RET: customize keyboard layout"))))

So it doesn't define two button types if `help-mode' is already loaded.

I guess it was done to define them only once, and not redefine on next
invocations.  Instead of checking for (featurep 'help-mode) it could
check if these buttons were already defined.  I can't find a function
like `button-defined-p' to do this.  But the following check seems to work:

(get 'quail-keyboard-layout-button 'button-category-symbol)

-- 
Juri Linkov
http://www.jurta.org/emacs/






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

* bug#553: 23.0.60; Unknown button type `quail-keyboard-layout-button'
@ 2008-08-21 23:41 Chong Yidong
  2008-08-25 15:52 ` Juri Linkov
  0 siblings, 1 reply; 4+ messages in thread
From: Chong Yidong @ 2008-08-21 23:41 UTC (permalink / raw)
  To: Kenichi Handa; +Cc: 553

Hi Handa-san,

> 1. `emacs -Q'
> 2. `M-: (require 'help-mode) RET'
>    or run any Help command that loads this mode
> 3. Activate an input method by C-\
> 4. Click `mouse-3' on the input method's indicator
>    on the mode-line
>
> It fills the *Help* buffer with the text only until
> it tries to create a button, and fails with the error
> "make-text-button: Unknown button type `quail-keyboard-layout-button'".
>
> This is because `quail-help-init' fails to define new button types.
> It currently has the form:
>
> (defun quail-help-init ()
>   (unless (featurep 'help-mode)
>     (require 'help-mode)
>     (define-button-type 'quail-keyboard-layout-button
>       :supertype 'help-xref
>       'help-function '(lambda (layout)
> 			(help-setup-xref `(quail-keyboard-layout-button ,layout)
> 					 nil)
> 			(quail-show-keyboard-layout layout))
>       'help-echo (purecopy "mouse-2, RET: show keyboard layout"))
>
>     (define-button-type 'quail-keyboard-customize-button
>       :supertype 'help-customize-variable
>       'help-echo (purecopy "mouse-2, RET: customize keyboard layout"))))
>
> So it doesn't define two button types if `help-mode' is already loaded.
>
> I guess it was done to define them only once, and not redefine on next
> invocations.

Do you remember why you wrote quail-help-init this way?  It seems
unnecessary; why not define the button types directly at the top level
of quail.el?






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

* bug#553: 23.0.60; Unknown button type `quail-keyboard-layout-button'
  2008-08-21 23:41 bug#553: 23.0.60; Unknown button type `quail-keyboard-layout-button' Chong Yidong
@ 2008-08-25 15:52 ` Juri Linkov
  0 siblings, 0 replies; 4+ messages in thread
From: Juri Linkov @ 2008-08-25 15:52 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 553, Kenichi Handa

> Do you remember why you wrote quail-help-init this way?  It seems
> unnecessary; why not define the button types directly at the top level
> of quail.el?

I don't know the reason of writing quail-help-init this way, but it seems
it was to not load `help-mode' after loading `quail.el'.  `help-mode' is
not necessary for quail's operations, so its loading should be postponed
for rare cases when the user needs to see the help buffer with keyboard
layouts.

-- 
Juri Linkov
http://www.jurta.org/emacs/






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

* bug#553: 23.0.60; Unknown button type `quail-keyboard-layout-button'
@ 2008-08-26 21:11 Chong Yidong
  0 siblings, 0 replies; 4+ messages in thread
From: Chong Yidong @ 2008-08-26 21:11 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 553, Kenichi Handa

> > Do you remember why you wrote quail-help-init this way?  It seems
> > unnecessary; why not define the button types directly at the top level
> > of quail.el?
>
> I don't know the reason of writing quail-help-init this way, but it seems
> it was to not load `help-mode' after loading `quail.el'.  `help-mode' is
> not necessary for quail's operations, so its loading should be postponed
> for rare cases when the user needs to see the help buffer with keyboard
> layouts.

Right, but why do we have to put the button definitions inside
quail-help-init?  In other words, why not the following?

*** trunk/lisp/international/quail.el.~1.164.~	2008-05-06 00:18:15.000000000 -0400
--- trunk/lisp/international/quail.el	2008-08-26 17:09:39.000000000 -0400
***************
*** 2424,2450 ****
  	(insert ?\n))
        (insert ?\n))))
  
! (defun quail-help-init ()
!   (unless (featurep 'help-mode)
!     (require 'help-mode)
!     (define-button-type 'quail-keyboard-layout-button
!       :supertype 'help-xref
!       'help-function '(lambda (layout)
! 			(help-setup-xref `(quail-keyboard-layout-button ,layout)
! 					 nil)
! 			(quail-show-keyboard-layout layout))
!       'help-echo (purecopy "mouse-2, RET: show keyboard layout"))
! 
!     (define-button-type 'quail-keyboard-customize-button
!       :supertype 'help-customize-variable
!       'help-echo (purecopy "mouse-2, RET: customize keyboard layout"))))
  
  (defun quail-help (&optional package)
    "Show brief description of the current Quail package.
  Optional arg PACKAGE specifies the name of alternative Quail
  package to describe."
    (interactive)
!   (quail-help-init)
    (let ((help-xref-mule-regexp help-xref-mule-regexp-template)
  	(mb enable-multibyte-characters)
  	(package-def
--- 2424,2447 ----
  	(insert ?\n))
        (insert ?\n))))
  
! (define-button-type 'quail-keyboard-layout-button
!   :supertype 'help-xref
!   'help-function '(lambda (layout)
! 		    (help-setup-xref `(quail-keyboard-layout-button ,layout)
! 				     nil)
! 		    (quail-show-keyboard-layout layout))
!   'help-echo (purecopy "mouse-2, RET: show keyboard layout"))
! 
! (define-button-type 'quail-keyboard-customize-button
!   :supertype 'help-customize-variable
!   'help-echo (purecopy "mouse-2, RET: customize keyboard layout"))
  
  (defun quail-help (&optional package)
    "Show brief description of the current Quail package.
  Optional arg PACKAGE specifies the name of alternative Quail
  package to describe."
    (interactive)
!   (require 'help-mode)
    (let ((help-xref-mule-regexp help-xref-mule-regexp-template)
  	(mb enable-multibyte-characters)
  	(package-def






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

end of thread, other threads:[~2008-08-26 21:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-21 23:41 bug#553: 23.0.60; Unknown button type `quail-keyboard-layout-button' Chong Yidong
2008-08-25 15:52 ` Juri Linkov
  -- strict thread matches above, loose matches on Subject: below --
2008-08-26 21:11 Chong Yidong
2008-07-12 22:04 Juri Linkov

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