GithubHelp home page GithubHelp logo

Comments (8)

tkita avatar tkita commented on July 4, 2024

ご意見ありがとうございます。
XEmacs のサポートは終了してもよいと思います。サポート終了するなら、きちんとアナウンスして周知してからでしょうね。
私の手元の GNU Emacs 23.1.1 で make してみましたが、Warning はひとつだけでした。私がメンテをサボっているコードであり、そのうち直します。

[USER@fedora ddskk-master]$ emacs --version
GNU Emacs 23.1.1
Copyright (C) 2009 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

[USER@fedora ddskk-master]$ make
emacs -batch -q -no-site-file -l SKK-MK -f SKK-MK-compile
Loading /home/USER/ddskk-master/SKK-CFG...
Generating autoloads for /home/USER/ddskk-master/skk-viper.el...
Generating autoloads for /home/USER/ddskk-master/skk-viper.el...done
略
Generating autoloads for /home/USER/ddskk-master/tar-util.el...
Generating autoloads for /home/USER/ddskk-master/tar-util.el...done
Loading /home/USER/ddskk-master/skk-autoloads.el (source)...
Wrote /home/USER/ddskk-master/skk-viper.elc
略
Wrote /home/USER/ddskk-master/skk.elc

In end of data:
tar-util.el:120:1:Warning: the function `tar--extract' is not known to be
    defined.
Wrote /home/USER/ddskk-master/tar-util.elc

[USER@fedora ddskk-master]$

@conao3 さんのような Warning は生じません。何が違うのでしょうね?

from ddskk.

conao3 avatar conao3 commented on July 4, 2024
TOP          := $(dir $(lastword $(MAKEFILE_LIST)))
DEPENDS      := ddskk posframe

EMACS        ?= emacs
BATCH        := $(EMACS) -Q --batch -L $(TOP) $(DEPENDS:%=-L ./%/)

%.elc: %.el $(DEPENDS)
	$(BATCH) -f batch-byte-compile $<

https://github.com/conao3/ddskk-posframe.el
私が昨日作ったddskk関連のパッケージのMakefileから抜粋します。elcの標準的なコンパイル方法に詳しくないのですが、普通は batch-byte-compile によって行うと思います。
こちらのパッケージのMakeでは SKK-MK-compile によって行っていますが、内部では byte-compile-file を呼んでいますね。どちらも同じようにコンパイルできていると思います。

問題があるとすれば、私が設定した -L オプションが足りないことですかね。。
どちらにせよ、Emacs-26でのワーニングである

Use ‘with-current-buffer’ rather than save-excursion+set-buffer

はそのとおりで、Emacs-23で定義されていないなら、Emacs-23用に定義して with-curernt-buffer を使うべきだと思います。
手元ではEmacs-23.4で定義されていることを確認しました。それ以前のEmacsは環境がないのでわかりません。。

from ddskk.

conao3 avatar conao3 commented on July 4, 2024

xargsで生成されたコンパイルのコマンドは書いてありましたが、その前のコマンドが書かれてませんでいした。
それぞれ、ddskkのディレクトリにおいて、このコマンドで実行しました。

find . -name '*.elc' | xargs rm; find . -name '*.el' -depth 1 | xargs -n1 -t emacs-23.4 --batch -L ./ -L ./bayesian/ -L ./nicola/ -L ./tut-code/ -f batch-byte-compile 2>&1 | pbcopy

find . -name '*.elc' | xargs rm; find . -name '*.el' -depth 1 | xargs -n1 -t emacs-26.2 --batch -L ./ -L ./bayesian/ -L ./nicola/ -L ./tut-code/ -f batch-byte-compile 2>&1 | pbcopy

from ddskk.

tkita avatar tkita commented on July 4, 2024

現在、コンパイルすると大量のワーニングが出るほか
ワーニングが生じることを問題視しているのですよね。

こちらのパッケージのMakeでは SKK-MK-compile によって行っていますが、
内部では byte-compile-file を呼んでいますね。
どちらも同じようにコンパイルできていると思います。
make では、SKK-MK にて必要なファイルを require しているので、ワーニング出ません。
@conao3 さんの方法では必要なファイルが require されないので、ワーニングが出て当然です。

from ddskk.

tkita avatar tkita commented on July 4, 2024

問題があるとすれば、私が設定した -L オプションが足りないことですかね。。
どちらにせよ、Emacs-26でのワーニングである
Use ‘with-current-buffer’ rather than save-excursion+set-buffer
はそのとおりで、Emacs-23で定義されていないなら、
Emacs-23用に定義して with-curernt-buffer を使うべきだと思います。

否。
マクロ with-current-buffer は相当昔から subr.el で実装されています。

$ git blame
83f57f499af (Martin Rudalics         2008-10-25 09:18:19 +0000 3335) (defmacro with-current-buffer (buffer-or-name &rest body)

$ git show 83f57f
commit 83f57f499af3922fd09956044f7fe8596e21b686
Author: Martin Rudalics <[email protected]>
Date:   Sat Oct 25 09:18:19 2008 +0000

    (with-current-buffer): Rename buffer argument to buffer-or-name.

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 56d04af23e..b6651bd3ac 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,7 @@
 2008-10-25  Martin Rudalics  <[email protected]>

+       * subr.el (with-current-buffer): Rename buffer argument to
+       buffer-or-name.
        * window.el (get-buffer-window-list): Rename buffer argument to
        buffer-or-name and make it optional.

diff --git a/lisp/subr.el b/lisp/subr.el
index 5a1f4d42ee..0dda4b0e60 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2483,14 +2483,14 @@ Similar to `call-process-shell-command', but calls `process-file'."
 ^L
 ;;;; Lisp macros to do various things temporarily.

