;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (byte-code "\300\301!\210\300\302!\210\300\303!\207" [require cl font-lock view] 2) #@131 Directory where memo files are placed. You need not create directory when it does not exist. usage-memo creates it automatically. (defvar umemo-base-directory "~/memo/umemo" (#$ . 172)) #@43 Separator between documentation and memo. (defvar umemo-separator "\n===*===*===*===*===*===*===*===*===*===*===\n" (#$ . 364)) #@63 Category of usage-memo. It is defined by `define-usage-memo'. (defvar umemo-category nil (#$ . 498)) #@91 Entry name that help buffer(per buffer) is showing. It is used as filename of annotation. (defvar umemo-entry-name nil (#$ . 605)) #@44 Major mode when `usage-memo-mode' turn on. (defvar umemo-orig-major-mode nil (#$ . 742)) #@304 Entry name that help buffer(globally) is showing. See also `umemo-entry-name'. It is needed because some help system (eg. SLIME) kills help buffer and re-create it. In this case, the buffer-local `umemo-entry-name' is cleared: I have no choice but to use global variable. But it is probaby rare case. (defvar umemo-current-entry-name nil (#$ . 838)) (byte-code "\300\301!\210\300\302!\210\300\303!\207" [make-variable-buffer-local umemo-category umemo-entry-name umemo-orig-major-mode] 2) #@89 If non-nil, change major mode to `umemo-second-mode' when point is below the separator. (defvar umemo-auto-change-major-mode-flag t (#$ . 1335)) #@35 Major mode to write a usage memo. (defvar umemo-second-mode 'org-mode (#$ . 1486)) (defvar umemo-change-major-mode-flag nil) #@69 Filename of annotation. `umemo-base-directory'/CATEGORY/ENTRY-NAME. (defalias 'umemo-pathname #[(category entry-name) "\303\304 \n$\207" [umemo-base-directory category entry-name format "%s/%s/%s"] 5 (#$ . 1617)]) (defalias 'umemo-fall-back-to-global-key-binding-in-memo-area #[(key) "\303!\304!\305\306`!\203\n\202 \203 \202\n!*\207" [key lb gb local-key-binding global-key-binding call-interactively umemo-point-is-in-memo-area-p] 3]) (defalias 'umemo-point-is-in-memo-area-p #[(point) "\212b\210\302 \303\304#)\207" [point umemo-separator search-backward nil t] 4]) #@36 Execute BODY at the end of BUFFER. (defalias 'umemo-with-append-to-buffer '(macro . #[(buffer &rest body) "\301\302\303BBB\207" [body save-excursion (set-buffer buffer) (goto-char (point-max))] 4 (#$ . 2206)])) (defalias 'umemo-if-buffer-has-separator '(macro . #[(&rest body) "\301\302\303\304BBE\207" [body save-excursion (goto-char (point-min)) when (search-forward umemo-separator nil t)] 5])) (defalias 'umemo-has-entry-p #[nil "\212eb\210\301\302\303#\205`dU?)\207" [umemo-separator search-forward nil t] 4]) (defalias 'umemo-insert-memo #[(category entry-name buffer) "\306 \"\212 q\210db\210\307\310 ?\205 c\210\311\n!\205 \312\n!*\207" [category entry-name path buffer buffer-read-only umemo-separator umemo-pathname nil umemo-has-entry-p file-exists-p insert-file-contents] 3]) (defalias 'umemo-setup-variables #[(category entry-name buffer) "r\nq\210 \211)\207" [entry-name umemo-current-entry-name buffer category umemo-category umemo-entry-name major-mode umemo-orig-major-mode] 2]) (byte-code "\300\301\302\303#\210\300\304\302\303#\210\300\305\302\303#\207" [put umemo-category permanent-local t umemo-entry-name umemo-orig-major-mode] 4) (defalias 'umemo-change-mode #[(mode) "\303!\205 =?\205 \210\304\305!\210\306 \210\n\307=\205\310 \207" [mode major-mode font-lock-mode fboundp usage-memo-mode 1 umemo-auto-change-major-mode-setup t font-lock-fontify-buffer] 2]) (defalias 'umemo-update-mode #[nil "\205 \205\212\305\n\306\307#)\203\310 !\207\310\f!\207" [umemo-auto-change-major-mode-flag umemo-change-major-mode-flag umemo-separator umemo-orig-major-mode umemo-second-mode search-forward nil t umemo-change-mode] 4]) (add-hook 'post-command-hook 'umemo-update-mode) (defalias 'umemo-auto-change-major-mode-setup #[nil "\301\300!\210\302\211\207" [umemo-change-major-mode-flag make-local-variable t] 2]) (defalias 'umemo-setup #[(category entry-name buffer) "\303!\205rq\210\304 \n#\210\305 \n#\210\306\307!)\207" [buffer category entry-name get-buffer umemo-setup-variables umemo-insert-memo usage-memo-mode 1] 4]) #@48 Save current usage memo(annotation) into file. (defalias 'umemo-save #[nil "\212eb\210\305\306\307#\205/\310 \n\"\311 !\312\f!\204 \313\f\307\"\210\314`d #\210\315\306!\210\316\317 \"*)\207" [umemo-separator umemo-category umemo-entry-name path dir search-forward nil t umemo-pathname file-name-directory file-directory-p make-directory write-region set-buffer-modified-p message "Wrote %s"] 4 (#$ . 4292) nil]) (defalias 'umemo-electric-return #[nil "\300\301!\207" [umemo-fall-back-to-global-key-binding-in-memo-area " "] 2 nil nil]) (defalias 'umemo-electric-quit #[nil "\300`!\203\f\301\302\303!!\207\304\305!\205\306 \207" [umemo-point-is-in-memo-area-p call-interactively global-key-binding "q" view-mode 1 View-quit] 3 nil nil]) #@1661 Add usage-memo feature to COMMAND. Define `usage-memo' around-advice for COMMAND. CATEGORY is usage-memo category to use, typically language name. NTH-ARG is COMMAND's argument position (0-origin) representing entry name, NTH-ARG is passed to `ad-get-arg' macro. BUFFER-FMT is a `format' string, which %s is replaced with entry name, representing document display buffer. Optional NAME-CONVERTER-FUNCTION is 1-argument function to convert COMMAND's argument (indicated by NTH-ARG) to entry name. Of course, the default is `identity'. NAME-CONVERTER-FUNCTION can be used when the entry name is determined by document-displaying buffer contents. BUFFER-FMT is bound when NAME-CONVERTER-FUNCTION is called. For example: To support `describe-function' (already supported): (define-usage-memo describe-function "elisp" 0 "*Help*") Because `define-usage-memo' is a macro, COMMAND is not quoted. The CATEGORY is "elisp". The NTH-ARG is 0 because `describe-function' takes a symbol to lookup at the first argument. Because NTH-ARG is 0-origin, 0 means the first argument. BUFFER-FMT is same as *Help* buffer: it is only coincidental. Another example: Support RI lookup (Ruby's document-lookup tool) `ri' function is defined in ri-ruby.el. The usage is: (ri ENTRY_NAME) Then `ri' creates ri `ENTRY_NAME' buffer. Instead of reusing a buffer, it creates a buffer per query. That is why BUFFER-FMT uses `format' string! (define-usage-memo ri "ruby" 0 "ri `%s'") SLIME example: Downcase Lisp's symbol (define-usage-memo slime-show-description "cl" 0 "*SLIME Description*" umemo-make-entry-name:slime) See also `umemo-initialize' definition.  (defalias 'define-usage-memo '(macro . #[(command category nth-arg buffer-fmt &optional name-converter-function) "\206\306\307\n\310\311\312\303 D\313\314\315 D\316\317\320\fDEED\321\322\316 \323BBDDE\324 \325BBE\257)\207" [name-converter-function converter command buffer-fmt nth-arg category identity defadvice (around usage-memo activate) ad-do-it let* entry-name funcall quote format "%s" ad-get-arg buf with-no-warnings (entry-name) umemo-setup (entry-name buf)] 13 (#$ . 5044)])) #@68 A bunch of `define-usage-memo' definitions. Feel free to redefine! (defalias 'umemo-initialize #[nil "\300\301\302\303\304$\210\305\301\304\"\210\300\306\307\303\304$\210\305\306\304\"\210\300\310\311\303\304$\210\305\310\304\"\210\300\312\313\303\304$\210\305\312\304\"\210\300\314\315\303\304$\210\305\314\304\"\210\300\316\317\303\304$\210\305\316\304\"\210\316\207" [ad-add-advice ri (usage-memo nil t (advice lambda nil ad-do-it (let* ((buffer-fmt #1="ri `%s'") (entry-name (funcall 'identity (format #2="%s" (ad-get-arg 0)))) (buf (with-no-warnings (format #1# . #4=(entry-name))))) (umemo-setup "ruby" . #5=(entry-name buf))))) around nil ad-activate lh-refe (usage-memo nil t (advice lambda nil ad-do-it (let* ((buffer-fmt #3="refe \"%s\"") (entry-name (funcall 'identity (format #2# (ad-get-arg 0)))) (buf (with-no-warnings (format #3# . #4#)))) (umemo-setup "ruby" . #5#)))) slime-show-description (usage-memo nil t (advice lambda nil ad-do-it (let* ((buffer-fmt #6="*SLIME Description*") (entry-name (funcall 'umemo-make-entry-name:slime (format #2# (ad-get-arg 0)))) (buf (with-no-warnings (format #6# . #4#)))) (umemo-setup "cl" . #5#)))) describe-function (usage-memo nil t (advice lambda nil ad-do-it (let* ((buffer-fmt #7="*Help*") (entry-name (funcall 'identity (format #2# (ad-get-arg 0)))) (buf (with-no-warnings (format #7# . #4#)))) (umemo-setup "elisp" . #5#)))) describe-variable (usage-memo nil t (advice lambda nil ad-do-it (let* ((buffer-fmt #8="*Help*") (entry-name (funcall 'identity (format #2# (ad-get-arg 0)))) (buf (with-no-warnings (format #8# . #4#)))) (umemo-setup "elisp" . #5#)))) describe-mode (usage-memo nil t (advice lambda nil ad-do-it (let* ((buffer-fmt #9="*Help*") (entry-name (funcall '(lambda (arg) major-mode) (format #2# (ad-get-arg 0)))) (buf (with-no-warnings (format #9# . #4#)))) (umemo-setup "elisp" . #5#))))] 5 (#$ . 7201)]) (defvar usage-memo-mode-map (make-sparse-keymap)) (byte-code "\301\302\303#\210\301\304\305#\210\301\306\307#\207" [usage-memo-mode-map define-key "" umemo-save " " umemo-electric-return "q" umemo-electric-quit] 4) #@99 Non-nil if Usage-Memo mode is enabled. Use the command `usage-memo-mode' to change this variable. (defvar usage-memo-mode nil (#$ . 9308)) (make-variable-buffer-local 'usage-memo-mode) #@864 Automatically enabled minor mode to add usage-memo feature by `define-usage-memo'. This is a minor mode. If called interactively, toggle the `Usage-Memo mode' mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode. If called from Lisp, toggle the mode if ARG is `toggle'. Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number. To check whether the minor mode is enabled in the current buffer, evaluate `usage-memo-mode'. The mode's hook is called both when the mode is enabled and when it is disabled. Write your annotation below `===*===*===*===*===*===*===*===*===*===*===' line. \\[umemo-save]: Save your annotation to file indicated by `umemo-pathname'. Of course, your annotation is revived even if Emacs is restarted!  (defalias 'usage-memo-mode #[(&optional arg) "\306  \307=\203\n?\202 \247\203 \310W\203\311\202\312\313\303!\2032\314\302 \"\n\2032\302 B\311 \203<\305\315!\210\316\317# \320 \210\321 \210\322\323\n\203U\324\202V\325\"\210\326\327!\203}\306 \203j\306 \232\203}\330!\331\332\n\203w\333\202x\334!#\210))\335 \210\n\207" [#1=#:last-message arg usage-memo-mode local-minor-modes buffer-read-only view-mode current-message toggle 1 nil t boundp delq -1 format "[%s/%s]" umemo-auto-change-major-mode-setup buffer-enable-undo run-hooks usage-memo-mode-hook usage-memo-mode-on-hook usage-memo-mode-off-hook called-interactively-p any " in current buffer" message "Usage-Memo mode %sabled%s" "en" "dis" force-mode-line-update umemo-category umemo-entry-name header-line-format local] 4 (#$ . 9500) (list (if current-prefix-arg (prefix-numeric-value current-prefix-arg) 'toggle))]) (defvar usage-memo-mode-hook nil) (byte-code "\301\302N\204\f\303\301\302\304#\210\303\301\305\306#\210\303\301\307\310C#\210\311\312\313\310\211%\207" [usage-memo-mode-map usage-memo-mode-hook variable-documentation put "Hook run after entering or leaving `usage-memo-mode'.\nNo problems result if this variable is not bound.\n`add-hook' automatically binds it. (This is true for all hook variables.)" custom-type hook standard-value nil add-minor-mode usage-memo-mode ""] 6) (defalias 'umemo-make-entry-name:slime #[(symbol-name) "\301!\227\207" [buffer-fmt umemo-slime-get-full-symbol-name] 2]) #@174 Get common lisp full symbol name describing in BUF. Currently it supports SBCL, CMUCL and CLISP. If you want to adjust to other CL implementations, redefine this function. (defalias 'umemo-slime-get-full-symbol-name #[(buf) "\305\306\307K\310K\311\216\307 M\210\310M\210\212\fq\210eb\210\312\313\314\310\315\316\"\307\317\320\321#\2044\212\307\322\320\323#)\2038\323\2029\324\310\325\320\"\206K\310\326\320\"\206K\310\327\320\"E!\".\207" [#1=#:vnew #2=#:vnew #3=#:old #4=#:old buf #[(re num) "\302\303\304#\205 \305 !\207" [re num re-search-forward nil t match-string] 4] #[(re num str) "\303 \"\n\232\207" [re num str srch] 3] srcheq srch #[nil "\302M\210\303 M\207" [#3# #4# srcheq srch] 2] apply concat reverse "^\\(.+:+\\)?\\([^ ]+\\)" 2 "an \\(internal\\|external\\) symbol" 1 "internal" "SYMBOL-PLIST[^:]+\\(:+\\)" "::" ":" "#" "in the \\(.+\\) package" "#"] 8 (#$ . 11884)]) (defvar umemo-maintainer-mail-address "rubikitch@ruby-lang.org") (defvar umemo-bug-report-salutation "Describe bug below, using a precise recipe.\n\nWhen I executed M-x ...\n\nHow to send a bug report:\n 1) Be sure to use the LATEST version of usage-memo.el.\n 2) Enable debugger. M-x toggle-debug-on-error or (setq debug-on-error t)\n 3) Use Lisp version instead of compiled one: (load \"usage-memo.el\")\n 4) If you got an error, please paste *Backtrace* buffer.\n 5) Type C-c C-c to send.\n# If you are a Japanese, please write in Japanese:-)") (defalias 'umemo-send-bug-report #[nil "\302\303\304\305\306\"\307\211 &\207" [umemo-maintainer-mail-address umemo-bug-report-salutation reporter-submit-bug-report "usage-memo.el" apropos-internal "^u\\(sage-\\)?memo-" boundp nil] 7 nil nil]) (provide 'usage-memo)