Skip to content

junghan0611/dotdoom-starter

Repository files navigation

DoomEmacs Starter

possiblly minimum but useful

CHANGELOG

  • 2024-09-12 Denote 까지 지원. 핵심 전략 서술.
  • 2024-10-03 org-latex-preview-auto-mode for test
  • 2024-11-16 version 0.1 - eglot

NEXT Installation

설정

.emacs.d 잡아 놓고 DOOMDIR 설정하고 쓴다.

설치중

실행

emacs 실행하면 된다.

동작 성공

~/.local/share/applications/doomemacs.desktop

[Desktop Entry]
Name=doomemacs-starter
GenericName=Text Editor
Comment=Edit text
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
# Exec=env EMACS=emacs /usr/local/bin/emacs --init-directory=~/.emacs.d %F
Exec=env DOOMDIR=/home/junghan/emacs/dotdoom-starter EMACS=emacs-stable /home/junghan/.emacs.d/bin/doom run
Icon=emacs
Type=Application
Terminal=false
Categories=Development;TextEditor;
StartupNotify=true
StartupWMClass=DoomEmacs

for termux

Reproducible information

This configuration is continuingly being improved. I build my own Emacs from source in order to take advantage of some experimental features. There are also (packages! ...) calls to external Emacs packages that are unpinned to any specific version. As such, there might be incompabilities if one blindly copies codes from this configurations. Although I’ll try to document which features are based on developing softwares and are likely to be changed in the future, it is inevitable that some bits of information are going to fall through the cracks.

In this section, I reiterate the relevant info about the version of the software I’m using here, in case someone finds this infomation useful. Here’s my current build of Emacs:

GNU Emacs 29.4.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.41, cairo version 1.18.0)
 of 2024-09-16
GNU Emacs 29.1.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.37, cairo version 1.16.0)
 of 2023-09-13
GNU Emacs 29.0.90 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0)
 of 2023-04-16
GNU Emacs 29.0.60 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0)
 of 2023-02-23

This Emacs is built with the following configuration options:

  • 29.4.5
--prefix=/usr/ --with-native-compilation --with-json --without-pop --with-gnutls --without-mailutils --with-sqlite3 --with-rsvg --with-png --with-jpeg --with-tiff --with-imagemagick --without-xim --with-xwidgets --with-x-toolkit=gtk3 --with-tree-sitter --with-cairo --with-lcms2 --with-modules '--program-transform-name=s/^ctags$/ctags.emacs/' 'CFLAGS=-O2 -pipe -mtune=native -march=native -fomit-frame-pointer'
--with-native-compilation --with-json --without-pop --with-gnutls --without-mailutils --with-sqlite3 --with-rsvg --with-png --with-jpeg --with-tiff --with-imagemagick --with-tree-sitter --with-cairo --with-lcms2 --with-modules --with-xwidgets --with-x-toolkit=gtk3 '--program-transform-name=s/^ctags$/ctags.emacs/' 'CFLAGS=-O2 -pipe -mtune=native -march=native -fomit-frame-pointer'
 of 2023-09-13
--with-native-compilation --with-json --without-pop --with-gnutls --without-mailutils --with-sqlite3 --with-rsvg --with-png --with-jpeg --with-tiff --with-imagemagick --with-tree-sitter=ifavailable --with-cairo --with-lcms2 --with-modules --with-xwidgets --with-x-toolkit=gtk3 '--program-transform-name=s/^ctags$/ctags.emacs/' 'CFLAGS=-O2 -pipe -mtune=native -march=native -fomit-frame-pointer'
--with-native-compilation --with-json --without-pop --with-gnutls --without-mailutils --with-sqlite3 --with-tree-sitter=ifavailable --with-cairo --with-lcms2 --with-modules --with-xwidgets --with-x-toolkit=gtk3 '--program-transform-name=s/^ctags$/ctags.emacs/' 'CFLAGS=-O2 -pipe -mtune=native -march=native -fomit-frame-pointer'

Install DEV packages cask

[2023-03-23 Thu 13:20]

# how to install 'cask'
git clone https://github.com/cask/cask ~/.cask
PATH=$HOME/.cask/bin:$PATH

[#A] Why dotdoom-starter

  • 이맥스 스타터로써 무엇이 좋은가? 여기에 대한 답을 남기는 것. 잠시만. 여기에 쓰지 말자.
  • 왜 둠이맥스 인가?!

가이드라인

  • 최소 버전 : #글쓰기 기본 EWS 대응
  • 최소 최대 효과를 누리는 방법을 찾아라
  • 둠이맥스 빌트인 로직으로 커버 할 수 있다. 중복 제거
  • 최소부터 단계로 나눠 본다.

Doom config file overview

Doom Emacs uses three config files:

  • init.el defines which of the existing Doom modules are loaded. A Doom module is a bundle of packages, configuration and commands, organized into a unit that can be toggled easily from this file.
  • packages.el defines which packages should be installed, beyond those that are installed and loaded as part of the enabled modules.
  • config.el contains all custom configuration and code.

There are other files that can be loaded, but theses are the main ones. The load order of different files is defined depending on the type of session being started.

All the config files are generated from this Org file, to try and make its meaning as clear as possible. All package! declarations are written to packages.el, all other LISP code is written to config.el.

Config file headers

We start by simply defining the standard headers used by the three files. These headers come from the initial files generated by doom install, and contain either some Emacs-LISP relevant indicators like lexical-binding, or instructions about the contents of the file.

init.el
;;; init.el -*- lexical-binding: t; -*-

;; DO NOT EDIT THIS FILE DIRECTLY
;; This is a file generated from a literate programing source file located at
;; https://gitlab.com/zzamboni/dot-doom/-/blob/master/doom.org
;; You should make any changes there and regenerate it from Emacs org-mode
;; using org-babel-tangle (C-c C-v t)

;; This file controls what Doom modules are enabled and what order they load
;; in. Remember to run 'doom sync' after modifying it!

;; NOTE Press 'SPC h d h' (or 'C-h d h' for non-vim users) to access Doom's
;;      documentation. There you'll find a "Module Index" link where you'll find
;;      a comprehensive list of Doom's modules and what flags they support.

;; NOTE Move your cursor over a module's name (or its flags) and press 'K' (or
;;      'C-c c k' for non-vim users) to view its documentation. This works on
;;      flags as well (those symbols that start with a plus).
;;
;;      Alternatively, press 'gd' (or 'C-c c d') on a module to browse its
;;      directory (for easy access to its source code).
packages.el
;; -*- no-byte-compile: t; -*-
;;; $DOOMDIR/packages.el

;; DO NOT EDIT THIS FILE DIRECTLY
;; This is a file generated from a literate programing source file located at
;; https://gitlab.com/zzamboni/dot-doom/-/blob/master/doom.org
;; You should make any changes there and regenerate it from Emacs org-mode
;; using org-babel-tangle (C-c C-v t)

;; To install a package with Doom you must declare them here and run 'doom sync'
;; on the command line, then restart Emacs for the changes to take effect -- or
;; use 'M-x doom/reload'.

;; To install SOME-PACKAGE from MELPA, ELPA or emacsmirror:
;;(package! some-package)

;; To install a package directly from a remote git repo, you must specify a
;; `:recipe'. You'll find documentation on what `:recipe' accepts here:
;; https://github.com/raxod502/straight.el#the-recipe-format
;;(package! another-package
;;  :recipe (:host github :repo "username/repo"))

;; If the package you are trying to install does not contain a PACKAGENAME.el
;; file, or is located in a subdirectory of the repo, you'll need to specify
;; `:files' in the `:recipe':
;;(package! this-package
;;  :recipe (:host github :repo "username/repo"
;;           :files ("some-file.el" "src/lisp/*.el")))

;; If you'd like to disable a package included with Doom, you can do so here
;; with the `:disable' property:
;;(package! builtin-package :disable t)

;; You can override the recipe of a built in package without having to specify
;; all the properties for `:recipe'. These will inherit the rest of its recipe
;; from Doom or MELPA/ELPA/Emacsmirror:
;;(package! builtin-package :recipe (:nonrecursive t))
;;(package! builtin-package-2 :recipe (:repo "myfork/package"))

;; Specify a `:branch' to install a package from a particular branch or tag.
;; This is required for some packages whose default branch isn't 'master' (which
;; our package manager can't deal with; see raxod502/straight.el#279)
;;(package! builtin-package :recipe (:branch "develop"))

;; Use `:pin' to specify a particular commit to install.
;;(package! builtin-package :pin "1a2b3c4d5e")

