ergoemacs .md</br>xah, _incement_digit </br> xah, -make-backup
ﷲ
#|#lead='﷽'
alias ergoemacs="emacs -Q --load ~/.emacs.d/elpa/xah-fly-keys --eval='(xah-fly-keys)'"
#-26.9.202501
#24153828/xah-fly-keys.el --eval='(xah-fly-keys)'"
‘-q’, ‘--no-site-file’, ‘--no-site-lisp’, ‘--no-x-resources’, and |pre code:hover
‘--no-splash’ together.
-q --no-site-file --no-site-lisp --no-x-resources --no-splash together.
--no-init-file, -q load neither ~/.emacs nor default.el
#|#lead='﷽'
alias ergoemacs="emacs --no-init-file --no-site-file --no-site-lisp --no-x-resources --no-splash --load ~/.emacs.d/elpa/xah-fly-keys --eval='(xah-fly-keys)'"
alias ergoemacs="emacs --no-init-file \
--no-site-file \
--no-site-lisp \
--no-x-resources \
--no-splash \
--load ~/.emacs.d/elpa/xah-fly-keys \
--eval='(xah-fly-keys)'"
(defun xah-increment-digit ()
"Increment digit under cursor.
If under cursor is not a digit, simply insert 1.
When reaches 9, goto 0. Vice versa.
Use arrow up/down keys to increment or decrement.
Or scroll wheel.
Created: 2025-01-23
Version: 2025-01-23"
(interactive)
(let (xchar)
(if (eq (point-min) (point))
(insert "1")
(progn
(setq xchar (buffer-substring-no-properties (1- (point)) (point)))
(if (string-match "[0-9]" xchar)
(progn
(delete-char -1)
(insert
(if (string-equal xchar "9")
"0"
(number-to-string (1+ (string-to-number xchar))))))
(insert "1")))))
(set-transient-map
(let ((xkmap (make-sparse-keymap)))
(keymap-set xkmap "<up>" 'xah-increment-digit)
(keymap-set xkmap "<down>" 'xah-decrement-digit)
(keymap-set xkmap "<wheel-up>" 'xah-increment-digit)
(keymap-set xkmap "<wheel-down>" 'xah-decrement-digit)
xkmap)))
(defun xah-decrement-digit ()
"Decrement digit under cursor.
If under cursor is not a digit, simply insert 1.
When reaches 0, goto 9. Vice versa.
Use arrow up/down keys to decrement or decrement.
Or scroll wheel.
Created: 2025-01-23
Version: 2025-01-23"
(interactive)
(let (xchar)
(setq xchar (buffer-substring-no-properties (1- (point)) (point)))
(if (string-match "[0-9]" xchar)
(progn
(delete-char -1)
(insert
(if (string-equal xchar "0")
"9"
(number-to-string (1- (string-to-number xchar))))))
(insert "1")))
(set-transient-map
(let ((xkmap (make-sparse-keymap)))
(keymap-set xkmap "<up>" 'xah-increment-digit)
(keymap-set xkmap "<down>" 'xah-decrement-digit)
(keymap-set xkmap "<wheel-up>" 'xah-increment-digit)
(keymap-set xkmap "<wheel-down>" 'xah-decrement-digit)
xkmap)))
Language:Lisp
(defun xah-increment-digit ()
"Increment digit under cursor.
If under cursor is not a digit, simply insert 1.
When reaches 9, goto 0. Vice versa.
Use arrow up/down keys to increment or decrement.
Or scroll wheel.
Created: 2025-01-23
Version: 2025-01-23"
(interactive)
(let (xchar)
(if (eq (point-min) (point))
(insert "1")
(progn
(setq xchar (buffer-substring-no-properties (1- (point)) (point)))
(if (string-match "[0-9]" xchar)
(progn
(delete-char -1)
(insert
(if (string-equal xchar "9")
"0"
(number-to-string (1+ (string-to-number xchar))))))
(insert "1")))))
(set-transient-map
(let ((xkmap (make-sparse-keymap)))
(keymap-set xkmap "<up>" 'xah-increment-digit)
(keymap-set xkmap "<down>" 'xah-decrement-digit)
(keymap-set xkmap "<wheel-up>" 'xah-increment-digit)
(keymap-set xkmap "<wheel-down>" 'xah-decrement-digit)
xkmap)))
(defun xah-decrement-digit ()
"Decrement digit under cursor.
If under cursor is not a digit, simply insert 1.
When reaches 0, goto 9. Vice versa.
Use arrow up/down keys to decrement or decrement.
Or scroll wheel.
Created: 2025-01-23
Version: 2025-01-23"
(interactive)
(let (xchar)
(setq xchar (buffer-substring-no-properties (1- (point)) (point)))
(if (string-match "[0-9]" xchar)
(progn
(delete-char -1)
(insert
(if (string-equal xchar "0")
"9"
(number-to-string (1- (string-to-number xchar))))))
(insert "1")))
(set-transient-map
(let ((xkmap (make-sparse-keymap)))
(keymap-set xkmap "<up>" 'xah-increment-digit)
(keymap-set xkmap "<down>" 'xah-decrement-digit)
(keymap-set xkmap "<wheel-up>" 'xah-increment-digit)
(keymap-set xkmap "<wheel-down>" 'xah-decrement-digit)
xkmap)))
Language:Lisp
(defun xah-make-backup ()
"Make a backup copy of current file or dired marked files.
If in dired, backup current file or marked files.
The backup file name is in this format
x.html~2018-05-15_133429~
The last part is hour, minutes, seconds.
Overwrite existing file.
If the current buffer is not associated with a file, nothing's done.
URL `http://xahlee.info/emacs/emacs/elisp_make-backup.html'
Created: 2018-07-07
Version: 2024-04-21"
(interactive)
(let ((xfname buffer-file-name)
(xdateTimeFormat "%Y-%m-%d_%H%M%S"))
(if xfname
(let ((xbackupName
(concat xfname "~" (format-time-string xdateTimeFormat) "~")))
(copy-file xfname xbackupName t)
(message (concat "\nBackup saved at: " xbackupName)))
(if (eq major-mode 'dired-mode)
(progn
(mapc (lambda (xx)
(let ((xbackupName
(concat xx "~" (format-time-string xdateTimeFormat) "~")))
(copy-file xx xbackupName t)))
(dired-get-marked-files))
(revert-buffer))
(user-error "%s: buffer not file nor dired" real-this-command)))))
(defun xah-toggle-letter-case ()
"Toggle the letter case of current word or selection.
Always cycle in this order: Init Caps, ALL CAPS, all lower.
URL `http://xahlee.info/emacs/emacs/emacs_toggle_letter_case.html'
Version: 2020-06-26 2023-11-14"
(interactive)
(let ( (deactivate-mark nil) xp1 xp2)
(if (region-active-p)
(setq xp1 (region-beginning) xp2 (region-end))
(save-excursion
(skip-chars-backward "[:alpha:]")
(setq xp1 (point))
(skip-chars-forward "[:alpha:]")
(setq xp2 (point))))
(when (not (eq last-command this-command))
(put this-command 'state 0))
(cond
((equal 0 (get this-command 'state))
(upcase-initials-region xp1 xp2)
(put this-command 'state 1))
((equal 1 (get this-command 'state))
(upcase-region xp1 xp2)
(put this-command 'state 2))
((equal 2 (get this-command 'state))
(downcase-region xp1 xp2)
(put this-command 'state 0)))))
Language:Clojure