tsutsui / netbsd-teokureliveimage

Scripts and files to build NetBSD "Teokure Live Image" http://www.ceres.dti.ne.jp/tsutsui/netbsd/liveimage/
10 stars 1 forks source link

emacs 29.4 で mozc-elisp の警告が出ている #60

Closed tsutsui closed 1 month ago

tsutsui commented 4 months ago

20240707版の emacs 29.4 で mozc.el に対して以下の警告が出ている

 ■  Warning (comp): mozc.el:122:2: Warning: Package cl is deprecated
 ■  Warning (comp): mozc.el:206:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
 ■  Warning (comp): mozc.el:394:17: Warning: ‘case’ is an obsolete alias (as of 27.1); use ‘cl-case’ instead.
 ■  Warning (comp): mozc.el:394:22: Warning: Case 'eisu-toggle will match ‘quote’.  If that’s intended, write (eisu-toggle quote) instead.  Otherwise, don’t quote ‘eisu-toggle’.
 ■  Warning (comp): mozc.el:394:22: Warning: Case 'hiragana-katakana will match ‘quote’.  If that’s intended, write (hiragana-katakana quote) instead.  Otherwise, don’t quote ‘hiragana-katakana’.
 ■  Warning (comp): mozc.el:394:22: Warning: Case 'next will match ‘quote’.  If that’s intended, write (next quote) instead.  Otherwise, don’t quote ‘next’.
 ■  Warning (comp): mozc.el:394:22: Warning: Case 'prior will match ‘quote’.  If that’s intended, write (prior quote) instead.  Otherwise, don’t quote ‘prior’.
 ■  Warning (comp): mozc.el:394:22: Warning: Case 'kp-decimal will match ‘quote’.  If that’s intended, write (kp-decimal quote) instead.  Otherwise, don’t quote ‘kp-decimal’.
 ■  Warning (comp): mozc.el:394:22: Warning: Case 'kp-0 will match ‘quote’.  If that’s intended, write (kp-0 quote) instead.  Otherwise, don’t quote ‘kp-0’.
 ■  Warning (comp): mozc.el:394:22: Warning: Case 'kp-1 will match ‘quote’.  If that’s intended, write (kp-1 quote) instead.  Otherwise, don’t quote ‘kp-1’.
 ■  Warning (comp): mozc.el:394:22: Warning: Case 'kp-2 will match ‘quote’.  If that’s intended, write (kp-2 quote) instead.  Otherwise, don’t quote ‘kp-2’.
 ■  Warning (comp): mozc.el:394:22: Warning: Case 'kp-3 will match ‘quote’.  If that’s intended, write (kp-3 quote) instead.  Otherwise, don’t quote ‘kp-3’.
 ■  Warning (comp): mozc.el:394:22: Warning: Case 'kp-4 will match ‘quote’.  If that’s intended, write (kp-4 quote) instead.  Otherwise, don’t quote ‘kp-4’.
 ■  Warning (comp): mozc.el:394:22: Warning: Case 'kp-5 will match ‘quote’.  If that’s intended, write (kp-5 quote) instead.  Otherwise, don’t quote ‘kp-5’.
 ■  Warning (comp): mozc.el:394:22: Warning: Case 'kp-6 will match ‘quote’.  If that’s intended, write (kp-6 quote) instead.  Otherwise, don’t quote ‘kp-6’.
 ■  Warning (comp): mozc.el:394:22: Warning: Case 'kp-7 will match ‘quote’.  If that’s intended, write (kp-7 quote) instead.  Otherwise, don’t quote ‘kp-7’.
 ■  Warning (comp): mozc.el:394:22: Warning: Case 'kp-8 will match ‘quote’.  If that’s intended, write (kp-8 quote) instead.  Otherwise, don’t quote ‘kp-8’.
 ■  Warning (comp): mozc.el:394:22: Warning: Case 'kp-9 will match ‘quote’.  If that’s intended, write (kp-9 quote) instead.  Otherwise, don’t quote ‘kp-9’.
 ■  Warning (comp): mozc.el:394:22: Warning: Case 'kp-delete will match ‘quote’.  If that’s intended, write (kp-delete quote) instead.  Otherwise, don’t quote ‘kp-delete’.
 ■  Warning (comp): mozc.el:394:22: Warning: Case 'kp-insert will match ‘quote’.  If that’s intended, write (kp-insert quote) instead.  Otherwise, don’t quote ‘kp-insert’.
 ■  Warning (comp): mozc.el:394:22: Warning: Case 'kp-end will match ‘quote’.  If that’s intended, write (kp-end quote) instead.  Otherwise, don’t quote ‘kp-end’.
 ■  Warning (comp): mozc.el:394:22: Warning: Case 'kp-down will match ‘quote’.  If that’s intended, write (kp-down quote) instead.  Otherwise, don’t quote ‘kp-down’.
 ■  Warning (comp): mozc.el:394:22: Warning: Case 'kp-next will match ‘quote’.  If that’s intended, write (kp-next quote) instead.  Otherwise, don’t quote ‘kp-next’.
 ■  Warning (comp): mozc.el:394:22: Warning: Case 'kp-left will match ‘quote’.  If that’s intended, write (kp-left quote) instead.  Otherwise, don’t quote ‘kp-left’.
 ■  Warning (comp): mozc.el:394:22: Warning: Case 'kp-begin will match ‘quote’.  If that’s intended, write (kp-begin quote) instead.  Otherwise, don’t quote ‘kp-begin’.
 ■  Warning (comp): mozc.el:394:22: Warning: Case 'kp-right will match ‘quote’.  If that’s intended, write (kp-right quote) instead.  Otherwise, don’t quote ‘kp-right’.
 ■  Warning (comp): mozc.el:394:22: Warning: Case 'kp-home will match ‘quote’.  If that’s intended, write (kp-home quote) instead.  Otherwise, don’t quote ‘kp-home’.
 ■  Warning (comp): mozc.el:394:22: Warning: Case 'kp-up will match ‘quote’.  If that’s intended, write (kp-up quote) instead.  Otherwise, don’t quote ‘kp-up’.
 ■  Warning (comp): mozc.el:394:22: Warning: Case 'kp-prior will match ‘quote’.  If that’s intended, write (kp-prior quote) instead.  Otherwise, don’t quote ‘kp-prior’.
 ■  Warning (comp): mozc.el:394:22: Warning: Case 'kp-add will match ‘quote’.  If that’s intended, write (kp-add quote) instead.  Otherwise, don’t quote ‘kp-add’.
 ■  Warning (comp): mozc.el:394:22: Warning: Case 'kp-subtract will match ‘quote’.  If that’s intended, write (kp-subtract quote) instead.  Otherwise, don’t quote ‘kp-subtract’.
 ■  Warning (comp): mozc.el:394:22: Warning: Case 'kp-multiply will match ‘quote’.  If that’s intended, write (kp-multiply quote) instead.  Otherwise, don’t quote ‘kp-multiply’.
 ■  Warning (comp): mozc.el:394:22: Warning: Case 'kp-divide will match ‘quote’.  If that’s intended, write (kp-divide quote) instead.  Otherwise, don’t quote ‘kp-divide’.
 ■  Warning (comp): mozc.el:394:22: Warning: Case 'kp-enter will match ‘quote’.  If that’s intended, write (kp-enter quote) instead.  Otherwise, don’t quote ‘kp-enter’.
 ■  Warning (comp): mozc.el:583:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
 ■  Warning (comp): mozc.el:826:21: Warning: ‘case’ is an obsolete alias (as of 27.1); use ‘cl-case’ instead.
 ■  Warning (comp): mozc.el:1257:16: Warning: ‘incf’ is an obsolete alias (as of 27.1); use ‘cl-incf’ instead.
 ■  Warning (comp): mozc.el:1423:2: Warning: defvar `mozc-session-seq' docstring has wrong usage of unescaped single quotes (use \= or different quoting)
 ■  Warning (comp): mozc.el:1463:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
 ■  Warning (comp): mozc.el:1643:6: Warning: ‘case’ is an obsolete alias (as of 27.1); use ‘cl-case’ instead.
 ■  Warning (comp): mozc.el:1720:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
 ■  Warning (comp): mozc.el:1762:10: Warning: ‘inhibit-changing-match-data’ is an obsolete variable (as of 29.1); use ‘save-match-data’ instead.

修正すべきポイントについては追って記載予定。 ただ、新しい mozc から変更を持ってくるほうがよいかもしれない。

tsutsui commented 3 months ago

修正すべきポイントについては追って記載予定。

AIておくれロボに聞いた内容をメモ。

■ Warning (comp): mozc.el:122:2: Warning: Package cl is deprecated

これは cl パッケージのインポートを cl-lib に変更すればOK これは emacs 24以降で使用可能

■ Warning (comp): mozc.el:206:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)

'variable' といった記載(コメント内を含む)を `variable' あるいは \'variable' などとすればOK (追記:逆だったので訂正)

