unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "rgb" <rbielaws@i1.net>
Subject: Re: Avoiding this byte compile warning
Date: 11 Jan 2007 09:46:56 -0800	[thread overview]
Message-ID: <1168537616.398058.252520@o58g2000hsb.googlegroups.com> (raw)
In-Reply-To: 87sleidm5e.fsf@lion.rapttech.com.au


Tim X wrote:
> "rgb" <rbielaws@i1.net> writes:
>
> > I get the following message if the column-marker feature isn't
> > available.
> >
> > tal-mode.el:1367:26:Warning: the following functions are not known to
> > be defined: column-marker-1,  column-marker-2
> >
> > What's the proper way to code the function below so that it works the
> > way I want but doesn't cause a warning?
> >
> > Thanks.
> >
> >
> > (defun tal-setup-column-markers ()
> >   "Turns on column markers if configured and available.
> > See `tal-column-marker-1' and `tal-column-marker-2' "
> >   (if (condition-case ()
> >           (progn (require 'column-marker) nil)
> >         (error t))
> >       (if (not (and (zerop tal-column-marker-1)
> >                     (zerop tal-column-marker-2)))
> >           (message "column markers are configured but %s"
> >                    " column-marker feature not available."))
> >     (setq indent-tabs-mode nil)      ;documented as buffer local
> >     (column-marker-1 tal-column-marker-1)
> >     (column-marker-2 tal-column-marker-2)))
> >
>
> You could try a combination of eval-when-compile and condition-case at the
> beginning of your file. e.g. (not tested)
>
> (eval-when-compile
>   (condition-case nil
>     (require 'blah)
>    (error nil)))
>
Thanks, yes, I did try
I changed it to look like this:

(eval-when-compile (require 'column-marker () t))

(defun tal-setup-column-markers ()
  "Turns on column markers if configured and available.
See `tal-column-marker-1' and `tal-column-marker-2' "
  (unless (and (zerop tal-column-marker-1)
               (zerop tal-column-marker-2))
    (if (featurep 'column-marker)
        (progn (setq indent-tabs-mode nil) ;documented as buffer local
               (column-marker-1 tal-column-marker-1)
               (column-marker-2 tal-column-marker-2))
      (message "column markers are configured but %s"
               " column-marker feature is not available."))))

But that just results in a different warning

tal-mode.el:1366:26:Warning: the following functions might not be
defined at runtime: column-marker-1, column-marker-2

      reply	other threads:[~2007-01-11 17:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-10 16:34 Avoiding this byte compile warning rgb
2007-01-11  8:04 ` Tim X
2007-01-11 17:46   ` rgb [this message]

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=1168537616.398058.252520@o58g2000hsb.googlegroups.com \
    --to=rbielaws@i1.net \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).