;; Doom's packages are pinned to a specific commit and updated from release to
;; release. The `unpin!' macro allows you to unpin single packages...
;;(unpin! pinned-package)
;; ...or multiple packages
;;(unpin! pinned-package another-pinned-package)
;; ...Or *all* packages (NOT RECOMMENDED; will likely break things)
;;(unpin! t)
config.el
;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-

;; DO NOT EDIT THIS FILE DIRECTLY
;; This is a file generated from a literate programing source file located at
;; https://gitlab.com/zzamboni/dot-doom/-/blob/master/doom.org
;; You should make any changes there and regenerate it from Emacs org-mode
;; using org-babel-tangle (C-c C-v 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.

Customized variables

Doom does not recommend the Emacs customize mechanism:

Note: do not use M-x customize or the customize API in general. Doom is designed to be configured programmatically from your config.el, which can conflict with Customize’s way of modifying variables.

All necessary settings are therefore set by hand as part of this configuration file. The only exceptions are “safe variable” and “safe theme” settings, which are automatically saved by Emacs in custom.el, but this is OK as they don’t conflict with anything else from the config.

init.el

;;; Pre-init
;; This is so that I don't accidentally start Emacs as a daemon.
(when (daemonp) (kill-emacs))

;;;; PGTK

;; You should be able to use input methods since GtkIMContext is enabled by
;; default. If you don't like GtkIMContext, you can disable it by writing as
;; follows in ~/.emacs: pgtk-use-im-context disable gtk im modules for
;; emacs-pgtk, add "Emacs*UseXIM: false" to ~/.Xresources to disable xim
(if (eq window-system 'pgtk)
    (pgtk-use-im-context nil))

(when (boundp 'pgtk-use-im-context-on-new-connection)
  (setq pgtk-use-im-context-on-new-connection nil))

;;;; Termux

(setq-default root-path "/")

(defvar IS-TERMUX
  (string-suffix-p "Android" (string-trim (shell-command-to-string "uname -a"))))

(when IS-TERMUX
  (setq root-path "/data/data/com.termux/files/"))

;;;; Modules

(doom! :input
       :completion
       (corfu +orderless +dabbrev) ; +icons
       vertico

       :ui
       doom              ; what makes DOOM look the way it does
       hl-todo           ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW/XXX/BUG
       ;; indent-guides     ; highlighted indent columns
       modeline          ; snazzy, Atom-inspired modeline, plus API
       ophints           ; highlight the region an operation acts on
       (popup +defaults) ; tame sudden yet inevitable temporary windows
       treemacs          ; a project drawer, like neotree but cooler
       vc-gutter         ; vcs diff in the fringe
       ;; vi-tilde-fringe   ; fringe tildes to mark beyond EOB
       (window-select +numbers) ; visually switch windows
       workspaces        ; tab emulation, persistence & separate workspaces
       ;; zen            ; distraction-free coding or writing

       :editor
       file-templates    ; auto-snippets for empty files
       fold              ; (nigh) universal code folding
       format            ; automated prettiness
       multiple-cursors  ; editing in many places at once
       rotate-text       ; cycle region at point between text candidates
       snippets          ; my elves. They type so I don't have to
       ;;word-wrap         ; soft wrapping with language-aware indent

       (evil +everywhere); come to the dark side, we have cookies

       :emacs
       dired             ; making dired pretty [functional]
       electric          ; smarter, keyword-based electric-indent
       eww               ; the internet is gross
       ibuffer           ; +icons - interactive buffer management
       undo              ; persistent, smarter undo for your inevitable mistakes
       vc                ; version-control and Emacs, sitting in a tree

       :term
       ;; (:unless IS-TERMUX (eshell)) ; the elisp shell that works everywhere
       (:if (not (memq system-type '(cygwin windows-nt ms-dos))) vterm) ; the best terminal emulation in Emacs

       :checkers
       (syntax +flymake)
       ;; spell +flyspell ; +hunspell - tasing you for misspelling mispelling
       ;; grammar           ; tasing grammar mistake every you make
       :tools
       biblio
       ;; (:unless IS-TERMUX (debugger)) ; FIXME stepping through code, to help you add bugs
       ;; (:unless IS-TERMUX (direnv))

       (eval +overlay)     ; run code, run (also, repls)
       lookup
       (lsp +eglot) ; +peek

       magit  ; +forge a git porcelain for Emacs

       ;; make              ; run make tasks from Emacs
       ;;pass              ; password manager for nerds
       ;; (:unless IS-TERMUX (pdf)) ; pdf enhancements
       ;; (:unless IS-TERMUX (prodigy)) ;; FIXME managing external services & code builders
       ;;terraform         ; infrastructure as code
       ;;tmux              ; an API for interacting with tmux
       ;; tree-sitter ;; syntax and parsing, sitting in a tree...
       ;; upload            ; map local to remote projects via ssh/ftp

       :os
       (:if IS-MAC macos)  ; improve compatibility with macOS
       tty                 ; improve the terminal Emacs experience

       :lang
       (clojure +lsp) ; java with a lisp
       data              ; config/data formats
       emacs-lisp        ; drown in parentheses
       json  ; At least it ain't XML
       (javascript +lsp) ;; all(hope(abandon(ye(who(enter(here))))))
       (latex +cdlatex +latexmk)    ; writing papers in Emacs has never been so fun
       markdown          ; writing docs for people to ignore
       (org                         ; organize your plain life in plain text
        +hugo                     ; use Emacs for hugo blogging
        ;; +noter                      ; enhanced PDF notetaking
        ;; +jupyter                    ; ipython/jupyter support for babel
        +pandoc                     ; export-with-pandoc support
        ;; +gnuplot                    ; who doesn't like pretty pictures
        ;; +pomodoro                 ; be fruitful with the tomato technique
        ;; +present                    ; using org-mode for presentations
        ;; +contacts
        +journal
        )                     ; wander around notes
       ;; sh                ; she sells {ba,z,fi}sh shells on the C xor
       (python +lsp) ; +conda beautiful is better than ugly
       racket ; a DSL for DSLs
       (scheme +mit) ;; +racket ; a fully conniving family of lisps
       web ; the tubes
       yaml ; JSON, but readable

       ;; :email
       ;;(mu4e +org +gmail)
       ;; (notmuch +org)

       :app
       ;; calendar
       ;; emms
       (rss +org +youtube)        ; emacs as an RSS reader

       :config
       ;; literate ; use manually
       (default +bindings +smartparens)
       )

packages.el

doom packages : disabled t

줄일 수록 강해진다.

;;; doom-disabled-packages

(package! diredfl :disable t) ; conflict @denote
(package! dirvish :disable t)
(package! paredit :disable t) ; clojure module
(package! code-review :disable t) ; not working

;; checkers
(package! flyspell-lazy :disable t)
(package! flymake-popon :disable t)
(package! flycheck :disable t)
(package! flycheck-popup-tip :disable t) ; conflict
(package! flycheck-plantuml :disable t)
(package! flycheck :disable t)
(package! lsp-mode :disable t) ; use eglot

(package! nose :disable t) ; python module
(package! lsp-python-ms :disable t)

(package! vundo :disable t)
(package! undo-fu-session :disable t)

;; app rss
(package! elfeed-goodies :disable t)

;; org
(package! org-superstar :disable t)
(package! org-fancy-priorities :disable t)

(package! solaire-mode :disable t)
;; (package! ace-window :disable t)

(package! treemacs-nerd-icons :disable t)

;; (package! corfu-popupinfo :disable t)

(package! evil-snipe :disable t)
(package! evil-goggles :disable t)
;; (package! evil-mc :disable t)

;; Disable tty module
(package! evil-terminal-cursor-changer :disable t) ; conflict on kitty
(package! kkp :disable t) ; conflict on term-keys

additional packages

;;; additional packages

;;;; ui
(unpin! doom-themes)
(package! doom-themes :recipe (:host github :repo "junghan0611/doom-themes" :branch "ko"))
(package! standard-themes)
(package! spacious-padding)
(package! keycast)
(package! outli :recipe (:host github :repo "jdtsmith/outli" :files ("*.el")))

;;;; denote

;; (package! denote)
(package! denote :pin "87001ba4887fa5955b4d779a300c3add3b4876c5")
(package! consult-notes)
(package! citar-denote)

;;;; template

(package! tempel)
(package! tempel-collection)
(package! laas)

;;;; llmclient

(package! gptel)
(package! gptel-quick :recipe (:host github :repo "karthink/gptel-quick"))

;;;; org extra

(package! org-modern)
(package! org-download)
(package! org-rainbow-tags)
(package! org-glossary :recipe (:host github :repo "tecosaur/org-glossary" :files ("*.el" "*.org" "*.texi")))
(package! ten :recipe (:host sourcehut :repo "nobiot/ten")) ;; https://git.sr.ht/~nobiot/ten
(package! org-fragtog)          ;; interactive toggling of inline latex formulas
(package! org-transclusion)

;;;; code

;; (package! aggressive-indent)
;; (package! geiser-mit :recipe (:host github :repo "emacsmirror/geiser-mit"))

;;;; tools

(package! dired-preview)
(package! jinx) ; spell checker
(package! term-keys :recipe (:host github :repo "junghan0611/term-keys"))

;;;; transient

(package! casual-suite)

DONT org-latex-preview-auto

;;; org-mode for latex-preview-auto-mode

;; (package! org :recipe
;;   (:host nil :repo "https://git.tecosaur.net/mirrors/org-mode.git" :remote "mirror" :fork
;;          (:host nil :repo "https://git.tecosaur.net/tec/org-mode.git" :branch "dev" :remote "tecosaur")
;;          :files
;;          (:defaults "etc")
;;          :build t :pre-build
;;          (with-temp-file "org-version.el"
;;            (require 'lisp-mnt)
;;            (let
;;                ((version
;;                  (with-temp-buffer
;;                    (insert-file-contents "lisp/org.el")
;;                    (lm-header "version")))
;;                 (git-version
;;                  (string-trim
;;                   (with-temp-buffer
;;                     (call-process "git" nil t nil "rev-parse" "--short" "HEAD")
;;                     (buffer-string)))))
;;              (insert
;;               (format "(defun org-release () \"The release version of Org.\" %S)\n" version)
;;               (format "(defun org-git-version () \"The truncate git commit hash of Org mode.\" %S)\n" git-version)
;;               "(provide 'org-version)\n"))))
;;   :pin nil)

;; (unpin! org)

+user-info.el

;;; $DOOMDIR/+user-info.el -*- lexical-binding: t; -*-

;; User Identify (optional)
;; e.g. GPG configuration, email clients, file templates and snippets
(setq user-full-name "junghanacs"
      user-mail-address "[email protected]")

(setq doom-font (font-spec :family "Monoplex KR Nerd" :size 14.0)
      doom-big-font (font-spec :family "Monoplex KR Nerd" :size 24.0)
      doom-variable-pitch-font (font-spec :family "Pretendard Variable" :size 16.0)
      doom-unicode-font (font-spec :family "Symbola" :size 14.0))

;; If you or Emacs can't find your font, use 'M-x describe-font' to look them
;; up, `M-x eval-region' to execute elisp code, and 'M-x doom/reload-font' to
;; refresh your font settings. If Emacs still can't find your font, it likely
;; wasn't installed correctly. Font issues are rarely Doom issues!

;; 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-homage-white)

;;;; directory path

(defconst user-org-directory (if (getenv "ORG_DIRECTORY")
                                 (getenv "ORG_DIRECTORY")
                               "~/org/"))

(defconst user-project-directory (if (getenv "PROJECT_DIRECTORY")
                                     (getenv "PROJECT_DIRECTORY")
                                   "~/git/"))

;; org-hugo-base-dir
(defconst user-hugo-blog-dir (concat user-project-directory "blog/"))

;;;; directories

