Xah Emacs Blog

A blackhole you cannot escape.

xah-html-mode.el removed key C-r for xah-html-open-in-browser. Reason: the C-r is added for browser compatibility. For example, you can define a macro on a keypad to send C-r. when dev a website, you can press that single key, and you can also press that in emacs to view in browser.

now, removed. main reason is that it conflict with emacs C-r for isearch-backward, sometimes convenient when using xah-fly-keys. binding C-r is hackish in the first place. now, we use F5 for browser refresh for the same purpose as C-r. Again, not a strong reason, but still convenient.

by the way, TAB b b is also bound to xah-html-open-in-browser, and there are other commands and keys to view in different browsers.

repost. lots updates weekly in past year.

minor correction.

Emacs: Xah Fly Keys

added an optimot layout, removed beopy layout. optimot shouldn't be added because it's used by maybe just a hundred people in the world. however, cletip really ask for it. Also, he added beopy before which was added years ago in the early days, and beopy is another layout nobody heared of. from now on, only well-known keyboard layout should be supported in xah-fly-keys. you can always put it to your init. optimot may be removed in the future.

Emacs: Xah Fly Keys

lots updates.

minor updates

updates

major update.

What is place expression, generalized variable, in lisp

xtodo write a tutorial. and maybe another blog on lang design

# example, of the logical incongruity of the list element assignment syntax, in most imperative (procedural) languages

xList = [3,4,5]
xList[0] = "something"

Emacs: Xah Fly Keys

Refactor. Changed all var naming, beginning dollar sign to x. Reason: sigil is great as syntactic design of a lang, but not a lisp tradition and is abnormal in lisp community. Using ascii prefix x is less odd in lisp, is easier to type, still retain some var name uniqueness property by syntax.

Set emacs to start sans prompt, and don't use emacs daemon

Tip. setup your emacs so that you can start multiple emacs instances, without any prompt that might interrupt the start up and wait for you to answer a prompt.

and i don't use emacs daemon, because when you do elisp, you need to restart often for a clean emacs.

major update again

emacs people on odysee

Now, posting some emacs people on odysee. We should post links to odysee, instead YouTube. These are great video channels.

updates.

major rewrite and updates

major update. Emacs: Xah Wolfram Mode

xtodo updates

xah-major-mode-leader-key

the xah-major-mode-leader-key is meant as system-wide leader key for packages, at least for xahemacs.

in gnu emacs, major mode's keys are fairly bad and unmageneable, because major mode keys by their convention is to have this form C-c C-โ€นkeyโ€บ etc. so, hard for pinky, and impossible to have a leader, and impossible to change for all major modes.

the way i have it, isn't ideal, but is probably the most simple solution.

also, i don't like define-custom. those are semi gui, hard to understand, easy to screw things up, and not all settings can be controlled by it. i think doomemacs also adopted not to support that semi gui custom.

xah-dired-open-in-irfanview rewrote, much faster. now use start-process instead of starting a shell for each. Similarly other opening commands

xah-dired-open-in-irfanview 2023-02-10
xah-dired-open-in-irfanview 2023-02-10
xtodo

major update.

updated.

complexity of escape key in emacs

major update and new

Emacs: Xah Fly Keys

Experimental. now Escape key by default is bound to xah-fly-command-mode-activate. Reason:

Advantage:

The disadvantage of bind Escape:

Note:


2023-01-27 revert last change. Now, escape key no longer do xah-fly-command-mode-activate. Because: if you bind <escape>, then it works in gui only, but not terminal. Very confusing. If you bind ESC, then in terminal arrows keys break, also F1 F2 etc keys. So, best solution is to let user customize instead. Thanks to yegor maltsev

xtodo

blog