■ Warning (comp): mozc.el:394:17: Warning: ‘case’ is an obsolete alias (as of 27.1); use ‘cl-case’ instead.

これはそのまま casecl-case に置き換えればOK

■ Warning (comp): mozc.el:394:22: Warning: Case 'eisu-toggle will match ‘quote’. If that’s intended, write (eisu-toggle quote) instead. Otherwise, don’t quote ‘eisu-toggle’.

これは前述の「 casecl-case に置き換える」で合わせて解消される

■ Warning (comp): mozc.el:1257:16: Warning: ‘incf’ is an obsolete alias (as of 27.1); use ‘cl-incf’ instead.

これもそのまま incfcl-incf に置き換えればOKと思われる

■ Warning (comp): mozc.el:1762:10: Warning: ‘inhibit-changing-match-data’ is an obsolete variable (as of 29.1); use ‘save-match-data’ instead.

save-match-data は emacs 28 以降のみらしいので、切り替えの記載が必要。

(defun mozc-string-match-p (regexp string &optional start)
  "Same as `string-match' except this function never change the match data.
REGEXP, STRING and optional START are the same as for `string-match'.

This function is equivalent to `string-match-p', which is available since Emacs 23."
  (if (boundp 'inhibit-changing-match-data)
    ;; Emacs 28 以前のバージョンで使うロボ
    (let ((inhibit-changing-match-data t))
      (string-match regexp string start))
    ;; Emacs 29 以降のバージョンで使うロボ
    (save-match-data
      (string-match regexp string start))))
tsutsui commented 3 months ago

ただ、新しい mozc から変更を持ってくるほうがよいかもしれない。

ざっと見て以下なので、持ってきたほうが良さそう。 https://github.com/google/mozc/commits/master/src/unix/emacs/mozc.el

■ Warning (comp): mozc.el:122:2: Warning: Package cl is deprecated

これは cl パッケージのインポートを cl-lib に変更すればOK

修正済み

■ Warning (comp): mozc.el:206:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)