(if (boundp 'user-org-directory)
    (setq org-directory user-org-directory)
  (setq org-directory "~/org/"))

(defun my/expand-org-file-name (filename)
  (expand-file-name filename org-directory))

(defconst user-inbox-file "20230202T020200--inbox-now__aprj.org")
(defun my/org-inbox-file () (my/expand-org-file-name user-inbox-file))
(defun my/org-tasks-file () (my/expand-org-file-name user-inbox-file))
(defun my/org-now-file () (my/expand-org-file-name user-inbox-file))
;; (defun my/org-now-file () (my/expand-org-file-name "20240618T125104--now.org"))
;; (defun my/org-tasks-file () (my/expand-org-file-name "20230101T010100--tasks.org"))

(defun my/org-about-file () (my/expand-org-file-name "20240326T053829--about.org"))
(defun my/org-contacts-file () (my/expand-org-file-name "20230303T030300--contacts.org"))
(defun my/org-links-file () (my/expand-org-file-name "20230219T035500--links.org"))

(defun my/org-mobile-file () (my/expand-org-file-name "agenda/20240312T111900--mobile.org")) ;; agenda

(defun my/org-diary-file () (my/expand-org-file-name "20220101T010100--diary.org"))
(defun my/org-drill-file () (my/expand-org-file-name "20240124T164402--drill.org"))
(defun my/org-quote-file () (my/expand-org-file-name "20240312T031200--quote.org"))
(defun my/org-life-file () (my/expand-org-file-name "20240327T112315--life.org"))

;; org-directory

(defun my/org-reading-file () (my/expand-org-file-name "20240329T154123--reading__lists.org"))

;; meta
(defun my/org-kdc-file () (my/expand-org-file-name "meta/20240312T142358--kdc__meta.org"))
(defun my/org-tags-file () (my/expand-org-file-name "meta/20231005T133900--tags__meta.org"))
(defun my/org-glossary-file () (my/expand-org-file-name "dict/ithink.org"))

;; blog
(defun my/org-blog-file ()
  (my/expand-org-file-name "posts/20240104T061355--blog__aprj_posts_schedule.org"))

;; talks
(defun my/org-talks-file () (my/expand-org-file-name "talks/20240827T150414--talks.org"))

(defun my/org-remark-file () (my/expand-org-file-name "20231111T094444--remark.org"))
(defun my/org-remember-file () (my/expand-org-file-name "20231020T210500--remember.org"))

;; directory
(defun my/org-calendar-directory () (my/expand-org-file-name ".calendar/"))
(defun my/org-attachment-directory () (my/expand-org-file-name ".attach/"))
(defun my/org-screenshot-directory () (my/expand-org-file-name "screenshot"))

(defvar org-user-agenda-files (list user-org-directory))
(defvar org-screenshot-path (concat user-org-directory "screenshot/"))

;; bib
(setq citar-notes-paths (list (concat user-org-directory "bib/")))
(defvar config-bibfiles (list
                         (concat user-org-directory "resources/Slipbox.bib")
                         (concat user-org-directory "resources/Book.bib")
                         (concat user-org-directory "resources/Category.bib")
                         ;; (concat user-org-directory "resources/zotero-group-junghanacs.bib")
                         ))

;; elisp-demos
(setq elisp-demos-user-files
      (list (concat org-directory "/notes/20240926T170706--elisp-demos__emacslisp_notes.org")))

(defvar org-user-contacts-files (list (my/org-contacts-file)))

(defvar +org-journal-today-file nil)

;;;; fortune

(setq user-initial-scratch-message
      (format "%s"
              (if (executable-find "fortune")
                  (string-join
                   (mapcar
                    (lambda (l) (concat "\n " (string-fill l 72)))
                    (if (string-suffix-p "Android" (string-trim (shell-command-to-string "uname -a")))
                        (string-lines (shell-command-to-string "fortune"))
                      (string-lines
                       (shell-command-to-string
                        "fortune -c 90% advice 10% .")))))
                ("\nLearn how to take a 20-minute power nap without embarrassment.\n"))
              "\n"))

config.el

load +user-info

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

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

;; Most of my per-environment config done via =customize= and is in .custom.el.
;; However, some config is more involved, such as packages I just want in one
;; environment and not the others.  To that end, let's load a file that can contain
;; those customizations.
;; (let ((per-machine-filename (concat doom-user-dir "per-machine.el")))
;;   (when (file-exists-p per-machine-filename)
;;     (load-file per-machine-filename)))

(load! "+user-info")

load per-machine

;;; Load 'Per-Machine' - User Configs

;; Most of my per-environment config done via =customize= and is in .custom.el.
;; However, some config is more involved, such as packages I just want in one
;; environment and not the others.  To that end, let's load a file that can contain
;; those customizations.
(let ((per-machine-filename (concat doom-user-dir "per-machine.el")))
  (when (file-exists-p per-machine-filename)
    (load-file per-machine-filename)))

basic configuration

general

;;; GENERAL SETTINGS

;; 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 'relative)

;; /doom/high-school-macos-emacs-dev-env/doom/init.el
(setq-default x-stretch-cursor t) ; make the cursor wide over tabs, etc.
(setq undo-limit 80000000) ; Raise undo-limit to 80Mb
(setq truncate-string-ellipsis "") ; Unicode ellispis are nicer than "...", and also save /precious/ space

startup message

;;; startup and dashboard

(setq initial-scratch-message user-initial-scratch-message)

;; When I bring up Doom's scratch buffer with SPC x, it's often to play with
;; elisp or note something down (that isn't worth an entry in my notes). I can
;; do both in `lisp-interaction-mode'.
(setq doom-scratch-initial-major-mode 'emacs-lisp-mode)

;; Set initial buffer to org
(setq initial-major-mode #'text-mode)

leader key

;;; Leader key

;; Over-ride or add to Doom Emacs default key bindings
;; https://discourse.doomemacs.org/t/what-are-leader-and-localleader-keys/153
;; 'M-m', '\,' 'SPC m' for localleader
(setq doom-localleader-key ","
      doom-localleader-alt-key "C-,")

(defun my/call-localleader ()
  (interactive)
  (setq unread-command-events (listify-key-sequence ",")))
(map! :leader (:desc "+major-mode" "m" #'my/call-localleader))
;; (global-set-key (kbd "M-m") #'my/call-localleader)

input-method with hangul

Font test: ” & ’ ∀ ∃ ∅ ∈ ∉ ∏ ∑ √ ∞ ∧ ∨ ∩ ∪ ∫ ² ³ µ · × ∴ ∼ ≅ ≈ ≠ ≡ ≤ ≥ < > ⊂ ⊃ ⊄ ⊆ ⊇ ⊥ ∂ ∇ ∈ ∝ ⊕ ⊗ ← → ↑ ↓ ↔ ⇐ ⇒ ⇔ □ ■ | © ¬ ± ° · ˜ Γ Δ α β γ δ ε φ ∀, ∃, ¬(~), ∨, ∧,⊂, ∈, ⇒, ⇔ 𝑀<1 𝑻𝑼𝑽𝗔𝗕𝗖𝗗 𝞉𝞩𝟃 ϑϕϰ ⊰⊱⊲⊳⊴⊵⫕ 𝚢𝚣𝚤𝖿𝗀𝗁𝗂

;;;; Font Test:

;; Font test: " & ' ∀ ∃ ∅ ∈ ∉ ∏ ∑ √ ∞ ∧ ∨ ∩ ∪ ∫ ² ³ µ · × ∴ ∼
;; ≅ ≈ ≠ ≡ ≤ ≥ < > ⊂ ⊃ ⊄ ⊆ ⊇ ⊥ ∂ ∇ ∈ ∝ ⊕ ⊗ ← → ↑ ↓ ↔ ⇐ ⇒ ⇔
;; □ ■ | © ¬ ± ° · ˜ Γ Δ α β γ δ ε φ ∀, ∃, ¬(~), ∨, ∧,⊂, ∈,
;; ⇒, ⇔ 𝑀<1
;; 𝑻𝑼𝑽𝗔𝗕𝗖𝗗 𝞉𝞩𝟃 ϑϕϰ ⊰⊱⊲⊳⊴⊵⫕ 𝚢𝚣𝚤𝖿𝗀𝗁𝗂

;;; Input-method +Hangul

;; +------------+------------+
;; | 일이삼사오 | 일이삼사오 |
;; +------------+------------+
;; | ABCDEFGHIJ | ABCDEFGHIJ |
;; +------------+------------+
;; | 1234567890 | 1234567890 |
;; +------------+------------+
;; | 일이삼사오 | 일이삼사오 |
;; | abcdefghij | abcdefghij |
;; +------------+------------+
(progn
  (setq default-input-method "korean-hangul")
  (set-language-environment "Korean")

  ;; (setq default-transient-input-method "TeX")

  (set-keyboard-coding-system 'utf-8)
  (setq locale-coding-system 'utf-8)
  (prefer-coding-system 'utf-8)
  (set-charset-priority 'unicode)
  (set-default-coding-systems 'utf-8)
  (set-terminal-coding-system 'utf-8)
  (setq-default buffer-file-coding-system 'utf-8-unix)

  (set-selection-coding-system 'utf-8) ;; important
  (setq coding-system-for-read 'utf-8)
  (setq coding-system-for-write 'utf-8)

  ;; Treat clipboard input as UTF-8 string first; compound text next, etc.
  (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))

  (setq-default line-spacing 3) ; use fontaine

  ;; (setenv "LANG" "en_US.UTF-8")
  ;; (setenv "LC_ALL" "en_US.UTF-8")
  ;; (setenv "LANG" "ko_KR.UTF-8")

  ;; 날짜 표시를 영어로한다. org mode에서 time stamp 날짜에 영향을 준다.
  (setq system-time-locale "C")

  (setq input-method-verbose-flag nil
        input-method-highlight-flag nil)

  (global-set-key (kbd "<S-SPC>") 'toggle-input-method)
  ;; (global-set-key (kbd "<Alt_R>") 'toggle-input-method)
  (global-set-key (kbd "<Hangul>") 'toggle-input-method)
  ;; (global-unset-key (kbd "S-SPC"))

;;;###autoload
  (defun my/set-emoji-symbol-font ()
    (interactive)

    (set-fontset-font "fontset-default" 'hangul (font-spec :family (face-attribute 'default :family)))

    (when (display-graphic-p) ; gui
      (set-fontset-font t 'unicode (font-spec :family "Symbola") nil 'prepend) ;; 2024-09-16 테스트 -- 𝑀<1
      (set-fontset-font t 'mathematical (font-spec :family "Symbola") nil 'prepend) ; best

      ;; (set-fontset-font t 'emoji (font-spec :family "Apple Color Emoji") nil 'prepend)
      (set-fontset-font t 'emoji (font-spec :family "Noto Color Emoji") nil)
      (set-fontset-font t 'emoji (font-spec :family "Noto Emoji") nil 'prepend) ; Top
      )
    (unless (display-graphic-p) ; terminal
      (set-fontset-font "fontset-default" 'emoji (font-spec :family "Noto Emoji") nil 'prepend))

    (set-fontset-font t 'symbol (font-spec :family "Symbola") nil 'prepend)
    (set-fontset-font t 'symbol (font-spec :family "Noto Sans Symbols 2") nil 'prepend)
    (set-fontset-font t 'symbol (font-spec :family "Noto Sans Symbols") nil 'prepend))

  (add-hook 'after-setting-font-hook #'my/set-emoji-symbol-font))

better default

;;; better default

;; (setq-default display-line-numbers-width-start t) ; doom's default t
(setq inhibit-compacting-font-caches t)

;; Stop asking abount following symlinks to version controlled files
(setq vc-follow-symlinks t)

(global-auto-revert-mode 1) ; doom nil
(setq auto-revert-interval 10)

;; default 120 emacs-29, 60 emacs-28
(setq kill-ring-max 30) ; keep it small

;; Disable .# lock files
(setq create-lockfiles nil)

;; Denote 23.9. Speed up backlinks’ buffer creation?
;; Prefer ripgrep, then ugrep, and fall back to regular grep.
(setq xref-search-program
      (cond ((or (executable-find "ripgrep") (executable-find "rg")) 'ripgrep)
       ((executable-find "ugrep") 'ugrep) (t 'grep)))

bookmark

;;; overide doomemacs

(setq bookmark-default-file "~/emacs-bookmarks.el")
(setq bookmark-use-annotations nil)
(setq bookmark-automatically-show-annotations t)

abbrev dabbrev

(progn
  (require 'dabbrev)
  (setq dabbrev-abbrev-char-regexp "[A-Za-z-_]") ; tshu
  (setq dabbrev-ignored-buffer-regexps
        '("\\` "
          "\\.\\(?:pdf\\|jpe?g\\|png\\)\\'"
          "\\(?:\\(?:[EG]?\\|GR\\)TAGS\\|e?tags\\|GPATH\\)\\(<[0-9]+>\\)?"))
  (setq dabbrev-abbrev-skip-leading-regexp "[$*/=~']"))

dired

;;;; dired

(after! dired
  (setq dired-make-directory-clickable t) ; Emacs 29.1, doom t
  (setq dired-free-space nil) ; Emacs 29.1, doom first

  ;; Better dired flags:
  ;; `-l' is mandatory
  ;; `-a' shows all files
  ;; `-h' uses human-readable sizes
  ;; `-F' appends file-type classifiers to file names (for better highlighting)
  ;; -g     like -l, but do not list owner
  (setq dired-listing-switches "-AGFhgv --group-directories-first --time-style=long-iso") ;; doom "-ahl -v --group-directories-first"
  (setq dired-recursive-copies 'always ; doom 'always
        dired-dwim-target t) ; doom t
  (setq dired-ls-F-marks-symlinks nil ; doom nil -F marks links with @
        delete-by-moving-to-trash t) ; doom nil

  (setq dired-use-ls-dired t)  ; doom t
  (setq dired-do-revert-buffer t) ; doom nil
  ;; (setq dired-clean-confirm-killing-deleted-buffers t) ; doom nil
  ;; (setq dired-kill-when-opening-new-dired-buffer t) ; doom nil

  (require 'wdired)
  (setq wdired-allow-to-change-permissions t) ; doom nil
  (setq wdired-create-parent-directories t)

  (add-hook 'dired-mode-hook
            (lambda ()
              (interactive)
              (setq-local truncate-lines t) ; Do not wrap lines
              ;; (visual-line-mode -1)
              (hl-line-mode 1)))
  (add-hook 'dired-mode-hook 'dired-hide-details-mode)
  (remove-hook 'dired-mode-hook 'dired-omit-mode)

  (evil-define-key 'normal dired-mode-map
    (kbd "C-c C-e") 'wdired-change-to-wdired-mode
    (kbd "C-c l") 'org-store-link
    (kbd "C-x /") 'dired-narrow-regexp
    (kbd ".") 'consult-line
    ;; (kbd "K") 'dired-kill-subdir
    (kbd "K") 'dired-do-kill-lines
    ;; (kbd "F") 'evil-avy-goto-line-below ;; 2024-01-25 useful
    (kbd "h") 'dired-up-directory
    (kbd "RET") 'dired-find-file
    (kbd "l") 'dired-find-file
    (kbd "S-<return>") 'dired-find-file-other-window
    ;; evil-force-normal-state
    (kbd "q") 'casual-dired-tmenu
    (kbd "S-SPC") 'dired-toggle-marks
    )
  )

which-key

;;;; which-key

(after! which-key
  (setq
   which-key-max-description-length 36 ; doom 27, spacemacs 36
   which-key-idle-delay 0.4
   which-key-idle-secondary-delay 0.01
  ;;  which-key-ellipsis ".."
  ;;  which-key-allow-multiple-replacements nil
  ;;  which-key-use-C-h-commands t) ; paging key maps
  ))

set-popup-rules - display-buffer-alist

;;;; popup-rule

;; from prot's dotfiles : important
(add-to-list
 'display-buffer-alist
 `("\\`\\*\\(Warnings\\|Compile-Log\\|Org Links\\)\\*\\'"
   (display-buffer-no-window)
   (allow-no-window . t)))

completion

;;; completion

;;;; corfu

;; 2024-09-13 기본 설정, jump-out-of-pair 추가
;; Tab 이 자동 완성이면 괄호 점프랑 충돌 난다. C-j/k C-n/p 는 직관적인 기본 설정이므로 건들이지 않는다.