(if Wait-p
    (apply 'call-process (append (list xah-dired-metadata-remover-path nil $outBuf t "-all=" "-overwrite_original") $shortNames nil))
  (apply 'start-process (append (list "exiftool" $outBuf xah-dired-metadata-remover-path "-all=" "-overwrite_original") $shortNames nil)))
xtodo

new.

switched to oxipng from optipng, and massive update to the emacs lisp code, much speed improvement. Emacs: xah-dired.el and see also oxipng

update and new.

Emacs: Xah Fly Keys tip

;; go to insert mode in xah-fly-keys
(add-hook 'dired-mode-hook 'xah-fly-insert-mode-activate)

updates.

xtodo
xtodo

major rework on emacs lisp sequences datatype

updates and new

highlight: Why Common Lisp Sucks, and Xah Lee is a Troll https://youtu.be/Oqt9aSw0Qaw?t=1944 from Xah Talk Show 2022-11-28 Why Common Lisp Sucks, and Xah Lee is a Troll, lispm

updates and new

emacs 29 features

read this article, great summary:

[Emacs 29 is nigh! What can we expect? By Lucien Cartier-Tilet (Aka Phundrak). At https://blog.phundrak.com/emacs-29-what-can-we-expect/ ]

here's some of my notes from it.

new modes using tree-sitter:

here's some collection of articles related to it.

xtodo

the after 10 years, emacs finally have redo.


updates and new. string and buffer.

xtodo review, rss

2022-10-31 Emacs: Xah Fly Keys More major internal change. No user visible change.

Internal implementation change. New function xah-fly-define-keys. This is called by xah-fly-keys-set-layout. Basically, command mode keys and leader keys are set by this function. It was several code blocks calling xah-fly--define-keys. Now they all moved into this new function, so that xah-fly-keys-set-layout no longer has to reload whole file. It now just call the new function.

updates and new.

Emacs: Xah Fly Keys

More major internal change 2022-10-26. No user visible change.

Emacs: Xah Fly Keys

xah-fly-keys major internal change. xah-fly-layouts

Emacs: Xah Fly Keys

some update to doc. (not related to the change above though.)

xtodo

updates.

emacs 28 new feature, redo.

New command undo-redo. This command is typically known as redo.

(setq undo-no-redo t)

** New command undo-redo. It undoes previous undo commands, but doesn't record itself as an undoable command. It is bound to 'C-?' and 'C-M-_', the first binding works well in graphical mode, and the second one is easy to hit on tty.

For full conventional undo/redo behavior, you can also customize the user option undo-no-redo to t.

massive updates again.

the emacs key panel, e.g. at Emacs: How to Define Keybinding, essays about keybinding that's not practical emacs use are moved to Emacs Misc Index

misc other updates:

more update. starting to make my tutorial more book-like, suitable for absolute beginners.

massive updates.

lots updates. now, pages that's just a custom emacs lisp command has a rocket ๐Ÿš€ indicator

massive updates. updated many screenshots that's 15 years old, and other updates, move section to new page, re-org, new nav box of related articles, and many rewrites etc. this more review and edit to do, but if i continue, the list wont stop. so, webfeeding it now.

am on lbry/odysee. follow me there.

Xah Talk Show 2022-09-28 emacs lisp. extract html links, insert to each page https://odysee.com/@XahLee:b/emacs-lisp-coding.-extract-html-links,:a

new and updates.

xtodo

code updates

All keyboard layout diagram changed. instead of button, now radio box, indicating current layout.

misc new and updates

Xah Fly Keys update for colemak dh layout

Emacs: Xah Fly Keys update for colemak dh layout.

fix and new keymaps for the Colemak DH layout variations. Now with more accurate name for the Colemak DH variations: dhm, dhk, and dhk with angle-mode.

For users, change your layout to one of:

the following layout names are removed:

internal:

xtodo

new discovery in emacs 28. insert-char

emacs inseart unicode char 2022-08-07
emacs inseart unicode char 2022-08-07

xtodo

Idiotic url parser in emacs lisp. url-generic-parse-url. Elaborate overly complex code, uses common lisp lib, and, doesn't parse query string part.

emacs lisp url parser 2022-08-22
emacs lisp url parser 2022-08-22

xtodo work in progress

updates and new

linux emacs, need help test xah-open-in-external-app โ€ข and xah-show-in-desktop

can any help test this new version on linux? (the code has already been checked-in in Emacs: Xah Fly Keys )

xah-open-in-external-app and xah-show-in-desktop

from emiltoacs https://github.com/xahlee/xah-fly-keys/pull/149

The linux branch of xah-open-in-external-app and xah-show-in-desktop that uses xdg-open starts another child process to open its parameters with the appropriate command then it quits however it makes emacs kill the subprocess as soon as xdg-open has finished therefore the files opened externally are also instantaneously killed.

;; before 2022-08-19
(defun xah-show-in-desktop ()
  "Show current file in desktop.
 (Mac Finder, File Explorer, Linux file manager)
This command can be called when in a file buffer or in `dired'.

URL `http://xahlee.info/emacs/emacs/emacs_dired_open_file_in_ext_apps.html'
Version: 2020-11-20 2022-04-20"
  (interactive)
  (let (($path (if (eq major-mode 'dired-mode)
                   (if (eq nil (dired-get-marked-files))
                       default-directory
                     (car (dired-get-marked-files)))
                 (if (buffer-file-name) (buffer-file-name) default-directory))))
    (cond
     ((string-equal system-type "windows-nt")
      (shell-command (format "PowerShell -Command invoke-item '%s'" (expand-file-name default-directory))))
     ((string-equal system-type "darwin")
      (shell-command
       (concat "open -R " (shell-quote-argument $path))))
     ((string-equal system-type "gnu/linux")
      (let ((process-connection-type nil)
            ($openFileProgram (if (file-exists-p "/usr/bin/gvfs-open")
                                  "/usr/bin/gvfs-open"
                                "/usr/bin/xdg-open")))
        (start-process "" nil $openFileProgram (shell-quote-argument $path)))
      ;; (shell-command "xdg-open .") ;; 2013-02-10 this sometimes froze emacs till the folder is closed. eg with nautilus
      ))))

;; after 2022-08-19
(defun xah-show-in-desktop ()
  "Show current file in desktop.
 (Mac Finder, File Explorer, Linux file manager)
This command can be called when in a file buffer or in `dired'.

URL `http://xahlee.info/emacs/emacs/emacs_dired_open_file_in_ext_apps.html'
Version: 2020-11-20 2022-04-20"
  (interactive)
  (let (($path (if (eq major-mode 'dired-mode)
                   (if (eq nil (dired-get-marked-files))
                       default-directory
                     (car (dired-get-marked-files)))
                 (if (buffer-file-name) (buffer-file-name) default-directory))))
    (cond
     ((string-equal system-type "windows-nt")
      (shell-command (format "PowerShell -Command invoke-item '%s'" (expand-file-name default-directory))))
     ((string-equal system-type "darwin")
      (shell-command
       (concat "open -R " (shell-quote-argument $path))))
     ((string-equal system-type "gnu/linux")
      (call-process shell-file-name nil nil nil
                    shell-command-switch
                    (format "%s %s"
                            "xdg-open"
                            (file-name-directory $path)))
      ;; (shell-command "xdg-open .") ;; 2013-02-10 this sometimes froze emacs till the folder is closed. eg with nautilus
      ))))
;; before 2022-08-19
(defun xah-open-in-external-app (&optional Fname)
  "Open the current file or dired marked files in external app.
When called in emacs lisp, if Fname is given, open that.

URL `http://xahlee.info/emacs/emacs/emacs_dired_open_file_in_ext_apps.html'
Version: 2019-11-04 2021-07-21"
  (interactive)
  (let ($fileList $doIt )
    (setq $fileList
          (if Fname
              (list Fname)
            (if (string-equal major-mode "dired-mode")
                (dired-get-marked-files)
              (list (buffer-file-name)))))
    (setq $doIt (if (<= (length $fileList) 5) t (y-or-n-p "Open more than 5 files? ")))
    (when $doIt
      (cond
       ((string-equal system-type "windows-nt")
        (mapc
         (lambda ($fpath)
           (shell-command (concat "PowerShell -Command \"Invoke-Item -LiteralPath\" " "'" (shell-quote-argument (expand-file-name $fpath )) "'")))
         $fileList))
       ((string-equal system-type "darwin")
        (mapc (lambda ($fpath) (shell-command (concat "open " (shell-quote-argument $fpath)))) $fileList))
       ((string-equal system-type "gnu/linux")
        (mapc (lambda ($fpath) (let ((process-connection-type nil)) (start-process "" nil "xdg-open" $fpath))) $fileList))
       ((string-equal system-type "berkeley-unix")
        (mapc (lambda ($fpath) (let ((process-connection-type nil)) (start-process "" nil "xdg-open" $fpath))) $fileList))))))

;; after 2022-08-19
(defun xah-open-in-external-app (&optional Fname)
  "Open the current file or dired marked files in external app.
When called in emacs lisp, if Fname is given, open that.

URL `http://xahlee.info/emacs/emacs/emacs_dired_open_file_in_ext_apps.html'
Version: 2019-11-04 2021-07-21 2022-08-19"
  (interactive)
  (let ($fileList $doIt )
    (setq $fileList
          (if Fname
              (list Fname)
            (if (string-equal major-mode "dired-mode")
                (dired-get-marked-files)
              (list (buffer-file-name)))))
    (setq $doIt (if (<= (length $fileList) 5) t (y-or-n-p "Open more than 5 files? ")))
    (when $doIt
      (cond
       ((string-equal system-type "windows-nt")
        (mapc
         (lambda ($fpath)
           (shell-command (concat "PowerShell -Command \"Invoke-Item -LiteralPath\" " "'" (shell-quote-argument (expand-file-name $fpath )) "'")))
         $fileList))
       ((string-equal system-type "darwin")
        (mapc (lambda ($fpath) (shell-command (concat "open " (shell-quote-argument $fpath)))) $fileList))
       ((string-equal system-type "gnu/linux")
        (mapc (lambda ($fpath)
                (call-process shell-file-name nil nil nil
                              shell-command-switch
                              (format "%s %s"
                                      "xdg-open"
                                      (shell-quote-argument $fpath))))
              $fileList))
       ((string-equal system-type "berkeley-unix")
        (mapc (lambda ($fpath) (let ((process-connection-type nil)) (start-process "" nil "xdg-open" $fpath))) $fileList))))))

updated or new page

updated:

Xah Emacs Blog Archive