Bug 1998727

Summary: emacs-anthy-unicode does not work on emacs
Product: [Fedora] Fedora Reporter: Shinji Tamura <stamura>
Component: anthy-unicodeAssignee: fujiwara <tfujiwar>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 34CC: tfujiwar
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: anthy-unicode-1.0.0.20201109-10.fc35 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-03 01:10:59 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Tar file made of three patch files and one script file (not compressed) none

Description Shinji Tamura 2021-08-28 11:43:32 UTC
Created attachment 1818551 [details]
Tar file made of three patch files and one script file (not compressed)

Description of problem: Emacs-anthy-unicode does not work on emacs, because the character encodings in anthy-agent-unicode and emacs lisp files are configured improperly. 

Version-Release number of selected component (if applicable):
anthy-unicode-1.0.0.20201109-6.fc34.x86_64.rpm
emacs-anthy-unicode-1.0.0.20201109-6.fc34.noarch.rpm

How reproducible: Everytime

Steps to Reproduce:
1. Add (require 'anthy) to ~/.emacs file.
2. Start emacs and type C-\ in emacs.
3. Type arbitrary Japanese romaji.

Actual results: Entered romaji is displayed as two octets, and converted into two octets still when space-key is typed.

Expected results: Entered romaji is displayed as Japanese hiragana, and converted into right Japanese characters when space-key is typed.


Additional info:
I attached three patch files and one script file. The anthy-unicode-util.patch and anthy-unicode-emacs-el.patch fix this problem sufficiently. To use anthy and anthy-unicode on emacs, the anthy-unicode-util-Makefile.patch and anthy-unicode-emacs-el-change-name.sh are required. These files add 'unicode' to the names of emacs lisp files and their functions, and change character encoding of emacs lisp files into utf8. The script file requires nkf.

Comment 1 fujiwara 2021-10-22 03:36:43 UTC
Thank you very much for your patches.

Your patch causes build errors:
anthy-unicode.el:906:1:Error: Cannot open load file: No such file or directory, anthy-dic
anthy-unicode-isearch.el:14:1:Error: Cannot open load file: No such file or directory, anthy


https://kojipkgs.fedoraproject.org//work/tasks/879/77640879/build.log


I modified #906 line in anthy-unicode.el but still receive a build error:

--- a/src-util/anthy-unicode.el
+++ b/src-util/anthy-unicode.el
@@ -903,8 +903,8 @@
 ;(global-set-key [(meta escape)] 'anthy-mode)
 (provide 'anthy)
 
-(require 'anthy-dic)
-(require 'anthy-conf)
+(require 'anthy-unicode-dic)
+(require 'anthy-unicode-conf)
 
 ;; is it ok for i18n?
 (set-language-info "Japanese" 'input-method "japanese-anthy")


anthy-unicode.el:906:1:Error: Loading file /builddir/build/BUILD/anthy-unicode-1.0.0.20201109/src-util/anthy-unicode-dic.el failed to provide feature `anthy-unicode-dic'

https://kojipkgs.fedoraproject.org//work/tasks/1392/77641392/build.log

Comment 3 Shinji Tamura 2021-10-22 13:33:41 UTC
Thank you for committing my patches and informing me.
The patch files are insufficient if only the names of files are changed.
I recommend adding "unicode" to the names of all functions and variables in anthy-unicode emacs lisp files because Fedora provides anthy and anthy-unicode RPMs.
If anthy and anthy-unicode RPMs are installed simultaneously, "/usr/share/site-lisp/anthy-unicode" is earlier than "/usr/share/site-lisp/anthy" in the variable load-path of emacs.
In this situation, there is a problem in using anthy in emacs because anthy and anthy-unicode RPMs provide the emacs lisp files that contain the functions with same name and different return values.


Changing the subject, I have another proposal of a patch file to make consistent with adding word by kasumi-unicode.

--- src-util/anthy-unicode-dic.el.orig	2021-08-28 19:09:41.806091512 +0900
+++ src-util/anthy-unicode-dic.el	2021-10-22 21:34:29.331951069 +0900
@@ -125,7 +125,7 @@
 	  ((= cat 4)
 	   (setq param (anthy-dic-get-av-category word))))
     (if param
-	(setq res (anthy-add-word yomi 1 word param)))
+	(setq res (anthy-add-word yomi 500 word param)))
     (if res
 	(message (concat word "(" yomi ")を登録しました")))))

Comment 4 Shinji Tamura 2021-10-22 13:55:56 UTC
In my last comment

  Incorrect: "/usr/share/site-lisp/"
  Correct: "/usr/share/emacs/site-lisp/"

Comment 5 fujiwara 2021-10-23 22:24:26 UTC
I don't think the build error is caused by installing both anthy and anthy-unicode.
I think you suggest to fix another issue.

I think your 500 word patch also does not resolve the build error.
I mean if the build errors are not resolved, I will revert your patches in the upstream again.

https://koji.fedoraproject.org/koji/taskinfo?taskID=77726241

Comment 6 fujiwara 2021-10-26 08:02:58 UTC
Finally we fixed the build errors:
https://github.com/fujiwarat/anthy-unicode/commit/e54c7582bc7284575c12827a9685c5ab08cb2674

Comment 8 Fedora Update System 2021-10-26 09:52:02 UTC
FEDORA-2021-bf632768c1 has been submitted as an update to Fedora 35. https://bodhi.fedoraproject.org/updates/FEDORA-2021-bf632768c1

Comment 9 Fedora Update System 2021-10-26 09:52:02 UTC
FEDORA-2021-bf632768c1 has been submitted as an update to Fedora 35. https://bodhi.fedoraproject.org/updates/FEDORA-2021-bf632768c1

Comment 10 Fedora Update System 2021-10-26 15:41:32 UTC
FEDORA-2021-bf632768c1 has been pushed to the Fedora 35 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-bf632768c1`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-bf632768c1

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 11 Fedora Update System 2021-11-03 01:10:59 UTC
FEDORA-2021-bf632768c1 has been pushed to the Fedora 35 stable repository.
If problem still persists, please make note of it in this bug report.