all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Oleksandr Gavenko <gavenkoa@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: (require ...) and file dependencies.
Date: Sat, 03 Jan 2015 16:04:00 +0200	[thread overview]
Message-ID: <87y4pk9d0v.fsf@gavenkoa.example.com> (raw)
In-Reply-To: jwvk31cfx3w.fsf-monnier+gnu.emacs.help@gnu.org

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!




  reply	other threads:[~2015-01-03 14:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.16796.1419723800.1147.help-gnu-emacs@gnu.org>
2014-12-28  0:22 ` (require ...) and file dependencies Stefan Monnier
2015-01-03 14:04   ` Oleksandr Gavenko [this message]
2015-01-03 14:30   ` Oleksandr Gavenko
2015-01-03  2:12 ` Emanuel Berg
2014-12-27 23:42 Oleksandr Gavenko
2014-12-27 23:59 ` Oleksandr Gavenko
2014-12-28  0:09 ` Dmitry Gutov
     [not found] ` <mailman.16797.1419724814.1147.help-gnu-emacs@gnu.org>
2014-12-28  0:24   ` Stefan Monnier
     [not found] ` <mailman.16798.1419725386.1147.help-gnu-emacs@gnu.org>
2015-01-03  2:14   ` Emanuel Berg
2015-01-03 14:51     ` Oleksandr Gavenko
     [not found]     ` <mailman.17173.1420296692.1147.help-gnu-emacs@gnu.org>
2015-01-03 17:34       ` Emanuel Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y4pk9d0v.fsf@gavenkoa.example.com \
    --to=gavenkoa@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.