`variable' といった記載(コメント内を含む)を ’variable' あるいは \`variable' などとすればOK

これは修正されていないっぽい

■ Warning (comp): mozc.el:394:17: Warning: ‘case’ is an obsolete alias (as of 27.1); use ‘cl-case’ instead.

これはそのまま casecl-case に置き換えればOK

修正済み

■ Warning (comp): mozc.el:394:22: Warning: Case 'eisu-toggle will match ‘quote’. If that’s intended, write (eisu-toggle quote) instead. Otherwise, don’t quote ‘eisu-toggle’.

これは前述の「 casecl-case に置き換える」で合わせて解消される

これも直してあるっぽい

■ Warning (comp): mozc.el:1257:16: Warning: ‘incf’ is an obsolete alias (as of 27.1); use ‘cl-incf’ instead.

これもそのまま incfcl-incf に置き換えればOKと思われる

修正済み

■ Warning (comp): mozc.el:1762:10: Warning: ‘inhibit-changing-match-data’ is an obsolete variable (as of 29.1); use ‘save-match-data’ instead.

save-match-data は emacs 28 以降のみらしいので、切り替えの記載が必要。

(defun mozc-string-match-p (regexp string &optional start)
  "Same as `string-match' except this function never change the match data.
REGEXP, STRING and optional START are the same as for `string-match'.

This function is equivalent to `string-match-p', which is available since Emacs 23."
  (if (boundp 'inhibit-changing-match-data)
    ;; Emacs 28 以前のバージョンで使うロボ
    (let ((inhibit-changing-match-data t))
      (string-match regexp string start))
    ;; Emacs 29 以降のバージョンで使うロボ
    (save-match-data
      (string-match regexp string start))))

