1

I am on Doom emacs, and have placed various scripts in my config file. These are mainly new keybindings and options for packages, e.g.

(define-key org-mode-map (kbd "s-;") 'org-agenda) ;

and

(setq org-agenda-span 30)

As you can see, most of these relate to org mode, which is my primary reason for using Emacs.

When I load Emacs, only the key bindings are processed. I need to re-load the config file in order for the other customisations (mainly setq commands) to be processed.

I previously placed the setq commands in my init file, and these loaded at start up, but my entire emacs configuration went wrong, and I needed to reinstall. I presume that config is the most appropriate place for these customisations? In which case, why do I need to load the config twice in order for the setq statements to take effect?

Thanks.

Full config below:

;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-

;; Place your private configuration here! Remember, you do not need to run 'doom
;; sync' after modifying this file!


;; Some functionality uses this to identify you, e.g. GPG configuration, email
;; clients, file templates and snippets.
(setq user-full-name "John Doe"
      user-mail-address "[email protected]")

;; Doom exposes five (optional) variables for controlling fonts in Doom. Here
;; are the three important ones:
;;
;; + `doom-font'
;; + `doom-variable-pitch-font'
;; + `doom-big-font' -- used for `doom-big-font-mode'; use this for
;;   presentations or streaming.
;;
;; They all accept either a font-spec, font string ("Input Mono-12"), or xlfd
;; font string. You generally only need these two:
;; (setq doom-font (font-spec :family "monospace" :size 12 :weight 'semi-light)
;;       doom-variable-pitch-font (font-spec :family "sans" :size 13))

;; There are two ways to load a theme. Both assume the theme is installed and
;; available. You can either set `doom-theme' or manually load a theme with the
;; `load-theme' function. This is the default:
(setq doom-theme 'doom-one)

;; If you use `org' and don't want your org files in the default location below,
;; change `org-directory'. It must be set before org loads!
(setq org-directory "~/org/")

;; This determines the style of line numbers in effect. If set to `nil', line
;; numbers are disabled. For relative line numbers, set this to `relative'.
(setq display-line-numbers-type t)


;; Here are some additional functions/macros that could help you configure Doom:
;;
;; - `load!' for loading external *.el files relative to this one
;; - `use-package!' for configuring packages
;; - `after!' for running code after a package has loaded
;; - `add-load-path!' for adding directories to the `load-path', relative to
;;   this file. Emacs searches the `load-path' when you load packages with
;;   `require' or `use-package'.
;; - `map!' for binding new keys
;;
;; To get information about any of these functions/macros, move the cursor over
;; the highlighted symbol at press 'K' (non-evil users must press 'C-c c k').
;; This will open documentation for it, including demos of how they are used.
;;
;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how
;; they are implemented.





;; Org agenda window properties
(setq org-agenda-window-setup 'reorganize-frame)
(setq org-agenda-span 30)

;; Start Calendar on Monday
(setq calendar-week-start-day 1)

;; No gap before tags
(setq org-tags-column 0)
(setq org-agenda-tags-column 0)


;; Custom Key bindings
(global-set-key (kbd "s-b") 'helm-buffers-list)
(global-set-key (kbd "s-i") 'other-window)

(require 'org)

(define-key org-mode-map (kbd "s-<right>") 'org-narrow-to-subtree)
(define-key org-mode-map (kbd "s-<left>") 'widen)

(define-key org-mode-map (kbd "s-<down>") 'org-next-visible-heading)
(define-key org-mode-map (kbd "s-<up>") 'org-previous-visible-heading)
(define-key org-mode-map (kbd "M-<right>") 'org-demote-subtree)
(define-key org-mode-map (kbd "M-<left>") 'org-promote-subtree)

(define-key org-mode-map (kbd "s-;") 'org-agenda) ;; NB ":" refers to eyes!!
(define-key org-mode-map (kbd "s-0") 'org-schedule)

(define-key org-mode-map (kbd "s-9") 'org-cycle)
(define-key org-mode-map (kbd "s-8") 'org-global-cycle)
(define-key org-mode-map (kbd "s-7") 'org-reveal)


(define-key org-mode-map (kbd "s-[") 'helm-org-in-buffer-headings)
(define-key org-mode-map (kbd "s-]") 'helm-org-rifle)


;; Change weekends to different colour in Org agenda
(defun my-org-agenda-get-day-face-fn (date)
"Return the face DATE should be displayed with."
  (let ((day-of-week (calendar-day-of-week date)))
    (cond
      ((or (= day-of-week 6) (= day-of-week 0))
       '(:background "blue"))
      ((org-agenda-todayp date)
        'org-agenda-date-today)
      ((member day-of-week org-agenda-weekend-days)
        'org-agenda-date-weekend)
      (t 'org-agenda-date))))

(setq org-agenda-day-face-function 'my-org-agenda-get-day-face-fn)


;; Org journal options
(setq org-journal-enable-agenda-integration t)
(setq org-journal-file-type "daily")

2
  • probably some of your variables are being overriden by the defaults as you set'em before loading org-mode.
    – Muihlinn
    Commented Feb 7, 2021 at 11:26
  • Thanks, Muihlinn. I've found that if I reload doom (M-x reload...) it sorts this problem pretty quickly. So not a major issue. Commented Feb 10, 2021 at 5:41

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.