isearch-lazy-count t
;; don't spawn new frames in Ediff
ediff-window-setup-function #'ediff-setup-windows-plain
+ duplicate-line-final-position -1
+ tramp-kubernetes-namespace "argo"
;; make some space in the Packages menu
package-archive-column-width 12
package-version-column-width 28
all-the-icons-completion
all-the-icons-dired
all-the-icons-gnus
- auctex
+ ;; auctex
avy
bbdb
corfu
devdocs
diff-hl
eat
+ eglot
ef-themes
elfeed
embark-consult
orderless
org
org-transclusion
+ osm
package-lint
paredit
pdf-tools
("bash" . sh)
("shell" . sh)
("toml" . toml-ts))
+ ;; preview LaTeX fragments in Org buffers via SVG
+ org-preview-latex-default-process 'dvisvgm
;; don't auto-save remote files
remote-file-name-inhibit-auto-save t
;; don't ask me about it either
shell-kill-buffer-on-exit t
;; allow disabling confirming before compilation via local variables
safe-local-variable-values '((compilation-read-command . nil))
- TeX-view-program-selection '((output-pdf "PDF Tools"))
- TeX-source-correlate-start-server t
+ ;; TeX-view-program-selection '((output-pdf "PDF Tools"))
+ ;; TeX-source-correlate-start-server t
xref-show-definitions-function #'consult-xref
xref-show-xrefs-function #'consult-xref
xref-search-program 'ripgrep
(backward-word)
(kill-region (point) end))))
+ (defun duplicate-line-stay (arg)
+ (interactive "p")
+ (let ((duplicate-line-final-position 0))
+ (duplicate-line arg)))
+
(defun esy/ttyper ()
(interactive)
(eat "ttyper" t))
(url-generic-parse-url remote))))
"~/checkouts")))
(vc-clone remote 'Git dir)
- (find-file dir))))
+ (find-file dir)))
+
+ (defun esy/json-path-to-position (pos)
+ "Return the JSON path from the document's root to the element at POS.
+
+The path is represented as a list of strings and integers,
+corresponding to the object keys and array indices that lead from
+the root to the element at POS."
+ (named-let loop ((node (treesit-node-at pos)) (acc nil))
+ (if-let ((parent (treesit-parent-until
+ node
+ (lambda (n)
+ (member (treesit-node-type n)
+ '("pair" "array"))))))
+ (loop parent
+ (cons
+ (pcase (treesit-node-type parent)
+ ("pair"
+ (treesit-node-text
+ (treesit-node-child (treesit-node-child parent 0) 1) t))
+ ("array"
+ (named-let check ((i 1))
+ (if (< pos (treesit-node-end (treesit-node-child parent i)))
+ (/ (1- i) 2)
+ (check (+ i 2))))))
+ acc))
+ acc)))
+
+ (defun esy/json-path-at-point (point &optional kill)
+ "Display the JSON path at POINT. When KILL is non-nil, kill it too.
+
+Interactively, POINT is point and KILL is the prefix argument."
+ (interactive "d\nP" json-ts-mode)
+ (let ((path (mapconcat (lambda (o) (format "%s" o))
+ (esy/json-path-to-position point)
+ ".")))
+ (if kill
+ (progn (kill-new path) (message "Copied: %s" path))
+ (message path))
+ path))
+
+ (defun esy/bump (tag-prefix)
+ (interactive (list "v"))
+ (require 'lisp-mnt)
+ (require 'magit-apply)
+ (let ((date (format-time-string "%F" (current-time)))
+ (current-version (save-excursion (lm-header "package-version"))))
+ (unless current-version
+ (user-error "No Package-Version Elisp header found"))
+ (let ((next-version (mapconcat #'number-to-string
+ (pcase (version-to-list
+ current-version)
+ (`(,major ,minor ,patch)
+ (list major (1+ minor) patch)))
+ ".")))
+ (with-current-buffer (find-file "NEWS.org")
+ (goto-char (point-min))
+ (re-search-forward (concat "^\\(" org-outline-regexp "\\)") nil t)
+ (beginning-of-line)
+ (if (looking-at (rx "* Version "
+ (group-n 1
+ (+ digit) "."
+ (+ digit) "."
+ (+ digit))
+ " in development"))
+ (progn
+ (setq next-version (match-string-no-properties 1))
+ (end-of-line)
+ (delete-char -14)
+ (insert "on " date)
+ (forward-char 2))
+ (insert "* Version " next-version " on " date "\n\n")))
+ (lm-header "package-version")
+ (delete-region (point) (pos-eol))
+ (insert next-version)
+ (vc-print-root-log)
+ (find-file-other-window "NEWS.org")
+ (named-let loop ()
+ (recursive-edit)
+ (unless (y-or-n-p "OK to stage, commit and tag the new version?")
+ (loop)))
+ (unless (= (call-process "git" nil nil nil
+ "add" (buffer-file-name) "NEWS.org")
+ 0)
+ (error "Git add failed"))
+ (unless (= (call-process "git" nil nil nil
+ "commit" "-m"
+ (concat "Announce recent changes "
+ "in NEWS.org "
+ "and bump version to "
+ next-version))
+ 0)
+ (error "Git commit failed"))
+ (unless (= (call-process "git" nil nil nil
+ "tag" "-s" "-m"
+ (concat "Release version "
+ next-version)
+ (concat tag-prefix next-version))
+ 0)
+ (error "Git tag failed"))))))
(esy/init-step auto-exec-permissions
"Ensure scripts ran with `executable-interpret' are executable."
(with-eval-after-load 'executable
- (define-advice executable-interpret (:before (&rest _) ensure-executable)
- (unless (file-exists-p buffer-file-name)
- (basic-save-buffer))
- (executable-make-buffer-file-executable-if-script-p))))
+ (define-advice executable-interpret (:before (&rest _) ensure-executable)
+ (unless (file-exists-p buffer-file-name)
+ (basic-save-buffer))
+ (executable-make-buffer-file-executable-if-script-p))))
(esy/init-step pulse-on-window-selection-change
"Pulse the line around point after switching windows."
(keymap-global-set "<remap> <goto-line>" #'consult-goto-line)
(keymap-global-set "<remap> <suspend-frame>" #'zap-up-to-char)
(keymap-global-set "<remap> <imenu>" #'consult-imenu)
- (keymap-global-set "<remap> <make-frame>" #'duplicate-line)
+ (keymap-global-set "s-n" #'duplicate-line)
+ (keymap-global-set "s-p" #'duplicate-line-stay)
+ (keymap-global-set "s-u" #'universal-argument)
+ (keymap-global-set "s--" #'negative-argument)
(keymap-global-set "M-#" #'dictionary-search)
(keymap-global-set "M-o" #'previous-buffer)
(keymap-global-set "M-O" #'next-buffer)
windmove-swap-states-right))
(put command 'repeat-map 'window-prefix-map))
+ ;; digit arguments with the super modifier
+ (dotimes (i 10)
+ (keymap-global-set (concat "s-" (number-to-string i))
+ #'digit-argument))
+
;; unbind some keys
(dolist (key '("s-a" "s-d" "s-e" "s-f" "s-g" "s-h" "s-j" "s-k" "s-l"
- "s-m" "s-o" "s-p" "s-q" "s-s" "s-t" "s-u" "s-w" "s-x"
- "s-y" "s-z"))
+ "s-m" "s-o" "s-q" "s-s" "s-t" "s-w" "s-x" "s-y" "s-z"))
(keymap-global-unset key))
;; enable some commands
(add-hook 'pdf-view-mode-hook #'pdf-view-midnight-minor-mode))
(add-to-list 'revert-without-query "\\.pdf\\'"))
-(esy/init-step tex
- "Configure TeX via `auctex'."
- (with-eval-after-load 'tex
- (add-hook 'TeX-after-compilation-finished-functions
- #'TeX-revert-document-buffer)))
+;; (esy/init-step tex
+;; "Configure TeX via `auctex'."
+;; (with-eval-after-load 'tex
+;; (add-hook 'TeX-after-compilation-finished-functions
+;; #'TeX-revert-document-buffer)))
(esy/init-step vterm
"Configure terminal emulation via `vterm'."
(setq-default prolog-system 'swi)
(add-to-list 'major-mode-remap-alist '(prolog-mode . sweeprolog-mode))
(with-eval-after-load 'sweeprolog
+ (setq sweeprolog-top-level-persistent-history
+ (locate-user-emacs-file ".sweep_history"))
(add-hook 'sweeprolog-mode-hook #'sweeprolog-electric-layout-mode)
(add-hook 'sweeprolog-top-level-mode-hook #'compilation-shell-minor-mode)))