GNU bug report logs - #28118
25.1; input-method-deactivate-hook works twice because of backward compatibility

Previous Next

Package: emacs;

Reported by: Рейх Константин <reich-cv <at> yandex.ru>

Date: Thu, 17 Aug 2017 05:20:01 UTC

Severity: normal

Found in version 25.1

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 28118 in the body.
You can then email your comments to 28118 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#28118; Package emacs. (Thu, 17 Aug 2017 05:20:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Рейх Константин <reich-cv <at> yandex.ru>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 17 Aug 2017 05:20:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Рейх Константин <reich-cv <at> yandex.ru>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.1; input-method-deactivate-hook works twice because of backward
 compatibility
Date: Thu, 17 Aug 2017 07:07:44 +0300
Hi,

I noticed that when i add hook to input-method-deactivate-hook i also
add hook to input-method-inactivate-hook. As a result  the hook in
input-method-deactivate-hook works twice, which should not be the case.

This can be seen from the code in function deactivate-input-method in international/mule-cmds.el:
....
 (run-hooks
	   'input-method-inactivate-hook ; for backward compatibility
	   'input-method-deactivate-hook)
.....

For example
(add-hook 'input-method-deactivate-hook '(lambda () (message
"b") ))

produces "b [2 times]" with deactivation of the input method. 


All version of emacs from 24.3 are affected.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#28118; Package emacs. (Fri, 18 Aug 2017 03:37:01 GMT) Full text and rfc822 format available.

Message #8 received at 28118 <at> debbugs.gnu.org (full text, mbox):

From: Konstantin Reich <reich-cv <at> yandex.ru>
To: 28118 <at> debbugs.gnu.org
Subject: 25.1; input-method-deactivate-hook works twice because of backward
 compatibility
Date: Fri, 18 Aug 2017 06:36:47 +0300
I think the following patch solves the problem.

--- emacs-25.2/lisp/international/mule-cmds.el.orig   2017-02-03 04:25:44.000000000 -0600
+++ emacs-25.2/lisp/international/mule-cmds.el       2017-08-17 22:24:38.750733577 -0500
@@ -1483,7 +1483,6 @@ system (if it corresponds to a MIME char
          (funcall deactivate-current-input-method-function))
       (unwind-protect
          (run-hooks
-          'input-method-inactivate-hook ; for backward compatibility
           'input-method-deactivate-hook)
        (setq current-input-method nil)
        (force-mode-line-update)))))

The problem is that the function deactivate-input-method in the file mule-cmds run two hooks:input-method-inactivate-hook and input-method-deactivate-hook. But they are identical:

(define-obsolete-function-alias
  'inactivate-input-method
  'deactivate-input-method "24.3")


So one hook should be removed.




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Fri, 18 Aug 2017 09:36:02 GMT) Full text and rfc822 format available.

Notification sent to Рейх Константин <reich-cv <at> yandex.ru>:
bug acknowledged by developer. (Fri, 18 Aug 2017 09:36:02 GMT) Full text and rfc822 format available.

Message #13 received at 28118-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Konstantin Reich <reich-cv <at> yandex.ru>
Cc: 28118-done <at> debbugs.gnu.org
Subject: Re: bug#28118: 25.1;
 input-method-deactivate-hook works twice because of backward
 compatibility
Date: Fri, 18 Aug 2017 12:34:45 +0300
> From: Konstantin Reich <reich-cv <at> yandex.ru>
> Date: Fri, 18 Aug 2017 06:36:47 +0300
> 
> I think the following patch solves the problem.

Indeed, but there were several other instances of the same bug.  Now
fixed on the master branch.

Thanks.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 15 Sep 2017 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 282 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.