Xah Emacs Blog

A blackhole you cannot escape.

updates and new. string and buffer.

xtodo review

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 Keys, 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

ErgoEmacs mascot-s276x226
Buy Xah Emacs Tutorial