(after! corfu
  ;; (setq corfu-auto-delay 0.5) ; doom 0.24
  (setq corfu-auto-prefix 3) ; doom 2
  (setq corfu-preselect 'valid) ; doom 'prompt
  (setq completion-cycle-threshold 3) ; doom nil
  (setq tab-always-indent t) ; for jump-out-of-pair - doom 'complete
  (setq +corfu-want-minibuffer-completion nil) ; doom t

  (setq +corfu-want-tab-prefer-expand-snippets t) ; 2024-11-06
  (setq +corfu-want-tab-prefer-navigating-snippets t)
  ;; (setq +corfu-want-tab-prefer-navigating-org-tables t)

  ;; from minemacs
  ;; HACK: Prevent the annoting completion error when no `ispell' dictionary is set, prefer `cape-dict'
  (when (eq emacs-major-version 30)
    (setq text-mode-ispell-word-completion nil))

  ;; IMO, modern editors have trained a bad habit into us all: a burning need for
  ;; completion all the time -- as we type, as we breathe, as we pray to the
  ;; ancient ones -- but how often do you *really* need that information? I say
  ;; rarely. So opt for manual completion:
  ;; doom/hlissner-dot-doom/config.el
  ;; (setq corfu-auto nil)

  ;; default 'C-S-s'
  (define-key corfu-map (kbd "M-.") '+corfu-move-to-minibuffer)
  )

editing

evil

;;; evil

(after! evil
  ;; C-h is backspace in insert state
  ;; (setq evil-want-C-h-delete t) ; default nil
  (setq evil-want-C-w-delete t) ; default t
  (setq evil-want-C-u-scroll t) ; default t

  ;; use C-i / C-o  evil-jump-backward/forward
  ;; (setq evil-want-C-i-jump t) ; default nil

  ;;  /home/junghan/sync/man/dotsamples/vanilla/mpereira-dotfiles-evil-clojure/configuration.org
  ;; FIXME: this correctly causes '*' to match on whole symbols (e.g., on a
  ;; Clojure file pressing '*' on 'foo.bar' matches the whole thing, instead of
  ;; just 'foo' or 'bar', BUT, it won't match 'foo.bar' in something like
  ;; '(foo.bar/baz)', which I don't like.
  ;; (setq-default evil-symbol-word-search t)
  ;; (setq evil-jumps-cross-buffers nil)
  (setq evil-want-Y-yank-to-eol t) ; doom t

  ;; 'Important' Prevent the cursor from moving beyond the end of line.
  ;; Don't move the block cursor when toggling insert mode
  (setq evil-move-cursor-back nil) ; nil is better - default t
  (setq evil-move-beyond-eol nil) ; default nil

  (setq +evil-want-o/O-to-continue-comments nil) ; doom t
  (setq +default-want-RET-continue-comments nil) ; doom t

  (setq evil-want-fine-undo t) ; doom 'nil

  ;; Don't put overwritten text in the kill ring
  (setq evil-kill-on-visual-paste nil) ; default t
  ;; Don't create a kill entry on every visual movement.
  ;; More details: https://emacs.stackexchange.com/a/15054:
  (fset 'evil-visual-update-x-selection 'ignore)

  ;; Prevent evil-motion-state from shadowing previous/next sexp
  (with-eval-after-load 'evil-maps
    (define-key evil-motion-state-map "L" nil)
    (define-key evil-motion-state-map "M" nil)

    (evil-global-set-key 'normal (kbd "DEL") 'evil-switch-to-windows-last-buffer) ; Backspace

    ;; Replace Emacs Tabs key bindings with Workspace key bindings
    ;; replace "." search with consul-line in Evil normal state
    ;; use default "/" evil search

    ;; disable evil macro
    (define-key evil-normal-state-map (kbd "q") 'nil) ; evil macro disable
    (define-key evil-normal-state-map (kbd "Q") 'evil-record-macro)

    ;; o :: ace-link-info 이거면 충분하다.
    (define-key evil-insert-state-map (kbd "C-]") 'forward-char) ; very useful

    ;; =C-w= 'insert 'evil-delete-backward-word
    ;; =C-w= 'visual 'evil-window-map
    ;; use evil bindings $ ^

    ;; M-d region delete and C-d char delete
    (define-key evil-insert-state-map (kbd "C-d") 'delete-forward-char)

    ;; Don't put overwritten text in the kill ring
    ;; evil-delete-char -> delete-forward-char
    (define-key evil-normal-state-map "x" 'delete-forward-char)
    (define-key evil-normal-state-map "X" 'delete-backward-char)
    )

  ;; evil-org
  (with-eval-after-load 'evil-org
    ;; (evil-define-key 'insert 'evil-org-mode-map (kbd "C-d") 'delete-forward-char)
    (evil-define-key 'normal 'evil-org-mode-map "x" 'delete-forward-char)
    ;; (evil-define-key 'insert 'evil-org-mode-map (kbd "C-k") 'org-kill-line)
    ;; (evil-define-key 'insert 'org-mode-map (kbd "C-k") 'org-kill-line)
    (evil-define-key 'normal 'evil-org-mode-map "X" 'delete-backward-char))
  )

;; ,. as Esc key binding
;; https://discourse.doomemacs.org/t/typing-jk-deletes-j-and-returns-to-normal-mode/59/7
(after! evil-escape
  (setq evil-escape-key-sequence ",.") ;; "jk"
  (setq evil-escape-unordered-key-sequence nil)
  (setq evil-escape-delay 1.0) ;; 0.5, default 0.1
  (evil-escape-mode 1))

structural editing

(after! smartparens
  ;; 2023-09-14 global 로 사용하다보니 거슬린다. 잠시만. 글로벌을 빼면 어떤가?
  ;; ("\\\\(" . "\\\\)") ;; emacs regexp parens
  ;; ("\\{"   . "\\}")   ;; latex literal braces in math mode
  ;; ("\\("   . "\\)")   ;; capture parens in regexp in various languages
  ;; ("\\\""  . "\\\"")  ;; escaped quotes in strings
  ;; ("/*"    . "*/")    ;; C-like multi-line comment
  ;; ("\""    . "\"")    ;; string double quotes
  ;; ("'"     . "'")     ;; string single quotes/character quotes
  ;; ("("     . ")")     ;; parens (yay lisp)
  ;; ("["     . "]")     ;; brackets
  ;; ("{"     . "}")     ;; braces (a.k.a. curly brackets)
  ;; ("`"     . "`")     ;; latex strings. tap twice for latex double quotes

  ;; Unbind `M-s' (set by paredit keybindings above) because it's bound
  ;; to some handy occur related functions
  ;; (define-key sp-keymap (kbd "M-s") nil)

  ;; org 모드에서 거슬린다. 제거. 굳.
  (sp-local-pair 'org-mode "(" ")" :actions '(rem)) ; for denote completion
  (sp-local-pair 'org-mode "[" "]" :actions '(rem)) ; temporarly
  (sp-local-pair 'org-mode "'" "'" :actions '(rem))
  (sp-local-pair 'org-mode "`" "`" :actions '(rem))
  (sp-local-pair 'org-mode "\"" "\"" :actions '(rem))
  (sp-local-pair 'org-mode "/" "/" :actions '(rem))
  (sp-local-pair 'org-mode "=" "=" :actions '(rem))
  (sp-local-pair 'org-mode "~" "~" :actions '(rem))

  ;; markdown 에서도 삭제
  (sp-local-pair 'markdown-mode "(" ")" :actions '(rem))
  (sp-local-pair 'markdown-mode "'" "'" :actions '(rem))
  (sp-local-pair 'markdown-mode "`" "`" :actions '(rem))
  (sp-local-pair 'markdown-mode "\"" "\"" :actions '(rem))
  (sp-local-pair 'markdown-mode "/" "/" :actions '(rem))

  ;; pair management
  (sp-with-modes
      '(minibuffer-mode)
    (sp-local-pair "'" nil :actions nil)
    (sp-local-pair "(" nil :wrap "C-("))
  (sp-with-modes 'markdown-mode (sp-local-pair "**" "***"))
  (sp-with-modes
      'web-mode
    (sp-local-pair "{{#if" "{{/if")
    (sp-local-pair "{{#unless" "{{/unless"))

  (sp-with-modes
      'org-mode
    (sp-local-pair "\\[" "\\]")
    (sp-local-pair "$$" "$$"))
  )

tempel

;;;; tempel

;; Template-based in-buffer completion (tempel.el)
;; NOTE 2023-01-19: Check the `templates'
(use-package! tempel
  :bind
  (("M-+" . tempel-complete) ;; Alternative tempel-expand
   ("M-*" . tempel-insert))
  :config
  ;; (setq tempel-trigger-prefix "<") ; conflits with evil-shift
  (setq tempel-path (expand-file-name "tempel-templates.eld" doom-user-dir))

  ;; Use concrete keys because of org mode
  ;; "M-RET" #'tempel-done
  ;; "M-{" #'tempel-previous
  ;; "M-}" #'tempel-next
  ;; "M-<up>" #'tempel-previous
  ;; "M-<down>" #'tempel-next

  ;; 2023-10-19 disable my custom
  (define-key tempel-map (kbd "RET") #'tempel-done)
  (define-key tempel-map (kbd "M-n") #'tempel-next)
  (define-key tempel-map (kbd "M-p") #'tempel-previous)

  (use-package! tempel-collection))

latex - laas

;;;; laas
;; https://github.com/tecosaur/LaTeX-auto-activating-snippets
(use-package! laas
  :hook ((LaTeX-mode . laas-mode)
	 (org-mode . laas-mode)))

org

org

;;;; org

;; (require 'ob-tangle)

(after! org
  (message "after org - config")

  ;; (load-file (concat doom-user-dir "lisp/org-funcs.el"))
  ;; (load-file (concat doom-user-dir "lisp/org-config.el"))
  ;; (+org-init-keybinds-h) -> 2024-06-01 여기 키바인딩 관련 부분 뒤에서 다시 잡아줌
  ;; (setq org-attach-use-inheritance nil) ; selective

  (progn
    (setq org-capture-bookmark nil)
    (setq org-edit-src-content-indentation 0) ; default 2

    )

  (setq org-id-locations-file
        (file-name-concat org-directory (concat "." system-name "-orgids"))) ; ".org-id-locations"))

  ;; overide here! important
  (setq org-insert-heading-respect-content nil) ; doom t
  ;; org-indent-mode 사용하면 org-hide-leading-stars 자동 on
  ;; (setq org-hide-leading-stars nil) ; doom t
  )

org2

(after! org

;;;; org-todo-keywords : whhone

  (progn
    ;; https://whhone.com/emacs-config/
    (setq org-todo-keywords '((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d)" "DONT(o)")))

    (with-no-warnings
      (custom-declare-face '+org-todo-todo  '((t (:inherit (bold error org-todo)))) "")
      (custom-declare-face '+org-todo-next  '((t (:inherit (bold warning org-todo)))) "")
      (custom-declare-face '+org-todo-done  '((t (:inherit (bold success org-todo)))) "")
      (custom-declare-face '+org-todo-dont '((t (:inherit (bold font-lock-doc-face org-todo)))) "")
      )

    (setq org-todo-keyword-faces
          '(("TODO" . +org-todo-todo) ;; red
            ("DONE" . +org-todo-done) ;; green
            ("NEXT" . +org-todo-next) ;; yellow
            ("DONT" . +org-todo-dont) ;; green
            ))

    ;; https://orgmode.org/worg/org-tutorials/org-custom-agenda-commands.html
    (setq org-agenda-custom-commands
          '(("n" "Agenda / NEXT"
             ((agenda "" nil)
              (tags "INBOX+LEVEL=2|CATEGORY=\"Inbox\"+LEVEL=1")
              (todo "NEXT" nil)
              ;; (todo "TODO" nil) ;; 2024-03-18 add
              ) nil)
            (" " "Agenda and all TODOs" ; default' view
             ((agenda "")
              (alltodo "")))))
    )

;;;; DONT custom agenda files

  ;; ;; (setq org-agenda-files org-user-agenda-files)

  (setq org-agenda-diary-file (my/org-diary-file))
  (setq org-default-notes-file (my/org-inbox-file))

  ;; doom-emacs capture files : absolute path
  (setq +org-capture-todo-file (my/org-inbox-file))
  (setq +org-capture-notes-file (my/org-inbox-file))
  (setq +org-capture-changelog-file (my/org-inbox-file))
  (setq +org-capture-projects-file (my/org-tasks-file))
  (setq +org-capture-journal-file (my/org-diary-file))

;;;; org-agenda

  ;; Use sticky agenda since I need different agenda views (personal and work) at the same time.
  (setq org-agenda-sticky t) ; default nil

  ;; Shift the agenda to show the previous 3 days and the next 7 days for
  ;; better context on your week. The past is less important than the future.
  (setq org-agenda-span 'day) ; default 'week, doom 10

  ;; Hide all scheduled todo.
  (setq org-agenda-todo-ignore-scheduled 'all)

  ;; Ignores "far" deadline TODO items from TODO list.
  (setq org-agenda-todo-ignore-deadlines 'far)

  ;; Hide all scheduled todo, from tags search view, like tags-todo.
  (setq org-agenda-tags-todo-honor-ignore-options t)

  ;; Hide all done todo in agenda
  (setq org-agenda-skip-scheduled-if-done t)

  ;; Hide task until the scheduled date.
  (setq org-agenda-skip-deadline-prewarning-if-scheduled 'pre-scheduled)

  (setq org-log-into-drawer t)

  (setq org-log-done 'time)

  ;; (setcdr (assoc 'note org-log-note-headings) "%d")
  ;; Interstitial Journaling: add note to CLOCK entry after clocking out
  ;; https://emacs.stackexchange.com/questions/37526/add-note-to-clock-entry-after-clocking-out
  (setq org-log-note-clock-out t)

  ;; 4 priorities to model Eisenhower's matrix.
  ;; - [#A] means +important +urgent
  ;; - [#B] means +important -urgent
  ;; - [#C] means -important +urgent
  ;; - [#D] means -important -urgent
  (setq org-priority-default 68
        org-priority-lowest 68)

;;;; diary-file

  (setq diary-file (concat doom-user-dir "diary"))
  (setq org-agenda-include-diary t)

;;;; org-agenda-log-mode and clock-mode

  ;; Show all agenda dates - even if they are empty
  (setq org-agenda-show-all-dates t)
  (setq org-agenda-start-with-log-mode t)

  ;; Agenda log mode items to display (closed clock : default)
  ;; 이전 이맥스는 state 가 기본이었다. 지금은 시간 기준으로 표기한다.
  ;; closed    Show entries that have been closed on that day.
  ;; clock     Show entries that have received clocked time on that day.
  ;; state     Show all logged state changes.
  ;; (setq org-agenda-log-mode-items '(closed clock state))
  (setq org-agenda-log-mode-add-notes nil)

  ;; sort 관련 기능을 확인해보고 정의한 함수들이 필요 없으면 빼면 된다.
  (setq org-agenda-sort-notime-is-late t) ; Org 9.4
  (setq org-agenda-sort-noeffort-is-high t) ; Org 9.4

  ;; Time Clocking
  (setq org-clock-idle-time 30) ; 10
  (setq org-clock-reminder-timer (run-with-timer
                                  t (* org-clock-idle-time 20) ; 60
                                  (lambda ()
                                    (unless (org-clocking-p)
                                      (when (fboundp 'alert)
                                        (alert "Do you forget to clock-in?"
                                               :title "Org Clock"))))))
  ;; (org-clock-auto-clockout-insinuate) ; auto-clockout
  ;; modeline 에 보이는 org clock 정보가 너무 길어서 줄임
  (setq org-clock-string-limit 30) ; default 0

  ;; org-clock-persist for share with machines
  (setq org-clock-persist-query-save t)
  (setq org-clock-persist-query-resume t)

  ;; current  Only the time in the current instance of the clock
  ;; today    All time clocked into this task today
  ;; repeat   All time clocked into this task since last repeat
  ;; all      All time ever recorded for this task
  ;; auto     Automatically, either all, or repeat for repeating tasks
  (setq org-clock-mode-line-entry t)
  (setq org-clock-mode-line-line-total 'auto) ; default nil

  ;; global Effort estimate values
  ;; global STYLE property values for completion
  (setq org-global-properties
        (quote
         (("Effort_ALL" . "0:15 0:30 0:45 1:00 2:00 3:00 4:00 5:00 6:00 8:00")
          ("STYLE_ALL" . "habit"))))

;;;; org-tag and category

  ;; (setq org-auto-align-tags nil) ; default t, use doom's custom
  ;; (setq org-tags-column 0) ; default -77
  (setq org-agenda-tags-column -80) ;; 'auto ; org-tags-column
  (setq org-agenda-show-inherited-tags nil)

  (setq org-tag-alist (quote (
                              (:startgroup) ;; Action
                              ("later" . ?.)
                              ("now" . ?,)
                              (:endgroup)
                              ("important" . ?i) ; 별도 처리
                              ("waiting" . ?w)
                              ("next" . ?n)
                              ("hold" . ?h)
                              ;; ("crypt" . ?E)
                              ("note" . ?o)
                              ("noexport" . ?x)
                              ("nonum" . ?u)
                              ("ATTACH" . ?a)
                              ("latest" . ?l) ;; latest version
                              )))

  (add-to-list 'org-tags-exclude-from-inheritance "projects") ; projects 왜 구분했었지?

;;;; org-agenda-custom-commands

  ;; ol-doi ol-w3m ol-bbdb ol-docview ol-gnus ol-info ol-irc ol-mhe ol-rmail
  ;; ol-eww ol-bibtex
  ;; Adapted from http://stackoverflow.com/a/12751732/584121
  ;; (require 'org-protocol)
  (setq org-protocol-default-template-key "L")
  (setq org-modules `(org-habit org-protocol))

  ;; (setq org-agenda-prefix-format
  ;;       '((agenda  . " %i %-14:c%?-12t% s")
  ;;         (todo  . " %i %-14:c")
  ;;         (tags  . " %i %-14:c")
  ;;         (search . " %i %-14:c")))

  ;; https://www.pygopar.com/creating-new-columns-in-org-agenda
  ;; Originally from here: https://stackoverflow.com/a/59001859/2178312
  (defun gopar/get-schedule-or-deadline-if-available ()
    (let ((scheduled (org-get-scheduled-time (point)))
          (deadline (org-get-deadline-time (point))))
      (if (not (or scheduled deadline))
          (format "")
        ;; (format "🗓️ ")
        "   ")))

  (setq org-agenda-prefix-format
        '((agenda . " %-4e %i %-12:c%?-12t% s ")
          (todo . " %i %-10:c %-5e %(gopar/get-schedule-or-deadline-if-available)")
          (tags . " %i %-12:c")
          (search . " %i %-12:c")))

  (when IS-TERMUX
    (setq org-agenda-prefix-format
          '((agenda  . " %i %?-12t% s")
            (todo  . " %i ")
            (tags  . " %i ")
            (search . " %i "))))

  (setq org-agenda-category-icon-alist nil)

  (setq org-agenda-hide-tags-regexp
        "agenda\\|DONT\\|LOG\\|ATTACH\\|GENERAL\\|BIRTHDAY\\|PERSONAL\\|PROFESSIONAL\\|TRAVEL\\|PEOPLE\\|HOME\\|FINANCE\\|PURCHASES")

  (add-hook 'org-agenda-finalize-hook
            (lambda ()
              ;; (setq-local line-spacing 0.2)
              (define-key org-agenda-mode-map [(double-mouse-1)] 'org-agenda-goto-mouse)))

  (defun cc/org-agenda-goto-now ()
    "Redo agenda view and move point to current time '← now'"
    (interactive)
    (org-agenda-redo)
    (org-agenda-goto-today)

    (if window-system
        (search-forward "← now ─")
      (search-forward "now -"))
    )

  (add-hook 'org-agenda-mode-hook
            (lambda ()
              (define-key org-agenda-mode-map (kbd "<f2>") 'org-save-all-org-buffers)
              (define-key org-agenda-mode-map (kbd "<backspace>") #'evil-switch-to-windows-last-buffer)
              (define-key org-agenda-mode-map (kbd "DEL") #'evil-switch-to-windows-last-buffer)
              ;; (define-key org-agenda-mode-map (kbd "M-p") 'org-pomodoro)
              ;; (define-key org-agenda-mode-map (kbd "M-P") 'ash/org-pomodoro-til-meeting)
              (define-key org-agenda-mode-map (kbd "M-.") 'cc/org-agenda-goto-now)))

  ;; (setq org-archive-location "archives/%s_archive::")
  (setq org-archive-location (file-name-concat org-directory "archives/%s::"))

  ;; nil 이면 C-c C-o 으로 접근한다.
  ;; (setq org-mouse-1-follows-link t) ; default 450

  (setq org-capture-template-dir (concat doom-user-dir "captures/"))
  (setq org-datetree-add-timestamp t)

;;;; Simple is Better

  ;; See https://orgmode.org/manual/Template-elements.html#index-org_002ddefault_002dnotes_002dfile-1
  (setq org-capture-templates nil)
  (add-to-list
   'org-capture-templates
   `("i" "Inbox" entry (file+headline ,(my/org-inbox-file) "Inbox")
     "* %?\n%i\n%a"))

  (add-to-list
   'org-capture-templates
   `("I" "Inbox (Work)" entry (file+headline ,(my/org-inbox-file) "Inbox")
     "* %? :work:\n%i\n%a"))

  (add-to-list
   'org-capture-templates
   `("p" "Project /w template" entry (file+headline ,(my/org-tasks-file) "Projects")
     (file ,(concat org-capture-template-dir "project.capture"))))

  (add-to-list
   'org-capture-templates
   `("l" "links" entry (file ,(my/org-links-file))
     "* TODO %(org-cliplink-capture)" :immediate-finish t))

  (add-to-list
   'org-capture-templates
   `("T" "Personal Todo /w clock-in" entry (file ,(my/org-inbox-file))
     "* TODO [#C] %?\n%T\n%a\n" :clock-in t :clock-resume t))
  )

org3 tips

insert-white-space

(with-eval-after-load 'org
  (require 'ox-hugo)

  ;; (setq org-hugo-base-dir (file-truename "~/git/blog/"))
  (setq org-hugo-base-dir user-hugo-blog-dir) ;; 2024-10-07 fix quartz

  (setq org-hugo-auto-set-lastmod t
        org-hugo-suppress-lastmod-period 3600.0) ; 3600.0 1h, (86400.0) 24h, (172800.0) 48h
  (setq org-hugo-front-matter-format 'yaml)

  ;; My blog is created using Hugo and ox-hugo. It generates better markdown than what you would get using org-md-export!
  ;; It works well out-of-the-box. However, extra configuration is required to embed video.
  ;; In ox-hugo, uses #+begin_video to generate the <video> HTML5 tag (details in ox-hugo/issues/274).
  ;; In Hugo config, set markup.goldmark.renderer.unsafe to true (details in discourse.gohugo.io).
  (add-to-list 'org-hugo-external-file-extensions-allowed-for-copying "webm")

  (setq org-hugo-section "notes") ; 2024-04-26 change
  (setq org-hugo-paired-shortcodes "mermaid callout cards details tabs") ; hint sidenote

  ;; https://ox-hugo.scripter.co/doc/formatting/
  ;; if org-hugo-use-code-for-kbd is non-nil
  ;; Requires CSS to render the <kbd> tag as something special.
  ;; eg: ~kbd~
  ;; (setq org-hugo-use-code-for-kbd t)

  ;; https://ox-hugo.scripter.co/doc/linking-numbered-elements/

  ;; org-export-dictionary 에 Figure, Table 에 한글 번역을 넣으면
  ;; 한글로 바뀌어 export 될 것이다.
  (setq org-hugo-link-desc-insert-type t)

  ;; 내보낼 때는 fill-column 끈다.
  (setq org-hugo-preserve-filling nil) ; important

  (setq org-hugo-allow-spaces-in-tags t) ; default t
  (setq org-hugo-prefer-hyphen-in-tags t) ; default t

  ;; Assume all static files are images for now otherwise this
  ;; defaults to /ox-hugo/mypicture.png which is ugly
  (setq org-hugo-default-static-subdirectory-for-externals "images") ; imgs
  ;; (setq org-hugo-default-static-subdirectory-for-externals "~/git/temp/notes.junghanacs.com/quartz/static/images") ; imgs

  ;; Override the default `org-hugo-export-creator-string' so that this
  ;; string is consistent in all ox-hugo tests.
  (setq org-hugo-export-creator-string "Emacs + Org-mode + ox-hugo")

  ;; In that normal example of the sidenote, ox-hugo trims the whitespace around
  ;; the sidenote block. That is configured by customizing the
  ;; org-hugo-special-block-type-properties variable:
  (progn
    (add-to-list 'org-hugo-special-block-type-properties '("mermaid" :raw t))
    (add-to-list 'org-hugo-special-block-type-properties '("callout" :raw t))
    (add-to-list 'org-hugo-special-block-type-properties '("cards" :raw t))
    (add-to-list 'org-hugo-special-block-type-properties '("details" :raw t)))
  ;; (add-to-list 'org-hugo-special-block-type-properties '("sidenote" . (:trim-pre t :trim-post t)))

  ;; If this property is set to an empty string, this heading will not be auto-inserted.
  ;; default value is 'References'
  ;; https://ox-hugo.scripter.co/doc/org-cite-citations/
  (plist-put org-hugo-citations-plist :bibliography-section-heading "References")

  (defun my/insert-white-space ()
    (interactive)
    (insert " "))

  (defun +org-export-remove-white-space (text _backend _info)
    "Remove zero width spaces from TEXT."
    (unless (org-export-derived-backend-p 'org)
      (replace-regexp-in-string " " "" text)))
  (add-to-list 'org-export-filter-final-output-functions #'+org-export-remove-white-space t)
  (evil-define-key '(insert normal) text-mode-map (kbd "M-m") #'my/insert-white-space)
  )

org extra packages

org-glossary

;;;; org-glossary

(use-package! org-glossary
  :after org
  :init
  (setq org-glossary-idle-update-period 1.0) ; 0.5
  (setq org-glossary-autodetect-in-headings t) ; 2024-06-13 new
  ;; :hook (org-mode . org-glossary-mode)
  :config
  (setq org-glossary-collection-root (concat org-directory "dict/"))
  ;; (setq org-glossary-global-terms "global")

  (define-key org-mode-map (kbd "C-}") 'org-glossary-insert-term-reference)
  (define-key org-mode-map (kbd "C-{") 'org-glossary-create-definition)
  (define-key org-mode-map (kbd "C-\"") 'org-glossary-create-definition)
  ;; (setq org-glossary-automatic nil) ;; disable auto-export
  )

org-rainbow-tags

;;;; org-rainbow-tags

(use-package! org-rainbow-tags
  :after org
  :init
  (setq org-rainbow-tags-hash-start-index 0)
  (setq org-rainbow-tags-extra-face-attributes
        '(:inverse-video t :box nil :weight 'bold))
  :hook (org-mode . org-rainbow-tags-mode)
  )

org-download

;;;; org-download

(use-package! org-download
  :after org
  :hook (;; (dired-mode . org-download-enable)
         (org-mode . org-download-enable))
  :commands (org-download-enable
             org-download-yank
             org-download-screenshot)
  :config
  (setq-default org-download-heading-lvl nil)
  (setq org-download-method 'directory) ; doom 'attach
  (setq-default org-download-image-dir (concat org-directory "screenshot" )) ;; share all devieces
  (setq org-download-display-inline-images nil)
  (setq org-download-timestamp"%Y%m%dT%H%M%S--") ;; denote id

  ;; #+caption: "
  ;; #+name: fig-"
  ;; #+attr_html: :width 40% :align center"
  ;; #+attr_latex: :width \\textwidth"
  (setq org-download-image-attr-list
        '("#+attr_html: :width 80% :align center"
          "#+attr_latex: :width \\textwidth"
          "#+attr_org: :width 800px"))

  (defun kimim/org-download-annotate (link)
    "Annotate LINK with the time of download."
    (format "#+name: fig:%s\n#+caption: %s\n"
            (file-name-base link) (file-name-base link)))
  (setq org-download-annotate-function #'kimim/org-download-annotate)
  )

org-journal

;;;; org-journal

(progn
  (require 'org-journal)
  (setq org-journal-dir (concat user-org-directory "journal"))
  (setq org-journal-date-format "%Y-%m-%d")
  (setq org-journal-file-format "%Y%m%dT000000--%Y-%m-%d__journal.org")
  ;; (setq org-journal-time-prefix "** ") ; default **
  ;; (setq org-journal-time-format "%R ")
  (setq org-journal-carryover-items  "TODO=\"TODO\"|TODO=\"NEXT\"")
  )

org-modern

(use-package! org-modern
  ;; :init
  ;; (after! org
  ;;   (require 'org-modern)
  ;;   (add-hook 'org-mode-hook #'org-modern-mode)
  ;;   (add-hook 'org-agenda-finalize-hook #'org-modern-agenda))
  :custom
  (org-modern-table nil)
  (org-modern-keyword nil)
  (org-modern-timestamp nil)
  (org-modern-priority nil)
  (org-modern-checkbox nil)
  (org-modern-tag nil)
  (org-modern-block-name nil)
  (org-modern-footnote nil)
  (org-modern-internal-target nil)
  (org-modern-radio-target nil)
  (org-modern-statistics nil)
  (org-modern-progress nil)
  )

org-fragtog

(use-package! org-fragtog
  :after org
  :hook (org-mode . org-fragtog-mode)
  :init
  (setq org-startup-with-latex-preview t) ; doom nil
  (setq org-highlight-latex-and-related '(native script entities)) ; doom org +pretty
  ;; (setq org-highlight-latex-and-related '(native)) ; doom nil
  )

org-transclusion

(use-package! org-transclusion
  :after org
  :defer 2
  :commands org-transclusion-mode
  :config
  (set-face-attribute 'org-transclusion-fringe nil :foreground "light green" :background "lime green")
  )

(after! org-transclusion
  (add-to-list 'org-transclusion-extensions 'org-transclusion-indent-mode)
  (require 'org-transclusion-indent-mode))

DONT org-latex-preview

https://abode.karthinks.com/org-latex-preview/

cd ~/.emacs.d/.local/straight
rm -Rf build-29.4.50/org repos/org
export DOOMDIR=/home/junghan/emacs/dotdoom-starter
cd ~/.emacs.d/
rm -Rf eln-cache
./bin/doom sync -u
;; (use-package! org-latex-preview
;;   :config
;;   (setq org-startup-with-latex-preview t) ; doom nil
;;   (setq org-highlight-latex-and-related '(native script entities)) ; doom org +pretty
;;   ;; (setq org-highlight-latex-and-related '(native)) ; doom nil
;;   ;; Increase preview width
;;   (plist-put org-latex-preview-appearance-options
;;              :page-width 0.8)

;;   ;; Use dvisvgm to generate previews
;;   ;; You don't need this, it's the default:
;;   (setq org-latex-preview-process-default 'dvisvgm)

;;   ;; Turn on auto-mode, it's built into Org and much faster/more featured than org-fragtog.
;;   ;; (Remember to turn off/uninstall org-fragtog.)
;;   (add-hook 'org-mode-hook 'org-latex-preview-auto-mode)

;;   ;; Block C-n and C-p from opening up previews when using auto-mode
;;   (add-hook 'org-latex-preview-auto-ignored-commands 'next-line)
;;   (add-hook 'org-latex-preview-auto-ignored-commands 'previous-line)

;;   ;; Enable consistent equation numbering
;;   (setq org-latex-preview-numbered t)

;;   ;; Bonus: Turn on live previews.  This shows you a live preview of a LaTeX
;;   ;; fragment and updates the preview in real-time as you edit it.
;;   ;; To preview only environments, set it to '(block edit-special) instead
;;   (setq org-latex-preview-live t)

;;   ;; More immediate live-previews -- the default delay is 1 second
;;   (setq org-latex-preview-live-debounce 0.25)
;;   )

pkm

biblio - citar

;;;; citar

(progn
  (require 'citar)
  (setq citar-bibliography config-bibfiles)
  (setq org-cite-global-bibliography config-bibfiles)

  ;; use #+cite_export: csl apa.csl
  (setq org-cite-csl-styles-dir (concat org-directory ".csl"))
  (setq citar-citeproc-csl-styles-dir (concat org-directory ".csl"))
  ;; (setq citar-citeproc-csl-locales-dir "~/.csl/locales")
  (setq citar-citeproc-csl-style "apa.csl") ; ieee.csl
  (setq citar-symbol-separator " ")

  ;; (require 'citar-citeproc)
  ;; (setq citar-format-reference-function 'citar-citeproc-format-reference)
  (setq citar-format-reference-function 'citar-format-reference)

  (setq citar-templates
        '((main . "[${dateadded:10}] \{${datemodified:10}\} ${author editor:20} ${translator:8} (${date year issued:4}) @${=key= id:12} ${title:68} ")  ; 2024-09-12 김정한
          (suffix . "${shorttitle:25} ${=type=:10} ${namea:16} ${url:20} ${tags keywords:*}") ; 2024-11-17 add url
          (preview . "${author} ${title} ${translator}\n- ${namea}\n- ${abstract}\n- ${shorttitle}") ; citar-copy-reference - ${year issued date:4}
          (note . "#+title: ${author translator:10}, ${title}")))

  (add-hook 'bibtex-mode-hook 'display-line-numbers-mode)
  (setq bibtex-dialect 'biblatex)
  (setq bibtex-align-at-equal-sign t)
  (setq bibtex-text-indentation 20)

  (with-eval-after-load 'savehist
    (add-to-list 'savehist-additional-variables 'citar-history))
  )

pkm denote

;;;;; denote confuguration

(use-package! denote
  :demand t
  :commands
  (denote denote-create-note denote-insert-link denote-show-backlinks-buffer denote-link-ol-store)
  :hook (dired-mode . denote-dired-mode)
  :init
  (setq denote-directory org-directory)
  (require 'denote-silo-extras)
  ;; (require 'denote-journal-extras)
  (require 'denote-org-extras)
  (setq denote-file-type 'org)
  (setq denote-sort-components '(signature title keywords identifier))
  (setq denote-backlinks-show-context t)
  (setq denote-sort-keywords t)
  (setq denote-infer-keywords t)
  (setq denote-excluded-directories-regexp "screenshot")

  (setq denote-org-front-matter
        "#+title:      %1$s
#+filetags:   %3$s
#+date:       %2$s
#+identifier: %4$s
#+export_file_name: %4$s.md
#+HUGO_CATEGORIES: noname

# #+hugo_custom_front_matter: :title \"%1$s\"

#+hugo: more

* Related-Notes
#+print_bibliography:
\n")

  ;; Automatically rename Denote buffers using the `denote-rename-buffer-format'.
  (setq denote-prompts '(subdirectory title keywords)) ; These are the minimum viable prompts for notes
  (setq denote-date-prompt-use-org-read-date t) ; And `org-read-date' is an amazing bit of tech

  ;; More functionality
  (setq denote-org-store-link-to-heading nil ; default t
        denote-rename-confirmations nil ; default '(rewrite-front-matter modify-file-name)
        denote-save-buffers t) ; default nil
  (add-hook 'org-mode-hook (lambda ()
                             ;; (setq denote-rename-buffer-backlinks-indicator " @")
                             (setq denote-rename-buffer-format "[D] %t%b")
                             (denote-rename-buffer-mode +1)))

  (use-package! consult-notes
    :defer 2
    :commands (consult-notes consult-notes-search-in-all-notes)
    :config
    (setq consult-notes-denote-display-id t)
    (setq consult-notes-denote-dir t)
    (setq consult-notes-denote-title-margin 2) ; 24
    (consult-notes-denote-mode 1)
    )

  (use-package! citar-denote
    :demand t ;; Ensure minor mode is loaded
    :bind (:map org-mode-map
           ("C-c B" . citar-insert-citation)
           :map minibuffer-local-map
           ("M-r" . vertico-repeat))
    :commands
    (citar-create-note citar-open-notes citar-denote-open citar-denote-add-citekey)
    :init
    (require 'bibtex)
    (require 'citar)
    :custom
    ;; (citar-open-always-create-notes t)
    ;; (citar-denote-signature t)
    (citar-denote-file-type 'org)
    (citar-denote-subdir t)
    (citar-denote-keyword "bib")
    (citar-denote-title-format "author-year-title") ; default title
    (citar-denote-use-bib-keywords nil)
    (citar-denote-title-format-authors 1)
    (citar-denote-title-format-andstr "and")
    :config
    (citar-denote-mode))
  )

ten

;;; Ten with etags

;; (defun my/goto-etags ()
;;   (interactive)
;;   (let ((xref-backend-functions '(etags--xref-backend t)))
;;     (call-interactively 'xref-find-definitions)))

(use-package! ten
  :defer 2
  ;; :bind (("M-c t" . complete-tag)
  ;;        ("C-c M-." . my/goto-etags))
  :init
  ;; (add-hook 'doom-after-init-hook #'ten-mode)
  ;; Enabling `ten' in text-mode and other major modes that inherit it,
  ;; such as `org-mode' and `markdown-mode'. If you wish to be more
  ;; specific, remove `text-mode' and add other more specific modes to
  ;; the list.
  (setq ten-enabled-modes '(text-mode))
  (setq ten-file-extensions '("org" "txt"))
  (setq ten-exclude-regexps '("/\\."))
  ;; I am listing two specific dictionary files in the `test/`
  ;; subdirectory as an example below. You can list the
  ;; `~/src/ten/test/' directory to let Ten to search files recursively
  ;; in the directory and subdirectories in it. There are about 5,000
  ;; terms in total and I don't experience any perfomance issue on my
  ;; old Lenovo Thinkpad laptop. Ten looks for files with an extension
  ;; listed in `ten-file-extensions' and excludes files and those in
  ;; directories that match the list of regexps `ten-exclude-regexps'.
  ;; (setq ten-files-and-directories
  ;;       '( "~/sync/emacs/git/default/ten/test/Glossary-philosophy.txt"
  ;;          "~/sync/emacs/git/default/ten/test/Glossary-of-graph-theory.txt"))
  ;; The dictionary file (only one at a time can be active through
  ;; `etags', but you can switch between more than one of them if you
  ;; need to. The switching experience is not intuitive and it's a TODO
  ;; to improve it.)
  ;; (setq ten-tags-file-default "~/sync/emacs/git/default/ten/ten-TAGS")
  )

llm

gptel

;;; llmclient
;;;; gptel

(use-package! gptel
  :config
  (setq gptel-default-mode 'org-mode)
  (setq gptel-temperature 0.3) ; gptel 1.0, Perplexity 0.2
  (set-popup-rule! "^\\*ChatGPT\\*$" :side 'right :size 84 :vslot 100 :quit t) ; size 0.4
  (set-popup-rule! "^\\*xAI\\*$" :side 'right :size 84 :vslot 100 :quit t) ; size 0.4
  (setq gptel-api-key user-openai-api-key)
  (gptel-make-openai "xAI"
    :host "api.x.ai"
    :key user-xai-api-key
    :endpoint "/v1/chat/completions"
    :stream t
    :models '(;; xAI now only offers `grok-beta` as of the time of this writing
              grok-beta))
  (gptel-make-openai "Perplexity"
    :host "api.perplexity.ai"
    :key user-perplexity-api-key
    :endpoint "/chat/completions"
    :stream t
    :models '(;; has many more, check perplexity.ai
              "llama-3.1-sonar-large-128k-chat"
              "llama-3.1-sonar-small-128k-chat"))

  (with-eval-after-load 'gptel-org
    (defun gptel-org-toggle-branching-context ()
      "Toggle gptel context between doc and subheading."
      (interactive)
      (if gptel-org-branching-context
          (progn
            (setq-local gptel-org-branching-context nil)
            (message "Context: whole doc"))
        (setq-local gptel-org-branching-context t)
        (message "Context: subheading")))
    (setf (alist-get 'org-mode gptel-prompt-prefix-alist) "@user: "
          (alist-get 'org-mode gptel-response-prefix-alist) "@assistant:\n"
          (alist-get 'markdown-mode gptel-prompt-prefix-alist) "#### ")
    (setq-default gptel-org-branching-context t))
  )

ui

doom-modeline

;;;; doom-modeline

(setq doom-modeline-time nil)
(setq doom-modeline-time-icon nil)
(setq doom-modeline-minor-modes nil)
(setq doom-modeline-support-imenu t)
(setq doom-modeline-enable-word-count nil)
;; (setq doom-modeline-continuous-word-count-modes '(markdown-mode gfm-mod)) ; org-mode

(after! doom-modeline
  (setq doom-modeline-icon (display-graphic-p))
  (setq doom-modeline-modal-icon t)
  (setq doom-modeline-major-mode-icon t)
  (setq doom-modeline-buffer-modification-icon t)

  (setq doom-modeline-height 35)
  (setq doom-modeline-bar-width 4)

  (setq doom-modeline-persp-name t) ; doom nil

  (setq doom-modeline-repl t)
  (setq doom-modeline-github t)
  (setq doom-modeline-lsp t)
  (setq doom-modeline-indent-info t)
  (setq doom-modeline-hud nil))

spacious-padding

;;;; spacious-padding

(use-package! spacious-padding
  ;; :if window-system
  :hook (server-after-make-frame . spacious-padding-mode)
  :init
  (setq spacious-padding-subtle-mode-line t)
  (setq spacious-padding-widths
        '(:internal-border-width 15 ; 15
          :header-line-width 4
          :mode-line-width 4 ; 6
          :tab-width 4
          :right-divider-width 15 ; 30
          :scroll-bar-width 8
          :fringe-width 10)) ; 8
  (add-hook 'doom-load-theme-hook #'spacious-padding-mode)
  :config
  (remove-hook 'doom-init-ui-hook #'window-divider-mode)
  ;; (pixel-scroll-precision-mode 1) ; default nil
  ;; (menu-bar-mode 1)
  (spacious-padding-mode +1)
  )

keycast

;;;; keycast on mode-line

(progn
  (after! keycast
    (define-minor-mode keycast-mode
      "Show current command and its key binding in the mode line."
      :global t
      (if keycast-mode
          (add-hook 'pre-command-hook 'keycast--update t)
        (remove-hook 'pre-command-hook 'keycast--update))))
  (add-to-list 'global-mode-string '(" " keycast-mode-line " "))

  (require 'keycast)
  ;; (setq keycast-mode-line-format "%10s%k%c%r")
  (dolist (input '(self-insert-command
                   org-self-insert-command
                   ))
    (add-to-list 'keycast-substitute-alist `(,input "." "Typing…")))

  (dolist (event '(mouse-event-p
                   mouse-movement-p
                   mwheel-scroll
                   handle-select-window
                   mouse-set-point mouse-drag-region
                   dired-next-line ; j
                   dired-previous-line ; k
                   next-line
                   previous-line
                   evil-next-line ; j
                   evil-previous-line ; k
                   evil-forward-char ; l
                   evil-backward-char ; h
                   pixel-scroll-interpolate-up ; <prior> page-up
                   pixel-scroll-interpolate-down ; <next> page-down

                   toggle-input-method
                   block-toggle-input-method
                   evil-formal-state
                   evil-force-normal-state

                   ;; 2023-10-02 Added for clojure-dev
                   lsp-ui-doc--handle-mouse-movement
                   ignore-preserving-kill-region
                   ;; pdf-view-text-region
                   ;; pdf-view-mouse-set-region
                   ;; mouse-set-region
                   ))
    (add-to-list 'keycast-substitute-alist `(,event nil)))

  (add-hook 'doom-first-input-hook (lambda ()
                                     ;; (display-time-mode +1)
                                     (doom-modeline-mode +1)
                                     (keycast-mode +1)
                                     ))
  )

outli

;;;; outli

(use-package! outli
  :defer 1
  :init (setq outli-speed-commands nil)
  :config
  ;; (add-to-list 'outli-heading-config '(tex-mode "%%" ?% t))
  (add-to-list 'outli-heading-config '(js2-mode "//" ?\/ t))
  (add-to-list 'outli-heading-config '(js-ts-mode "//" ?\/ t))
  (add-to-list 'outli-heading-config '(typescript-mode "//" ?\/ t))
  (add-to-list 'outli-heading-config '(typescript-ts-mode "//" ?\/ t))
  (add-to-list 'outli-heading-config '(python-mode "##" ?# t))
  (add-to-list 'outli-heading-config '(python-ts-mode "##" ?# t))
  (add-to-list 'outli-heading-config '(awk-mode "##" ?# t))
  (add-to-list 'outli-heading-config '(awk-ts-mode "##" ?# t))
  (add-to-list 'outli-heading-config '(elixir-mode "##" ?# t))
  (add-to-list 'outli-heading-config '(elixir-ts-mode "##" ?# t))
  (add-to-list 'outli-heading-config '(sh-mode "##" ?# t))
  (add-to-list 'outli-heading-config '(bash-ts-mode "##" ?# t))

  (add-to-list 'outli-heading-config '(clojure-mode ";;" ?\; t))
  (add-to-list 'outli-heading-config '(clojurescript-mode ";;" ?\; t))

  (add-hook 'prog-mode-hook 'outli-mode) ; not markdown-mode!
  ;; (add-hook 'org-mode-hook 'outli-mode)
  )

modus-themes - built-in

;;;; modus-themes

(setq modus-themes-bold-constructs t
      modus-themes-subtle-line-numbers t
      modus-themes-mode-line '(borderless)
      modus-themes-syntax '(green-strings yellow-comments)
      modus-themes-paren-match '(bold intense) ; underline
      modus-themes-region '(bg-only no-extend)
      modus-themes-org-blocks 'gray-background)

standard-themes

;;;; standard-themes

(use-package! standard-themes)

doom-themes

;;;; doom-themes

(setq doom-themes-enable-bold t    ; if nil, bold is universally disabled
      doom-themes-enable-italic nil) ; if nil, italics is universally disabled
(setq doom-themes-to-toggle
      (let ((hr (nth 2 (decode-time))))
        (if (or (< hr 6) (< 19 hr)) ; between 8 PM and 7 AM
            '(doom-one doom-homage-white) ; load dark theme first
          '(doom-homage-white doom-one))))
(setq doom-theme (car doom-themes-to-toggle))
(doom-themes-visual-bell-config)

(defun my/doom-themes-toggle () (interactive) (load-theme doom-theme t))
(add-hook 'doom-after-reload-hook #'my/doom-themes-toggle)

checker

flymake

;;;; flymake

(remove-hook! (prog-mode text-mode) #'flymake-mode)

jinx - spell

;;;; jinx for spell

(use-package! jinx
  :config
  (setq jinx-delay 0.5) ; default 0.2
  ;; (dolist (hook '(text-mode-hook conf-mode-hook)) ; prog-mode-hook
  ;;   (add-hook hook #'jinx-mode))

  ;; (add-hook 'org-mode-hook #'jinx-mode)
  ;; (add-hook 'prog-mode-hook #'jinx-mode) ; 주석
  (setq jinx-languages "ko")
  ;; (setq jinx-exclude-regexps
  ;;       '((t "[A-Za-z]" "[']")))
  (setq jinx-exclude-regexps
        '((emacs-lisp-mode "Package-Requires:.*$")
          (t "[A-Za-z]" "[']" "[A-Z]+\\>" "-+\\>" "\\w*?[0-9]\\w*\\>" "[a-z]+://\\S-+" "<?[-+_.~a-zA-Z][-+_.~:a-zA-Z0-9]*@[-.a-zA-Z0-9]+>?" "\\(?:Local Variables\\|End\\):\\s-*$" "jinx-\\(?:languages\\|local-words\\):\\s-+.*$")))

  ;; C-; embark-dwim
  ;; C-: 점 앞의 철자가 틀린 단어에 대한 수정을 트리거합니다.
  ;; C-u M-$전체 버퍼에 대한 수정을 트리거합니다.
  (keymap-global-set "C-:" #'jinx-correct)
  (keymap-global-set "C-M-$" #'jinx-languages)

  ;; /tecosaur-dot-doom/config.org
  (push 'org-inline-src-block
        (alist-get 'org-mode jinx-exclude-faces))
  ;; Take over the relevant bindings.
  (after! ispell
    (global-set-key [remap ispell-word] #'jinx-correct))
  )

project and workspace

projectile

;;;; projectile

(after! projectile
  ;; Disable projectile cache - saves requirement to invalidate cache when moving files
  (setq projectile-enable-caching nil)

  ;; create missing test files
  (setq projectile-create-missing-test-files t)

  ;; add clojure specific folders to be ignored by projectile
  (setq projectile-globally-ignored-directories
        (append projectile-globally-ignored-directories
                '(".clj-kondo"
                  ".cpcache"
                  "tmp" "del"
                  ".local")))

  ;; Search https://discourse.doomemacs.org/ for example configuration
  (setq projectile-ignored-projects
        (list "~/" "/tmp" (expand-file-name "straight/repos" doom-local-dir)))

  (defun projectile-ignored-project-function (filepath)
    "Return t if FILEPATH is within any of `projectile-ignored-projects'"
    (or (mapcar
         (lambda (p) (s-starts-with-p p filepath)) projectile-ignored-projects)))

  ;; Define a project path to discover projects using SPC Tab D
  ;; https://docs.projectile.mx/projectile/usage.html
  ;; (setq projectile-project-search-path '("~/projects/" "~/work/" ("~/github" . 1)))
  ;; (setq projectile-project-search-path '(("~/code" . 2) ("~/git" . 1)))

  ;; direct projectile to look for code in a specific folder.
  (setq projectile-project-search-path '("~/git"))
  )

magit

[2024-12-13 Fri 05:25]

;;;; magit

(setq magit-save-repository-buffers nil
      ;; Don't restore the wconf after quitting magit, it's jarring
      magit-inhibit-save-previous-winconf t
      evil-collection-magit-want-horizontal-movement t)

app

elfeed

;; (setq rmh-elfeed-org-files '("path/to/your/elfeed/file.org")) ; default ~/org/elfeed.org
;; gc copy-link
(after! elfeed
  ;; +rss-enable-sliced-images ;  default t
  (setq elfeed-search-filter "") ; "@6-months-ago") ;;  "@1-month-ago +unread"
  )

(after! elfeed-tube
  (require 'elfeed-tube)
  (setq elfeed-tube-captions-languages '("en" "ko" "englsh (auto generated)")))

coding

;;;; scheme with geiser-mit

(use-package! geiser-mit
  :config
  (setenv "MITSCHEME_HEAP_SIZE" "100000") ; 16384
  (setenv "MITSCHEME_LIBRARY_PATH" "/usr/lib/x86_64-linux-gnu/mit-scheme")
  (setenv "MITSCHEME_BAND" "mechanics.com")

  ;; (setenv "DISPLAY" ":0")
  (setq geiser-active-implementations '(mit))
  (setq geiser-mit-binary "/usr/bin/mit-scheme")
  )

user-functions

;;;; core fuctions

;;;###autoload
(defun my/consult-fd ()
  (interactive)
  (consult-fd "."))

;; spacemacs/layers/+completion/compleseus/funcs.el
;;;###autoload
(defun my/compleseus-search (use-initial-input initial-directory)
  (let* ((initial-input
          (if use-initial-input
              (doom-pcre-quote ;; rxt-quote-pcre
               (if (region-active-p)
                   (buffer-substring-no-properties
                    (region-beginning) (region-end))
                 (or (thing-at-point 'symbol t) ""))) ""))
         (default-directory
          (or initial-directory
              (read-directory-name "Start from directory: "))))
    (consult-ripgrep default-directory initial-input)))

;;;###autoload
(defun +default/search-cwd-symbol-at-point ()
  "Search current folder."
  (interactive)
  (my/compleseus-search t default-directory))

;;;###autoload
(defun my/org-store-link-id-optional (&optional arg)
  "Stores a link, reversing the value of `org-id-link-to-org-use-id'.
If it's globally set to create the ID property, then it wouldn't,
and if it is set to nil, then it would forcefully create the ID."
  (interactive "P")
  (let ((org-id-link-to-org-use-id (not org-id-link-to-org-use-id)))
    (org-store-link arg :interactive)))

terminal and termux

;;;; fortune

;; not work on termux
(unless IS-TERMUX
  (require 'fortune)
  (setq fortune-always-compile nil)
  (setq fortune-dir (concat root-path "usr/share/games/fortunes/advice"))
  (setq fortune-file (concat root-path "usr/share/games/fortunes/advice")))

;;;; xclip

(use-package! xclip
  :unless window-system
  :config
  (unless (display-graphic-p) ; terminal
    (cond
     ((executable-find "termux-setup-storage")
      (setq xclip-method 'termux-clipboard-get)))
    (xclip-mode 1)))

;;;; vterm for TERMUX

(when IS-TERMUX
  (after! vterm
    (setq vterm-shell (concat root-path "usr/bin/zsh")))

  (global-set-key (kbd "<M-SPC>") 'toggle-input-method)
  (global-set-key
   (kbd "M-<backtab>")
   (lambda ()
     (interactive)
     (other-window -1))))

;;;; term-keys

(use-package! term-keys
  :unless window-system
  :config
  (unless (display-graphic-p) ; terminal
    (term-keys-mode t)))

transient menu with casual suite

;;;; transient : casual-suite

(require 'casual-suite)

(require 'casual-calc)
(keymap-set calc-mode-map "<f2>" #'casual-calc-tmenu)
(keymap-set calc-mode-map "C-;" #'casual-calc-tmenu)

(keymap-set dired-mode-map "<f2>" #'casual-dired-tmenu)
(keymap-set dired-mode-map "C-;" #'casual-dired-tmenu)

(keymap-set isearch-mode-map "<f2>" #'casual-isearch-tmenu)
(keymap-set isearch-mode-map "C-;" #'casual-isearch-tmenu)

(keymap-set ibuffer-mode-map "<f2>" #'casual-ibuffer-tmenu)
(keymap-set ibuffer-mode-map "C-;" #'casual-ibuffer-tmenu)

(require 'casual-info)
(keymap-set Info-mode-map "<f2>" #'casual-info-tmenu)
(keymap-set Info-mode-map "C-;" #'casual-info-tmenu)

(require 'casual-re-builder) ;; optional
(keymap-set reb-mode-map "<f2>" #'casual-re-builder-tmenu)
(keymap-set reb-lisp-mode-map "<f2>" #'casual-re-builder-tmenu)
(keymap-set reb-mode-map "C-;" #'casual-re-builder-tmenu)
(keymap-set reb-lisp-mode-map "C-;" #'casual-re-builder-tmenu)

(require 'casual-avy)
;; 'M-a' backward-sentence -> '(' evil-backward-sentence-begin
(keymap-global-set "M-a" #'casual-avy-tmenu)

(require 'casual-bookmarks) ;; optional
(keymap-set bookmark-bmenu-mode-map "<f2>" #'casual-bookmarks-tmenu)
(keymap-set bookmark-bmenu-mode-map "C-;" #'casual-bookmarks-tmenu)
;; (evil-define-key 'normal bookmark-bmenu-mode-map (kbd "J") 'bookmark-jump)
(keymap-set bookmark-bmenu-mode-map "J" #'bookmark-jump)
(easy-menu-add-item global-map '(menu-bar) casual-bookmarks-main-menu "Tools")

(require 'casual-agenda)
(keymap-set org-agenda-mode-map "C-;" #'casual-agenda-tmenu)
;; org-agenda-clock-goto ; optional
;; bookmark-jump ; optional

(require 'casual-symbol-overlay)
(keymap-set prog-mode-map "C-'" #'casual-symbol-overlay-tmenu)
;; (keymap-set symbol-overlay-map "M-n" #'casual-symbol-overlay-tmenu)

(require 'casual-editkit) ;
(keymap-global-set "C-;" #'casual-editkit-main-tmenu)

keybindings

global-map

;;; global-unset-key

(global-unset-key (kbd "<f2>"))

(global-unset-key (kbd "M-a"))  ; unset forward-sentence -> use ')'
(global-unset-key (kbd "M-c"))  ; unset capitalize-word
(global-unset-key (kbd "M-e"))  ; unset backward-sentence -> use '('

;;; Emacs Keys

(global-set-key (kbd "C-M-;") 'pp-eval-expression) ; unbinded key
(global-set-key (kbd "C-M-'") 'eldoc-toggle) ; unbinded key

;;;; embark

(global-set-key (kbd "M-y") #'consult-yank-pop) ; yank-pop
(global-set-key (kbd "M-o") 'embark-act) ;; spacemacs bindings
(global-set-key (kbd "M-O") 'embark-dwim) ;; good alternative: M-.

(global-set-key (kbd "C-h B") 'embark-bindings) ;; alternative for `describe-bindings'

(global-set-key (kbd "C-c l") 'org-store-link)
(global-set-key (kbd "C-c L") 'my/org-store-link-id-optional)
(global-set-key (kbd "C-c i") 'org-insert-link)
(global-set-key (kbd "C-c a") 'org-agenda)

;; persp-mode and projectile in different prefixes
;; (setq! persp-keymap-prefix (kbd "C-c w"))
;; (after! projectile
;;   (define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map))

denote-map

(defvar-keymap ews-bibliography-map
  :doc "Bibliograpic functions keymap."

  "b" #'org-cite-insert
  "c" #'citar-open
  "d" #'citar-dwim
  "e" #'citar-open-entry

  "a" #'citar-denote-add-citekey
  "1" #'citar-denote-find-citation ;; grep [cite @xxx]

  "i" #'citar-insert-citation
  "n" #'citar-create-note
  "o" #'citar-open-note
  "O" #'citar-open-links

  "f" #'citar-denote-find-reference
  "l" #'citar-denote-link-reference
  ;; "e" #'citar-denote-open-reference-entry
  ;; "k" #'citar-denote-remove-citekey
  )

(defvar-keymap ews-denote-map
  :doc "Denote keybindings."
  "b" ews-bibliography-map
  "B" #'denote-org-extras-backlinks-for-heading
  "d" #'denote-create-note

  "f" #'+default/find-in-notes ; find-files
  ;;   "F" #'+default/browse-notes

  "i" #'denote-org-extras-dblock-insert-links
  "I" #'denote-org-extras-dblock-insert-backlinks

  "l" #'denote-link-or-create
  "L" #'denote-link-after-creating-with-command

  "n" #'consult-notes

  "G" #'consult-notes-search-in-all-notes

  "s" #'denote-silo-extras-open-or-create
  "S" #'denote-silo-extras-select-silo-then-command

  "t" #'denote-type

  "r" #'denote-region ; "contents" mnemonic
  ;; "R" #'denote-rename-file-using-front-matter
  "," #'denote-rename-file-using-front-matter
  "-" #'denote-show-backlinks-buffer

  "SPC" #'org-journal-open-current-journal-file

  "j" #'org-journal-new-entry
  "u" #'org-transclusion-mode

  "k" #'denote-rename-file-keywords
  "z" #'denote-rename-file-signature

  "M-f" #'denote-find-link
  "M-b" #'denote-find-backlink
  )
(keymap-set global-map "C-c n" ews-denote-map)
(keymap-set global-map "M-e" ews-denote-map) ; ews-denote-map

doom-key

;;; key

;;;; Top-menu M-x

;; 심볼 검색 현재 폴더
;; v expand-region
;; 토글 버퍼

(map! :leader
      "SPC" nil
      ;; "." nil
      ;; "," nil
      :desc "M-x" "SPC" #'execute-extended-command
      :desc "Search for symbol in cwd" "(" #'+default/search-cwd-symbol-at-point

      ;; :desc "Find file in project" "." #'projectile-find-file
      ;; :desc "Find file in cwd" "," #'my/consult-fd
      ;; :desc "consult-buffer" "`" #'consult-buffer
      ;; :desc "Eval expression" "M-;" #'pp-eval-expression
      )

;;;; 'v' er/expand-region

(map! :leader
      :desc "er/expand-region" "v" #'er/expand-region
      ;; :desc "expand-menu" "V" #'expand-transient
      )

;;;; window

;; doom-leader-map w C-S-w 'ace-swap-window

;;;; 'n' +notes denote

(map! :leader
      (:prefix ("n" . "notes")
               "g" #'+default/org-notes-search ; grep
               "d" ews-denote-map
               "SPC" #'org-journal-open-current-journal-file
               "L" #'my/org-store-link-id-optional
               "u" #'org-transclusion-mode
               ))

;;;; 'i' insert

(map! :leader
      (:prefix "i"
       :desc "time-stamp" "0" #'time-stamp
       ))

;;;; mode-map

(map! :map cdlatex-mode-map
      :i "TAB" #'cdlatex-tab)

(map! (:map org-mode-map
       "<f12>" #'org-transclusion-mode
       :ni "C-c H" #'org-insert-heading
       :ni "C-c S" #'org-insert-subheading
       :i "C-n" #'next-line
       :i "C-p" #'previous-line
       :n "C-S-p" #'outline-up-heading
       :n "C-j" #'org-forward-heading-same-level
       :n "C-k" #'org-backward-heading-same-level
       :n "C-n" #'org-next-visible-heading
       :n "C-p" #'org-previous-visible-heading
       :n "zu" #'outline-up-heading
       ))

(map! (:map org-journal-mode-map
       :n "]f"  #'org-journal-next-entry
       :n "[f"  #'org-journal-previous-entry
       :n "C-n" #'org-next-visible-heading ; overide
       :n "C-p" #'org-previous-visible-heading)
      (:map org-journal-search-mode-map
            "C-n" #'org-journal-search-next
            "C-p" #'org-journal-search-previous))

(map! (:map outline-mode-map
       :n "C-n" #'outline-next-heading
       :n "C-p" #'outline-previous-heading
       :i "C-n" #'next-line
       :i "C-p" #'previous-line
       :n "C-S-p" #'outline-up-heading
       :n "zu" #'outline-up-heading)
      )

;; BUG Reset Here! modules/config/default/+emacs-bindings.el
(map!
 (:after smartparens
  :map smartparens-mode-map

  ;; Doom's Default - /modules/config/default/+emacs-bindings.el
  "C-M-a"           #'sp-beginning-of-sexp
  "C-M-e"           #'sp-end-of-sexp
  "C-M-f"           #'sp-forward-sexp
  "C-M-b"           #'sp-backward-sexp
  "C-M-n"           #'sp-next-sexp
  "C-M-p"           #'sp-previous-sexp
  "C-M-u"           #'sp-up-sexp
  "C-M-d"           #'sp-down-sexp
  "C-M-k"           #'sp-kill-sexp
  "C-M-t"           #'sp-transpose-sexp
  "C-M-<backspace>" #'sp-splice-sexp

  "C-<right>" #'sp-forward-slurp-sexp
  "C-<left>" #'sp-forward-barf-sexp
  "M-<left>" #'sp-backward-slurp-sexp
  "M-<right>" #'sp-backward-barf-sexp

  "M-<up>"  #'sp-splice-sexp-killing-backward
  "M-<down>" #'sp-splice-sexp-killing-forward

  "C-c (" #'sp-wrap-round
  ;; "C-c [" #'sp-wrap-square ; conflict org-mode-map
  ;; "C-c {" #'sp-wrap-curly
  ))

user-key

사용자 키바인딩

;;; user-keybindings

About

literate emacs starterkit with doomemacs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published