-(defmacro with-current-buffer (buffer &rest body)
-  "Execute the forms in BODY with BUFFER temporarily current.
-BUFFER can be a buffer or a buffer name.
-The value returned is the value of the last form in BODY.
-See also `with-temp-buffer'."
+(defmacro with-current-buffer (buffer-or-name &rest body)
+  "Execute the forms in BODY with BUFFER-OR-NAME temporarily current.
+BUFFER-OR-NAME must be a buffer or the name of an existing buffer.
+The value returned is the value of the last form in BODY.  See
+also `with-temp-buffer'."
   (declare (indent 1) (debug t))
   `(save-current-buffer
-     (set-buffer ,buffer)
+     (set-buffer ,buffer-or-name)
      ,@body))

 (defmacro with-selected-window (window &rest body)
$

Martin さんは buffer を buffer-or-name へ修正しただけで、with-current-buffer んp定義はそれ以前から存在します。

バッチモード(--batch)だから subr.el すら require されないのでは?

from ddskk.

conao3 avatar conao3 commented on July 4, 2024

ワーニングが生じることを問題視しているのですよね。

「ワーニングが出ること」は問題視していません。ワーニングはメンテナンスの指標であり、ワーニングが出なくともリファインするべき箇所がある場合や、ワーニングを無視する場合は当然あると思います。

ただ一般的にワーニングは積極的に直すべきTODOリストになると思います。
with-current-buffer をあえて使わない理由も特にないと思われます。

@conao3 さんの方法では必要なファイルが require されないので、ワーニングが出て当然です。

とすると1ファイルが1つの「機能」として閉じていないということでしょうか。それはElispファイルの作りとして珍しい方法だと思います。
ユーザーがパッケージを使用する場合にも、requireする順番に依存してエラーが出たり出なかったりするのは不都合だと思いますが、ここのパッケージは別のルールのもとで開発されている(いた)のでしょうか。

from ddskk.

conao3 avatar conao3 commented on July 4, 2024

問題があるとすれば、私が設定した -L オプションが足りないことですかね。。
どちらにせよ、Emacs-26でのワーニングである
Use ‘with-current-buffer’ rather than save-excursion+set-buffer
はそのとおりで、Emacs-23で定義されていないなら、
Emacs-23用に定義して with-curernt-buffer を使うべきだと思います。

否。
マクロ with-current-buffer は相当昔から subr.el で実装されています。

このコメントはちょっと分からないです。つまりEmacs-23でも使えるということでしょうか。
ではwith-current-bufferを使うべきではないでしょうか?

from ddskk.

conao3 avatar conao3 commented on July 4, 2024

Closeします。

from ddskk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.