xtodo emacs tutorial site

xtodo

lexical-binding, lexical scope vs dynamic scope

;; dynamic scope
(setq yy 'xx)
(let (xx)
  (setq xx 3)
  (print (format "%s" yy)))
;; xx

;; dynamic scope
(setq yy 'xx)
(let (xx)
  (setq xx 3)
  (print (format "%s" (eval yy))))
"3"
;; -*- lexical-binding: t; -*-

;; lexical scope
(setq yy 'xx)
(let (xx)
  (setq xx 3)
  (print (format "%s" yy)))
;; xx

;; HHHH------------------------------

;; lexical scope
(setq yy 'xx)
(let (xx)
  (setq xx 3)
  (print (format "%s" (eval yy))))
;; Debugger entered--Lisp error: (void-variable xx)
xtodo

put to tutorial

(defun xah-random-int (Min Max)
  "version 2022-08-26"
  (+ Min (random (- (1+ Max) Min))))

merge Emacs Lisp Examples to Xah Emacs Commands

looking-back is slow.

here's a typical usage:

(looking-back "[ \t\n]" (1- (point)) )

you can change it to:

;; warning. error if at point min
(prog2 (backward-char) (looking-at "[ \t\n]") (forward-char))

things in Emacs 28 (date 2022) and Emacs 29 (date 2023) that i suggested to change some 10 plus years ago.

emacs keybinding syntax problem 2023-08-30
emacs keybinding syntax problem 2023-08-30

review


xtodo
(let ((current-time-list t))
  (current-time))
;; (26617 34607 948241 0)

(let ((current-time-list nil))
  (current-time))
;; (1744406324012224000 . 1000000000)

(current-time-string)
;; "Fri Apr 11 14:14:42 2025"
xtodo
xtodo
xtodo
xtodo
xtodo
xtodo

emacs xtodo