Emacs 30.1<2025-08-15 Fri>

early-init.el

pleasant startup with speed

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

;;   Basic settings for quick startup and convenience

;; Startup speed, annoyance suppression
(setq gc-cons-threshold 100000000) ; 100 mb
(setq read-process-output-max (* 1024 1024)) ; 1mb
(setq byte-compile-warnings '(not obsolete))
(setq warning-suppress-log-types '((comp) (bytecomp)))
(setq native-comp-async-report-warnings-errors 'silent)

  ;; no startup message
(setq inhibit-startup-echo-area-message (user-login-name))

  ;; Disable startup-screen
(setq inhibit-startup-screen -1)
(setq inhibit-splash-screen -1)

UI

  ;; Default frame configuration: full screen, good-looking title bar on macOS
  (setq frame-resize-pixelwise t)
  (tool-bar-mode -1)                      ; All these tools are in the menu-bar anyway
  (setq default-frame-alist '((fullscreen . maximized)

      ;; You can turn off scroll bars by uncommenting these lines:
      ;; (vertical-scroll-bars . nil)
      ;; (horizontal-scroll-bars . nil)

      ;; Setting the face in here prevents flashes of
      ;; color as the theme gets activated
      (background-color . "#000000")
      (foreground-color . "#ffffff")
      (ns-appearance . dark)
      (ns-transparent-titlebar . t)))


  ;; Disable menu bar and scroll bar
  (menu-bar-mode -1)
  (scroll-bar-mode -1)


  ;; Increase font size
  (set-face-attribute 'default nil :height 300)

  ;; Display time
  (display-time-mode t)
  ;; Auto-refresh buffers when files on disk change.
  (global-auto-revert-mode t)

  ;; Initial-major-mode
;  (initial-major-mode 'fundamental-mode)

(setq initial-scratch-message nil)

uniquify

;; Ensure unique names when matching files exist in the buffer.
;; e.g. This helps when you have multiple copies of "main.rs"
;; open in different projects. It will add a "myproj/main.rs"
;; prefix when it detects matching names.
(require 'uniquify)
(setq uniquify-buffer-name-style 'forward)

backup-files

;; Place backups in a separate folder.
(setq backup-directory-alist '(("." . "~/.backup"))
  backup-by-copying t    ; Don't delink hardlinks
  version-control t      ; Use version numbers on backups
  delete-old-versions t  ; Automatically delete excess backups
  kept-new-versions 2    ; how many of the newest versions to keep
  kept-old-versions 2    ; and how many of the old
  )
(setq auto-save-file-name-transforms `((".*" "~/.saves/" t)))

auto-save

; From http://www.emacswiki.org/emacs/AutoSave
   (defun save-buffer-if-visiting-file (&optional args)
      "Save the current buffer only if it is visiting a file"
      (interactive)
      (if (and (buffer-file-name) (buffer-modified-p))
          (save-buffer args)))

   (add-hook 'auto-save-hook 'save-buffer-if-visiting-file)

; additional parameters
(setq auto-save-interval 300
          auto-save-timeout 60)

emacs server

(server-start) permits the use of emacsclient, emacsclientw, and org-protocol. I used to start a server as part of my config. Now I'm switching to using emacs --daemon, which starts a server automatically. Anyway, with --daemon, Emacs doesn't start off in a graphical environment, so the frames that emacsclient -c creates don't get the theme applied. This fixes that:

(add-hook 'after-make-frame-functions
          (lambda (frame)
            (select-frame frame)
            ;(solarized-dark)
            ))

scroll-step

(setq scroll-step           1
         scroll-conservatively 10000)

disable bell in end

;; Disable bell sound.
(setq ring-bell-function 'ignore)

;;; early-init.el ends here

init.el

packages

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

  ;;;;;;;;;;;;;;;;; Packages ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;; You'll be installing your packages with the
  ;; built-in package.el script
  (require 'package)

  ;; Add MELPA to your list of package archives
  (add-to-list 'package-archives
                 '("melpa" . "https://melpa.org/packages/"))

  (package-initialize)

  ;; Go ahead and refresh your package list to
  ;; make sure everything is up-to-date
  (unless package-archive-contents
    (package-refresh-contents))

  ; First package to install is use-package ------------------------
  (unless (package-installed-p 'use-package)
    (package-install 'use-package))


completion

(use-package vertico
  :ensure t
  :init
  (vertico-mode))

(use-package marginalia
  :after vertico
  :ensure t
  :init
  (marginalia-mode))

savehist

(use-package savehist
  :init
  (savehist-mode))

theme

solarized-theme
  (use-package solarized-theme
  :ensure t
  :config
  (load-theme 'solarized-dark t))

;(load-theme 'deeper-blue t)

custom-set-variables

;;; -*- lexical-binding: t -*-
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.

  '(cursor-in-non-selected-windows nil)
  '(window-divider-default-places 'right-only)
  '(window-divider-default-right-width 16)
  '(x-underline-at-descent-line t))

custom-set-faces

(custom-set-faces
 '(default ((t (:family "Cousine" :foundry "unknown" :slant normal :weight normal :height 250 :width normal)))))

basic

ask-for-y-n-instead-of-yes-no
(fset 'yes-or-no-p 'y-or-n-p)
disabled-commands
(put 'upcase-region 'disabled nil); C-x C-l
(put 'downcase-region 'disabled nil);   C-x C-u
cursor
; http://emacs-fu.blogspot.in/2009/12/changing-cursor-color-and-shape.html
;; change cursor color according to mode; inspired by
;; http://www.emacswiki.org/emacs/changingcursordynamically
(setq my-read-only-color       "grey")
;; valid values are t, nil, box, hollow, bar, (bar . width), hbar,
;; (hbar. height); see the docs for set-cursor-type
(setq my-read-only-cursor-type 'hbar)
(setq my-overwrite-color       "red")
(setq my-overwrite-cursor-type 'box)
(setq my-normal-color          "white")
(setq my-normal-cursor-type    'hbar)
(defun my-set-cursor-according-to-mode ()
  "change cursor color and type according to some minor modes."
  (cond
   (buffer-read-only
    (set-cursor-color my-read-only-color)
    (setq cursor-type my-read-only-cursor-type))
   (overwrite-mode
    (set-cursor-color my-overwrite-color)
    (setq cursor-type my-overwrite-cursor-type))
   (t
    (set-cursor-color my-normal-color)
    (setq cursor-type my-normal-cursor-type))))
(add-hook 'post-command-hook 'my-set-cursor-according-to-mode)
; you can change the colors and cursor types by modifying the various variables.
;(blink-cursor-mode)                    ; toggle disables blinking
overwrite text selection
;; make typing overwrite text selection
(delete-selection-mode 1)
utf-8
(prefer-coding-system 'utf-8)
(setenv "LANG" "en_US.UTF-8")
wrap
(setq fill-column nil)
;(auto-fill-mode)
;(longlines-mode)
global-hl-line-mode
(global-hl-line-mode)
smooth scroll
(setq scroll-step           1
         scroll-conservatively 10000)
column-number-mode
(column-number-mode)

spell checking

(use-package flyspell
:delight
:config
(add-hook 'text-mode-hook #'flyspell-mode)
(add-hook 'prog-mode-hook #'flyspell-prog-mode))

key bindings

Prefix|"Name Space NS"|map initializations
  • Abstract
    • f1
      1. "Key-foo f1" gives all bindings with Key-foo as prefix.
      2. Hence never assign "key f1". Except "C-S-".
    • Not definable
      1. C-S-f4 is not definable! Converts mouse pointer into a cross.
    • Not usable in sequence
      1. f2: being C-x
      2. f3: being C-c
    • My name spaces
      1. "Double Click" Name Spaces (or Prefix) such as F5F5, F6F6, F7F7 etc and others F5F4, F4F3 etc. are on top in listing.
  • Table

    Initial = initial function of the key Relocation = final key of initial function

    "C-c TAB" (org-table-toggle-column-width): Shrink or expand current column.

    Key Initial Relocation Final NS
    CL Capslock   f13
    f2 <f2> 2: 2C-two-columns, <f2> b: 2C-associate-buffer, <f2> s: 2C-split, <f2> <f2>: 2C-two-columns   C-x
    f3 (kmacro-start-macro-or-insert-counter ARG)   C-c
    f4 (kmacro-end-or-call-macro ARG &optional NO-REPEAT)   my web
    f5      
    f6     org-mode
    f7     programming
    f8     speedbar
    f9      
    f10 menu-bar-open f10 f10  
    f11 toggle-frame-fullscreen &optional FRAME f11 f11  
    f12      
  • def
    • CL = Capslock => f13
      ; Bind Caps-Lock to M-x ;; http://sachachua.com/wp/2008/08/04/emacs-caps-lock-as-m-x/
      ; of course, this disables normal Caps-Lock for *all* apps
      (if (eq window-system 'x)
          (shell-command "xmodmap -e 'clear Lock' -e 'keycode 66 = F13'"))
      
      ;(global-set-key [f13] 'org-ctrl-c-ctrl-c)
      
      (define-prefix-command 'mylocal-f13-bindings-keymap)
      (global-set-key [(f13)] 'mylocal-f13-bindings-keymap)
      
      (define-prefix-command 'mylocal-f13f13-bindings-keymap)
      (global-set-key [(f13)(f13)] 'mylocal-f13f13-bindings-keymap)
      
    • f2 => C-x
      (define-key global-map (kbd "<f2>") ctl-x-map)
      
    • f3 => C-c
      (define-key key-translation-map (kbd "<f3>") (kbd "C-c"))
      
    • f4
      (define-prefix-command 'mylocal-f4-bindings-keymap)
      (global-set-key [(f4)] 'mylocal-f4-bindings-keymap)
      
      (define-prefix-command 'mylocal-f4f4-bindings-keymap)
      (global-set-key [(f4)(f4)] 'mylocal-f4f4-bindings-keymap)
      
      (define-prefix-command 'mylocal-f4e-bindings-keymap)
      (global-set-key [(f4) e] 'mylocal-f4e-bindings-keymap)
      
    • C-s
      (define-prefix-command 'mylocal-C-s-bindings-keymap)
      (global-set-key [(C-s)] 'mylocal-C-s-bindings-keymap)
      
    • f5
      (define-prefix-command 'mylocal-f5-bindings-keymap)
      (global-set-key [(f5)] 'mylocal-f5-bindings-keymap)
      
      (define-prefix-command 'mylocal-f5f5-bindings-keymap)
      (global-set-key [(f5)(f5)] 'mylocal-f5f5-bindings-keymap)
      
    • f6 org-mode
      (define-prefix-command 'mylocal-f6-bindings-keymap)
      (global-set-key [(f6)] 'mylocal-f6-bindings-keymap)
      
      ; org: copy, paste, kill
      (define-prefix-command 'mylocal-f6f6-bindings-keymap)
      (global-set-key [(f6)(f6)] 'mylocal-f6f6-bindings-keymap)
      
      ; org: table
      (define-prefix-command 'mylocal-f6f5-bindings-keymap)
      (global-set-key [(f6)(f5)] 'mylocal-f6f5-bindings-keymap)
      
      ; org: agenda
      (define-prefix-command 'mylocal-f66-bindings-keymap)
      (global-set-key [(f6) 6] 'mylocal-f66-bindings-keymap)
      
      ; org: export
      (define-prefix-command 'mylocal-f67-bindings-keymap)
      (global-set-key [(f6) 7] 'mylocal-f67-bindings-keymap)
      
      ; org: babel
      (define-prefix-command 'mylocal-f6f7-bindings-keymap)
      (global-set-key [(f6)(f7)] 'mylocal-f6f7-bindings-keymap)
      
    • f7 programming
      (define-prefix-command 'mylocal-f7-bindings-keymap)
      (global-set-key [(f7)] 'mylocal-f7-bindings-keymap)
      
      (define-prefix-command 'mylocal-f7f7-bindings-keymap)
      (global-set-key [(f7)(f7)] 'mylocal-f7f7-bindings-keymap)
      
      (define-prefix-command 'mylocal-f7f7c-bindings-keymap)
      (global-set-key [(f7)(f7)(c)] 'mylocal-f7f7c-bindings-keymap)
      
    • f8 speedbar
      (define-prefix-command 'mylocal-f8-bindings-keymap)
      (global-set-key [(f8)] 'mylocal-f8-bindings-keymap)
      
      (define-prefix-command 'mylocal-f8f8-bindings-keymap)
      (global-set-key [(f8)(f8)] 'mylocal-f8f8-bindings-keymap)
      
    • f10
      (define-prefix-command 'mylocal-f10-bindings-keymap)
      (global-set-key [(f10)] 'mylocal-f10-bindings-keymap)
      
    • f11
      (define-prefix-command 'mylocal-f11-bindings-keymap)
      (global-set-key [(f11)] 'mylocal-f11-bindings-keymap)
      
    • f12
      (define-prefix-command 'mylocal-f12-bindings-keymap)
      (global-set-key [(f12)] 'mylocal-f12-bindings-keymap)
      
Sequences (not chords): M, C, s, CL=Capslock(f13), f5-8
  • M-s: org
    • M-s-return: insert "Abstract" outline below
      (defun zM-s-return ()
        (interactive)
        (org-end-of-line)
        (org-return)
        (insert "Abstract")
        (org-beginning-of-line)
        (org-meta-return)
        (org-metaright))
      
      (global-set-key (kbd "M-s-<return>") 'zM-s-return)
      
  • C
    • C-
      • navigate to top/end of buffer
        (global-set-key [\C-home] 'beginning-of-buffer)
        (global-set-key [\C-end] 'end-of-buffer)
        
      • font size increase/decrease:
        (global-set-key (kbd "C-=") 'text-scale-increase)
        (global-set-key (kbd "C--") 'text-scale-decrease)
        
    • C-S: general
      • C-S-escape: undo
        (global-set-key (kbd "C-S-<escape>") 'undo)
        
      • C-~: 'unbury-buffer
        (global-set-key (kbd "C-~") 'unbury-buffer)
        
      • C-S-Tab: bury-buffers
        (global-set-key (kbd "<C-S-iso-lefttab>") 'bury-buffer)
        
      • C-!: delete-window
        (global-set-key (kbd "C-!") 'delete-window)
        
      • C-S-f1: delete-other-windows
        (global-set-key (kbd "C-S-<f1>") 'delete-other-windows)
        
      • C-S-f2: ibuffer menu
        (global-set-key (kbd "C-S-<f2>") 'ibuffer)
        
      • C-S-f3: bookmark+: list/edit
        (global-set-key (kbd "C-S-<f3>") 'bookmark-bmenu-list)
        
      • C-$: cycle-my-theme
        (global-set-key (kbd "C-$") 'zcycle-my-theme)
        
      • C-(: kmacro-start-macro
        (global-set-key (kbd "C-(") 'kmacro-start-macro)
        ; This was F3 by default in Emacs. Now F3 is used for C-c by me.
        
      • C-): kmacro-end-macro
        (global-set-key (kbd "C-)") 'kmacro-end-macro)
        
      • C-*: kmacro-end-and-call-macro
        (global-set-key (kbd "C-*") 'kmacro-end-and-call-macro)
        
      • C-|: org-table-create-or-convert-from-region
        (global-set-key (kbd "C-|") 'org-table-create-or-convert-from-region)
        
    • C-s: org
      • C-s-up: org-narrow-to-subtree
        (global-set-key (kbd "C-s-<up>") 'org-narrow-to-subtree)
        
      • C-s-down: org-widen
        (global-set-key (kbd "C-s-<down>") 'widen)
        
      • C-s-right: org-cycle
        (global-set-key (kbd "C-s-<right>") 'toggle-truncate-lines)
        
      • C-s-left: org-shifttab
        (global-set-key (kbd "C-s-<left>") 'toggle-truncate-lines)
        
  • CL=Capslock(f13): NOT ALL RUNNING WELL!
    • CL-<left=p|down=f|up=u|right=n>:
      (global-set-key (kbd "<f13> <down>") 'query-replace)
      (global-set-key (kbd "<f13> <up>") (kbd "C-g")); 'keyboard-quit
      
      
      (global-set-key (kbd "<f13> <right>") 'isearch-forward)
      (global-set-key (kbd "<f13> <left>") 'isearch-backward)
      
      (defun zlocal-isearch-hook ()
        "Hook for `isearch-mode-hook' "
        (define-key isearch-mode-map (kbd "<f13> <left>") 'isearch-repeat-backward)
        (define-key isearch-mode-map (kbd "<f13> <right>") 'isearch-repeat-forward))
      
      (add-hook 'isearch-mode-hook 'zlocal-isearch-hook)
      
      
      (defun zlocal-km () ;(lambda (&optional arg)
                             "Keyboard macro."
        ((interactive "p") (kmacro-exec-ring-item (quote ([home S-end 134217765 124 return 17 10 return 33 s-left] 0 "%d")))))
      
      (global-set-key (kbd "<f13> m 1") 'zlocal-km)
      
  • s: super
    • s-s: save-buffer
      (global-set-key (kbd "s-s") 'save-buffer)
      
    • wrap without splitting words
      (global-set-key (kbd "s-v") 'visual-line-mode)
      
    • org
      • s-<left=p|down=f|up=u|right=n>: org tree navigations
        (global-set-key (kbd "<s-left>") 'outline-previous-visible-heading)
        (global-set-key (kbd "<s-up>") 'outline-up-heading)
        (global-set-key (kbd "<s-down>") 'org-forward-heading-same-level)
        (global-set-key (kbd "<s-right>") 'outline-next-visible-heading)
        
        
      • s-return: from beginning, insert outline below
        (defun zs-return ()
        "Insert outline below, from beginning, from any where in the current outline."
        (interactive)
        (org-beginning-of-line)
        (org-meta-return))
        
        (global-set-key (kbd "s-<return>") 'zs-return)
        
        
  • f4: web
    • name spaces
      • F4 e: eww
        • f4 e e: eww URL
          (global-set-key (kbd "<f4> e e") 'eww)
          
        • f4 e f: eww file
          (global-set-key (kbd "<f4> e f") 'eww-open-file)
          
  • f5: general
    • name spaces
      • F5 F4: ansi-term, (e)shell
        • f5 f4 f4: split-window-below and shell
          (defun zf5f4f4 ()
            "split-window-below and shell"
            (interactive)
            (split-window-below) (other-window 1) (shell))
          
          
          (global-set-key (kbd "<f5> <f4> <f4>") 'zf5f4f4)
          
          
        • f5 f4 3: split-window-below and ansi-term
          (defun zf5f43 ()
            "split-window-below and ansi-term"
            (interactive)
            (split-window-below)
            (other-window 1)
            (ansi-term "/bin/sh"))
          
          
          (global-set-key (kbd "<f5> <f4> 3") 'zf5f43)
          
          
        • f5 f4 4: split-window-below and eshell
          (defun zf5f44 ()
            "split-window-below and eshell"
            (interactive)
            (split-window-below) (other-window 1) (eshell))
          
          
          (global-set-key (kbd "<f5> <f4> 4") 'zf5f44)
          
          
      • F5 F5: Copy, Kill general, menu-bar, ispell, query-replace, customize-group, linum
        • f5 f5 del: kill-line = C-k
          (global-set-key (kbd "<f5> <f5> <delete>") 'kill-line)
          
        • f5 f5 f4: Backwards kill text from-point-to-beginning-of-line

          Idea from http://www.macroexpand.com/~bm3719/_emacs.html

          (defun zptbolc ()
            (interactive)
            (kill-line 0))
          
          (global-set-key (kbd "<f5> <f5> <f4>") 'zptbolc)
          
        • f5 f5 f5: copy region = kill-ring-save = M-w
          (global-set-key (kbd "<f5> <f5> <f5>") 'kill-ring-save)
          
        • f5 f5 f6: paste = 'yank = C-y
          (global-set-key (kbd "<f5> <f5> <f6>") 'yank)
          
        • f5 f5 f8: kill-region = cut
          (global-set-key (kbd "<f5> <f5> <f8>") 'kill-region)
          
        • f5 f5 f10: menu-bar-mode
          (global-set-key (kbd "<f5> <f5> <f10>") 'menu-bar-mode)
          
        • f5 f5 4: ispell-word
          (global-set-key (kbd "<f5> <f5> 4") 'ispell-word)
          
        • f5 f5 5: query-replace
          (global-set-key (kbd "<f5> <f5> 5") 'query-replace)
          
        • f5 f5 c: customize-group
          (global-set-key (kbd "<f5> <f5> c") 'customize-group)
          
        • f5 f5 l: linum-mode
          (global-set-key (kbd "<f5> <f5> l") 'linum-mode)
          
    • direct
      • f5 6: sort-lines
        (global-set-key (kbd "<f5> 6") 'sort-lines)
        
      • f5 up|down: other-window
        (global-set-key (kbd "<f5> <up>") 'other-window)
        (global-set-key (kbd "<f5> <down>") 'other-window)
        
      • f5 left|right: winner-undo|redo
        (global-set-key (kbd "<f5> <left>") 'winner-undo)
        (global-set-key (kbd "<f5> <right>") 'winner-redo)
        
      • f5 a: auto-fill-mode
        (global-set-key (kbd "<f5> a") 'auto-fill-mode)
        
      • f5 c: calendar
        (global-set-key (kbd "<f5> c") 'calendar)
        
      • f5 d: insert date-time
        ; Insert a UTC datetime string in ISO 8601 format.
        (defun zdt ()
          "Insert an ISO 8601 formatted datetime string, with time in UTC."
          (interactive)
          (insert (format-time-string "%Y-%m-%d %H:%M:%S" nil 1)))
        
        (global-set-key (kbd "<f5> d") 'zdt)
        
      • f5 e: restart-emacs
        ;  (defun reload-dotemacs-file ()
        ;    (interactive) (load-file "~/.emacs"))
        
        ; This works OK, but is longer!; (define-key mylocal-f5 bindings-keymap (vector ?d) 'reload-dotemacs-file)
        ;(global-set-key (kbd "<f5> e") 'reload-dotemacs-file)
        
        (global-set-key (kbd "<f5> e") 'restart-emacs)
        
      • f5 g: goto-line
        (global-set-key (kbd "<f5> g") 'goto-line) ;from http://www.sci.utah.edu/~cscheid/software/cscheid.emacs
        
      • f5 l: linum-mode
        (global-set-key (kbd "<f5> l") 'linum-mode)
        
      • f5 p: package-list-packages
        (defun zf5p ()
          (interactive)
          (copy-file "~/.emacs" "~/.emacs.o" 1)
          (package-list-packages))
        
        (global-set-key (kbd "<f5> p") 'zf5p)
        
      • f5 u: customize
        (global-set-key (kbd "<f5> u") 'customize)
        
  • f6: org
    • F6 F5: Table
    • F6 F6: Copy, Kill Org
      • f6 f6 del: org-kill-line-from-beginning
        (defun zoklfb ()
          "org-kill-line-from-beginning"
          (interactive)
          (org-beginning-of-line)
          (org-kill-line))
        
        (global-set-key (kbd "<f6> <f6> <delete>") 'zoklfb)
        
      • f6 f6 f5: org-copy-special
        (global-set-key (kbd "<f6> <f6> <f5>") 'org-copy-special)
        
      • f6 f6 f6: org-yank = paste
        (global-set-key (kbd "<f6> <f6> <f6>") 'org-mode)
        
      • f6 f6 f7: org-copy-visible

        (global-set-key (kbd "<f6> <f6> <f7>") 'org-copy-visible)

      • f6 f6 o: Convert region from markdown to org
        (defun my-md-to-org-region (start end)
        "Convert region from markdown to org."
        (interactive "r")
        (let ((output (shell-command-on-region start end "pandoc -f markdown -t org" t t)))
          (if (not output)
              (message "Conversion failed. Please check if Pandoc is installed and accessible.")
            (message "Conversion successful."))))
        
        (global-set-key (kbd "<f6> <f6> o") 'my-md-to-org-region)
        
      • f6 f6 m: Convert region from org to markdown
        (defun my-org-to-md-region (start end)
          "Convert region from org to markdown."
          (interactive "r")
          (let ((output (shell-command-on-region start end "pandoc -f org -t markdown" t t)))
            (if (not output)
                (message "Conversion failed. Please check if Pandoc is installed and accessible.")
              (message "Conversion successful."))))
        
          (global-set-key (kbd "<f6> <f6> m") 'my-org-to-md-region)
        
    • F6 F7: Babel
      • f6 f7 t: org-babel-tangle
        (global-set-key (kbd "<f6> <f7> t") 'org-babel-tangle)
        
    • F6 6: Agenda
    • F6 7: Export
    • direct
      • f6 d: visit dotemacs org lp
        (defun zvfd ()
        (interactive)
        (find-file "~/prog/zzmy/emacs/dotemacs/lp/dotemacs.org") )
        
        (global-set-key (kbd "<f6> d") 'zvfd)
        
      • f6 i: org-indent-mode
        (global-set-key (kbd "<f6> i") 'org-indent-mode)
        
  • f7: programming
    • name spaces
      • F7 F7 Name Space: comment-region|Snippets|kmacro
        • F7 F7 c Name Space: comment-region
          • f7 f7 c 3: comment region with "#"
            (global-set-key (kbd "<f7> <f7> c 3") 'comment-region)
            
        • f7 f7 f7: eval-last-sexp
          (global-set-key (kbd "<f7> <f7> <f7>") 'eval-last-sexp)
          
        • t f7 f7 e: emacs lisp
          ;  (defun zf7f7e ()
          ;    (interactive)
          ;    (newline-and-indent)
          
          ;    (insert
          ;      "#+BEGIN_SRC emacs-lisp
          ;      (defun zf7f7e ()
          ;        (interactive))
          
          ;      (global-set-key (kbd "<f7> <f7> e") 'zf7f7e
          ; ##+END_SRC")
          
          ;    (global-set-key (kbd "<f7> <f7> e") 'zf7f7e)
          
          
        • f7 f7 g: gnuplot-make-buffer
          (global-set-key (kbd "<f7> <f7> g") 'gnuplot-make-buffer)
          
        • t f7 f7 y n: new yasnippet: C-c & C-n
          (global-set-key (kbd "<f7> <f7> y n") 'yas-new-snippet)
          
        • t f7 f7 y s: insert yasnippet: C-c & C-s
          (global-set-key (kbd "<f7> <f7> y s") 'yas-insert-snippet)
          
        • t f7 f7 y v: visit yasnippet file
          (global-set-key (kbd "<f7> <f7> y v") 'yas-visit-snippet-file)
          
    • direct
      • f7 i: indent-sexp
        (global-set-key (kbd "<f7> i") 'indent-sexp)
        
      • f7 r: inf-ruby
        (global-set-key (kbd "<f7> r") 'inf-ruby)
        
  • f8: file system: bookmark+|deft|dir|dired|recentf|sunrise
    • name spaces
      • F8 F8 Name Space: (minor|sub)Modes
        • f8 f8 f4: shell in active dir
          (global-set-key (kbd "<f8> <f8> <f4>") 'sr-term-cd)
          
        • f8 f8 f7: sr-speedbar-toggle
          (global-set-key (kbd "<f8> <f8> <f7>") 'sr-speedbar-toggle)
          
        • 0 f8 f8 f8: run deft in current directory
          ;(defun zmy-deft ()
           ; "Run deft in directory dir"
          ;  (interactive "sEnter dir: ")
            ;(kill-buffer-and-its-windows "*Deft*")
          
            ;(setq deft-directory ".") (deft) (switch-to-buffer "*Deft*"))
          
          
          ;(global-set-key (kbd "<f8> <f8> <f8>") 'zmy-deft)
          
          
        • 0 f8 f8 f8 p: run deft in pendrive
          ;(global-set-key (kbd "<f8> <f8> <f8> p") (zmy-deft "/mnt/sdb1/home/data/current/org/"))
          
          
        • f8 f8 f9: sunrise-cd
          (global-set-key (kbd "<f8> <f8> <f9>") 'sunrise-cd)
          
        • f8 f8 left: sr-tree-mode
          (global-set-key (kbd "<f8> <f8> <left>") 'sr-tree-mode)
          
    • direct
      • f8 up: up dir
        (global-set-key (kbd "<f8> <up>") 'sr-dired-prev-subdir)
        
      • f8 del: sr-delete = sr-do-delete
        (global-set-key (kbd "<f8> <delete>") 'sr-do-delete)
        
      • f8 f5: sr-copy = sr-loop-do-copy
        (global-set-key (kbd "<f8> <f5>") 'sr-loop-do-copy)
        
      • f8 f6: move = sr-loop-do-rename
        (global-set-key (kbd "<f8> <f6>") 'sr-loop-do-rename)
        
      • f8 f7: create dir = sr-tree-create-directory
        (global-set-key (kbd "<f8> <f7>") 'sr-tree-create-directory)
        
      • f8 d: dired Downloads dir
        (defun zdired-writer ()
          (interactive)
          (dired "/mnt/sda9/Downloads/"))
        
        (global-set-key (kbd "<f8> d") 'zdired-writer)
        
        
      • f8 f: find-file
        (global-set-key (kbd "<f8> f") 'find-file)
        
      • f8 r: recentf-open-files
        (global-set-key (kbd "<f8> r") 'recentf-open-files)
        (recentf-mode)
        
      • f8 j: bookmark+: jump
        (global-set-key (kbd "<f8> j") 'bookmark-jump)
        
      • f8 l: bookmark+: list/edit
        (global-set-key (kbd "<f8> l") 'bookmark-bmenu-list)
        
      • f8 m: bookmark+: mark
        (global-set-key (kbd "<f8> m") 'bmkp-bookmark-set-confirm-overwrite)
        
      • f8 t: bookmark+: tag a file
        (global-set-key (kbd "<f8> t") 'bmkp-tag-a-file)
        
      • f8 w: webjump
        (global-set-key (kbd "<f8> w") 'webjump)
        
  • f10
    (global-set-key [(f10)(f10)] 'menu-bar-open)
    
  • f11
    (global-set-key [(f11)(f11)] 'toggle-frame-fullscreen)
    

markdown

(use-package markdown-mode
:ensure t)

org

UI
  • Customize newlines
    (customize-set-variable 'org-blank-before-new-entry
                            '((heading . nil)
                              (plain-list-item . nil)))
    (setq org-cycle-separator-lines 1)
    
  • Hide markers
    (setq org-hide-emphasis-markers t)
    
  • hide-leading-stars
    (setq org-hide-leading-stars 't)
    
  • Indent
    (setq org-indent-indentation-per-level 1)
    (setq org-startup-indented t)
    
  • Display images
    (setq org-startup-with-inline-images t)
    (add-hook
     'org-babel-after-execute-hook
     (lambda ()
       (when org-inline-image-overlays
         (org-redisplay-inline-images))))
    
  • Enable auto-fill mode
    (add-hook
     'org-mode-hook
     (lambda ()
       (auto-fill-mode)))
    
standard-key-bindings
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cb" 'org-iswitchb)

(setq org-log-done t
      org-todo-keywords '((sequence "t" "o"))
      org-todo-keyword-faces '(("t" . (:foreground "black" :background "dark red" :weight bold))
                               ("o" . (:foreground "black" :background "dark green" :weight bold))))

file-types-to-open
(add-to-list 'auto-mode-alist '("\\.\\(org\\|org_archive\\|txt\\)$" . org-mode))
showing-source-block-syntax-highlighting
(setq org-src-fontify-natively t)
load-languages
  • Picolisp in Org Babel
    • From https://github.com/tj64/ob-picolisp

      It used to ship with a picolisp-mode and an inferior-picolisp-mode for Emacs (to be found in the lib/el directory) until Pil64, but from Pil21 on these libraries have to be found on GitHub (e.g. https://github.com/tj64). The same holds for former library files for line editing (led.l and eled.l, replaced by readline lib in Pil21) and for symbol editing (edit.l and eedit.l, replaced by the use of VIP, the editor written in and shipped with Pil21).

      There are two Emacs modes now, picolisp-mode (older, more official) and plist-mode (newer, less tested). Both rely on the same inferior-picolisp.el file.

    • copy ob-picolisp.el from https://github.com/tj64/ob-picolisp to .emacs.d/.
  • org-babel-do-load-languages
    (org-babel-do-load-languages 'org-babel-load-languages
      '((ditaa . t)
       (dot . t)
       (emacs-lisp . t)
       (gnuplot . t)
    ;   (guile . t)
       (ruby . t)
       (latex . t)
       (ledger . t)
       (lisp . t)
       (picolisp . t)
    ;   (python . t)
       (R . t)
       (scheme . t)
       (shell . t)))
    
    
org-confirm-babel-evaluate
(setq org-confirm-babel-evaluate  nil)
org-contrib
; https://chrismaiorana.com/org-contrib/
  (use-package org-contrib
    :ensure t)
  (require 'ox-extra) ;; the package I wanted to include in my config
  ;; and a function to activate the features of this package:
  (ox-extras-activate '(latex-header-blocks ignore-headlines))
valign: INSTALL BY HAND
; https://github.com/casouri/valign
; M-x package-install RET valign RET

(add-hook 'org-mode-hook #'valign-mode)
htmlize: To export source blocks :: INSTALL BY HAND
; M-x  package-install RET htmlize RET.
html export - center title

#+BEGINSRC emacs-lisp (setq org-export-html-style-extra "<style type=\"text/css\">.title {text-align: center;}</style>") #+ENDSRC emacs-lisp

gt :tangle-when-needed:

Translator on Emacs. Support multiple engines such as Google, Bing, deepL, StarDict and Youdao, also support LLMs like ChatGPT, DeepSeek and so on.

    ; https://github.com/lorniu/gt.el
      (use-package gt :ensure t)


;; Basic configuration:
;; Initialize the default translator, let it translate between en and fr via Google Translate,
;; and the result will be displayed in the Echo Area.
  (setq gt-langs '(en sa))
  (setq gt-default-translator (gt-translator :engines (gt-google-engine)))



(setq gt-preset-translators
    `((ts-1 . ,(gt-translator
                :taker (gt-taker :langs '(en sa) :text 'word)
                :engines (gt-bing-engine)
                :render (gt-overlay-render)))
      (ts-2 . ,(gt-translator
                :taker (gt-taker :langs '(en sa hi) :text 'sentence)
                :engines (gt-google-engine)
                :render (gt-insert-render)))
      (ts-3 . ,(gt-translator
                :taker (gt-taker :langs '(en hi) :text 'buffer
                                 :pick 'word :pick-pred (lambda (w) (length> w 6)))
                :engines (gt-google-engine)
                :render (gt-overlay-render :type 'help-echo)))))

deft

  ; https://jblevins.org/projects/deft/

(use-package deft
:ensure t
:custom
(deft-extensions '("org" "md" "txt"))
(deft-directory "~/org")
(deft-use-filename-as-title t))

startup

(dired "~/org")

(deft)
  (switch-to-buffer "*Deft*")