all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Avoiding this byte compile warning
@ 2007-01-10 16:34 rgb
  2007-01-11  8:04 ` Tim X
  0 siblings, 1 reply; 3+ messages in thread
From: rgb @ 2007-01-10 16:34 UTC (permalink / raw)


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)))

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Avoiding this byte compile warning
  2007-01-10 16:34 Avoiding this byte compile warning rgb
@ 2007-01-11  8:04 ` Tim X
  2007-01-11 17:46   ` rgb
  0 siblings, 1 reply; 3+ messages in thread
From: Tim X @ 2007-01-11  8:04 UTC (permalink / raw)


"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)))

Tim

-- 
tcross (at) rapttech dot com dot au

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Avoiding this byte compile warning
  2007-01-11  8:04 ` Tim X
@ 2007-01-11 17:46   ` rgb
  0 siblings, 0 replies; 3+ messages in thread
From: rgb @ 2007-01-11 17:46 UTC (permalink / raw)



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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-01-11 17:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-10 16:34 Avoiding this byte compile warning rgb
2007-01-11  8:04 ` Tim X
2007-01-11 17:46   ` rgb

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.