mozc-string-match-p () 自体が string-match-p () を持たないemacs23 以前用の互換関数で、これ自体が削除されている。 cl-lib が emacs 24 以降なのでどのみち upstream に合わせれば良い。

tsutsui commented 3 months ago

`variable' といった記載(コメント内を含む)を ’variable' あるいは \`variable' などとすればOK

これの雑差分(未テスト)

--- mozc-2.26.4282.100/src/unix/emacs/mozc.el.orig  2024-07-07 16:26:55.652537483 +0900
+++ mozc-elisp226/work.x86_64/mozc-2.26.4282.100/src/unix/emacs/mozc.el 2024-07-07 17:04:09.327449502 +0900
@@ -220,10 +220,10 @@
 have many user settings on their side.

 You can change a variety of user settings through a GUI command
-line tool 'mozc_tool' which must be shipped with the mozc server.
+line tool `mozc_tool' which must be shipped with the mozc server.
 The command line tool may be installed to /usr/lib/mozc or /usr/lib
 directory.
-You need a command line option '--mode=config_dialog' as the
+You need a command line option `--mode=config_dialog' as the
 following.

   $ /usr/lib/mozc/mozc_tool --mode=config_dialog
@@ -589,11 +589,11 @@
 of a wrapped line, this function returns the position information exactly
 at the point.

-For example, suppose the following line in the buffer and the point is at 'd'
-\(the beginning of character 'd'),
+For example, suppose the following line in the buffer and the point is at \'d'
+\(the beginning of character \'d'),
     ....... abc[wrap]
     def...
-\(cdr (posn-actual-col-row (posn-at-point AT_D))) is the same number at 'c' on
+\(cdr (posn-actual-col-row (posn-at-point AT_D))) is the same number at \'c' on
 a terminal.

 In a word, this function is a fixed version of `posn-at-point'."
@@ -1425,8 +1425,8 @@
 Using this ID, the program recognizes which response corresponds to
 a certain request avoiding cross talk.

-This sequence number is called 'event-id' in the helper process,
-which doesn't have to be a *sequence* number.")
+This sequence number is called `event-id' in the helper process,
+which doesn\'t have to be a *sequence* number.")

 (defun mozc-session-create (&optional forcep)
   "Create a Mozc session if necessary and return it.
@@ -1465,8 +1465,8 @@
 The resulting protocol buffer, which is represented as alist, is
 mozc::commands::Output in C++.  Return nil on error.

-KEY-LIST is a list of a key code (97 = ?a), key symbols ('space, 'shift,
-'meta and so on), and/or a string which represents the preedit to be
+KEY-LIST is a list of a key code (97 = ?a), key symbols (\'space, \'shift,
+\'meta and so on), and/or a string which represents the preedit to be
 inserted (\"\\u3061\")."
   (when (mozc-session-create)
     (apply #'mozc-session-execute-command 'SendKey key-list)))
@@ -1722,10 +1722,10 @@
 Return a found value, or nil if not found.
 KEY and KEYS can be a symbol or integer.

-For example, (mozc-protobuf-get protobuf 'key1 2 'key3) is equivalent to
-  (cdr (assq 'key3
+For example, (mozc-protobuf-get protobuf \'key1 2 \'key3) is equivalent to
+  (cdr (assq \'key3
              (nth 2
-                  (cdr (assq 'key1
+                  (cdr (assq \'key1
                              protobuf)))))
 except for error handling.  This is similar to
   protobuf.key1(2).key3()
tsutsui commented 3 months ago

まだ追加で怒られているようなので確認する

 stop  Warning (comp): mozc.el:584:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
 stop  Warning (comp): mozc.el:1464:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)
 stop  Warning (comp): mozc.el:1721:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting)

追加で訊くとどうも以下のようである

tsutsui commented 3 months ago

https://gist.github.com/tsutsui/974db8ec7c00ba6bba000b9c7bd90eb5 とりあえずこれで警告は消える。意図通り動いているかは別途考える。

tsutsui commented 3 months ago

https://mail-index.netbsd.org/pkgsrc-changes/2024/08/03/msg304277.html コミットした。 次回のイメージ作成時に確認する。

tsutsui commented 1 month ago

pkgsrc-2024Q3 で警告がでないことを確認 emacs-29-2024Q3