all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to set calendar-date-style in init?
@ 2020-10-11  3:27 Pankaj Jangid
  2020-10-11  7:50 ` Michael Heerdegen
  0 siblings, 1 reply; 2+ messages in thread
From: Pankaj Jangid @ 2020-10-11  3:27 UTC (permalink / raw)
  To: Emacs Help

I have tried following options in my init file, but none of them seem to
be working. I have tried with and without /lexical-mode:t/.

I have tried following options. What am I doing wrong here?

--8<---------------cut here---------------start------------->8---
;; option-1
;;(declare-function calendar-set-date-style "calendar.el")
;;(calendar-set-date-style 'european)

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

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

;; option-4
(eval-when-compile (require 'calendar))
(setq calendar-date-style 'european)
--8<---------------cut here---------------end--------------->8---



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

* Re: How to set calendar-date-style in init?
  2020-10-11  3:27 How to set calendar-date-style in init? Pankaj Jangid
@ 2020-10-11  7:50 ` Michael Heerdegen
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Heerdegen @ 2020-10-11  7:50 UTC (permalink / raw)
  To: help-gnu-emacs

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.




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

end of thread, other threads:[~2020-10-11  7:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-11  3:27 How to set calendar-date-style in init? Pankaj Jangid
2020-10-11  7:50 ` Michael Heerdegen

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.