diff --git a/eaf.el b/eaf.el index 90c9327..3c07ef3 100644 --- a/eaf.el +++ b/eaf.el @@ -1484,7 +1484,7 @@ This function works best if paired with a fuzzy search package." (if history-file-exists (mapcar (lambda (h) (when (string-match history-pattern h) - (format "[%s] ⇰ %s" (match-string 1 h) (match-string 2 h)))) + (format "[%s] ⇰ %s" (match-string 1 h) (match-string 2 h)))) (with-temp-buffer (insert-file-contents browser-history-file-path) (split-string (buffer-string) "\n" t))) nil))) @@ -1830,6 +1830,58 @@ Make sure that your smartphone is connected to the same WiFi network as this com (h (nth 3 window-allocation))) (format "%s:%s:%s:%s:%s" eaf--buffer-id x y w h))) +(defun eaf-generate-keymap-doc () + "This command use for generate keybindings document." + (interactive) + (let ((vars (list 'eaf-browser-keybinding + 'eaf-pdf-viewer-keybinding + 'eaf-video-player-keybinding + 'eaf-js-video-player-keybinding + 'eaf-image-viewer-keybinding + 'eaf-terminal-keybinding + 'eaf-camera-keybinding + 'eaf-rss-reader-keybinding + 'eaf-mindmap-keybinding + 'eaf-mermaid-keybinding)) + (doc-buffer (generate-new-buffer (format "eaf-keymaps-%s" (random (expt 16 4)))))) + (with-current-buffer doc-buffer + (insert "**** Entire document automatically generated by command =eaf-generate-keymap-doc=.\n\n") + (insert "* Overview + Each EAF App has its own set of keybindings. Their default bindings are listed below. You can also see this list by executing =(describe-mode)= or =C-h m= within an EAF buffer. + + You can customize them very easily with the =eaf-bind-key= function: find the corresponding *Keybinding Variable*, and add the something similar to the following to =.emacs= + #+BEGIN_SRC emacs-lisp + (eaf-bind-key scroll_up \"C-n\" eaf-pdf-viewer-keybinding) + #+END_SRC + +* Global keybindings + | Key | Event | + |-------+-----------------------| + | C-h m | eaf-describe-bindings | + | C-c b | eaf-open-bookmark | + | C-c e | eaf-open-external | + | M-/ | eaf-get-path-or-url | + | M-[ | eaf-share-path-or-url | + +* Browser Edit Mode + | Key | Event | + |---------+------------------------------------| + | C-c C-c | eaf-edit-buffer-confirm | + | C-c C-k | eaf-edit-buffer-cancel | + | C-c C-t | eaf-edit-buffer-switch-to-org-mode | + +") + (dolist (var vars) + (insert (format "* %s\n" (get var 'variable-documentation))) + (insert (format " *Keybinding Variable*: =%s=\n" (symbol-name var))) + (insert "| Key | Event |\n") + (insert "|-----+------|\n") + (dolist (element (eval var)) + (insert (format "| %s | %s |\n" (car element) (cdr element)))) + (insert "\n"))) + (switch-to-buffer doc-buffer) + (message "Update EAF Keybindings wiki with buffer content."))) + ;;;;;;;;;;;;;;;;;;;; Advice ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; FIXME: In the code below we should use `save-selected-window' (or even