[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: (require ...) and file dependencies.
From: |
Oleksandr Gavenko |
Subject: |
Re: (require ...) and file dependencies. |
Date: |
Sat, 03 Jan 2015 16:04:00 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) |
On 2014-12-28, Stefan Monnier wrote:
>> They may fixed by:
>>
>> (eval-when-compile
>> (defvar ...))
>
> No, it's fixed with
>
> (defvar <foo>)
>
> Siuch (defvar <foo>) declarations (i.e. without an initial value) are
> annotations for the *compiler*, so you don't want to pas them to the
> `eval'uator (hence you don't want to wrap them in `eval-when-compile').
> The fact that they also work when wrapped in `eval-when-compile' is an
> accident which might get fixed at any point.
Thanks for tips. I found:
>> (eval-when-compile
>> (defvar ...))
by grepping some sources. I usually try to check how things done by another
before inventing own style.
Currently Emacs sources have some occurrences of such code (so I send replay
also in private to rise attention). I run:
ack -C 4 eval-when-compile # with 4 line context
and look to `defvar`. Before showing complete list I put weird code, which
seems need to be fixed:
lisp/progmodes/sql.el
1391:(eval-when-compile
1392- (defvar sql-mode-ansi-font-lock-keywords)
1393- (setq sql-mode-ansi-font-lock-keywords nil))
Here strange comment and strange conditional defvar:
lisp/progmodes/verilog-mode.el
8407:(eval-when-compile
8408- ;; Prevent compile warnings; these are let's, not globals
8409: ;; Do not remove the eval-when-compile
8410- ;; - we want an error when we are debugging this code if they are
refed.
8411- (defvar sigs-in)
8412- (defvar sigs-inout)
8413- (defvar sigs-intf)
(defvar sigs-out)
(defvar sigs-out-d)
(defvar sigs-out-i)
(defvar sigs-out-unk)
(defvar sigs-temp)
;; These are known to be from other packages and may not be defined
(defvar diff-command nil)
(defvar vector-skip-list)
;; There are known to be from newer versions of Emacs
(defvar create-lockfiles))
10065:(eval-when-compile
10066- (if (not (boundp 'indent-pt))
10067- (defvar indent-pt nil "Local used by insert-indent")))
I don't understand Gnus magic for XEmacs:
lisp/gnus/gnus-ml.el
87:(eval-when-compile
88- (when (featurep 'xemacs)
89- (defvar gnus-mailing-list-mode-hook)
90- (defvar gnus-mailing-list-mode-on-hook)
91- (defvar gnus-mailing-list-mode-off-hook)))
lisp/gnus/gnus-salt.el
103:(eval-when-compile
104- (when (featurep 'xemacs)
105- (defvar gnus-pick-mode-on-hook)
106- (defvar gnus-pick-mode-off-hook)))
342:(eval-when-compile
343- (when (featurep 'xemacs)
344- (defvar gnus-binary-mode-on-hook)
345- (defvar gnus-binary-mode-off-hook)))
lisp/gnus/gnus-dired.el
89:(eval-when-compile
90- (when (featurep 'xemacs)
91- (defvar gnus-dired-mode-hook)
92- (defvar gnus-dired-mode-on-hook)
93- (defvar gnus-dired-mode-off-hook)))
Seems that this can be fixed by anyone with commit right away:
lisp/org/org.el
8477:(eval-when-compile
8478- (defvar org-property-drawer-re))
lisp/org/org-colview.el
752:(eval-when-compile (defvar org-columns-time))
lisp/printing.el
1099:(eval-when-compile
1100- ;; User Interface --- declared here to avoid compiler warnings
1101- (defvar pr-path-style)
1102- (defvar pr-auto-region)
1103- (defvar pr-menu-char-height)
--
Best regards!