all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: help-gnu-emacs@gnu.org
Subject: Re: How to set calendar-date-style in init?
Date: Sun, 11 Oct 2020 09:50:20 +0200	[thread overview]
Message-ID: <87k0vxjj5v.fsf@web.de> (raw)
In-Reply-To: m2wnzxwigh.fsf@codeisgreat.org

Pankaj Jangid <pankaj@codeisgreat.org> writes:

> I have tried following options. What am I doing wrong here?
>
> ;; option-1
> ;;(declare-function calendar-set-date-style "calendar.el")
> ;;(calendar-set-date-style 'european)

Since `calendar-set-date-style' is not autoloaded, you need to
explicitly (require 'calendar).  The `declare-function' call only
tells the byte compiler that it should not barf, but you are responsible
to ensure that the function is known at load time.

> ;; option-2
> ;; (custom-set-variables
> ;;  '(calendar-date-style 'european))

I think this will also only work if you require 'calendar.

> ;; option-3
> ;; (defvar calendar-date-style)
> ;; (setq calendar-date-style 'european)

`defvar' without an argument makes the variable only special in the
loaded buffer.  (defvar calendar-date-style 'european) should work
(though calling `calendar-set-date-style' will set even more variables).

> ;; option-4
> (eval-when-compile (require 'calendar))
> (setq calendar-date-style 'european)

requiring calendar only at compile time will not make the variable
special when your file is loaded.

Ok, finally, which option should you use?  Most of the time people
choose option-5, using `with-eval-after-load'.


Regards,

Michael.




      reply	other threads:[~2020-10-11  7:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-11  3:27 How to set calendar-date-style in init? Pankaj Jangid
2020-10-11  7:50 ` Michael Heerdegen [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

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

  git send-email \
    --in-reply-to=87k0vxjj5v.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --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.