Skip to content

Fix inf-clojure-apropos #128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 22, 2018
Merged

Conversation

arichiardi
Copy link
Contributor

@arichiardi arichiardi commented Jan 21, 2018

The functionality was erroring out cause of wrong function signature.
Moreover the key binding was not working because C-A is interpreted as C-a by
emacs (it seems, seeking Elisp expert advice).
This patch also add C-c C-S-A to inf-clojure-mode (the REPL itself).


Before submitting the PR make sure the following things have been done (and denote this
by checking the relevant checkboxes):

  • The commits are consistent with our contribution guidelines
  • The new code is not generating bytecode or M-x checkdoc warnings
  • You've updated the changelog (if adding/changing user-visible functionality)

Thanks!

@arichiardi arichiardi force-pushed the fix-apropos branch 3 times, most recently from eb0c7d7 to 7eda39a Compare January 21, 2018 20:44
@arichiardi
Copy link
Contributor Author

One thing I wanted to do was to use C-c C-d a like in cider, but I was getting an error:

  Debugger entered--Lisp error: (error "Key sequence C-c C-d a starts with non-prefix key C-c C-d")
      define-key((keymap (24 keymap (5 . inf-clojure-eval-last-sexp)) (menu-bar keymap (signals "Signals" keymap (break "BREAK" . comint-interrupt-subjob) (stop "STOP" . comint-stop-subjob) (cont "CONT" . comint-continue-subjob) (quit "QUIT" . comint-quit-subjob) (kill "KILL" . comint-kill-subjob) (eof "EOF" . comint-send-eof) "Signals") (inout "In/Out" keymap (expand-history "Expand History Before Point" . comint-replace-by-expanded-history) (list-history "List Input History" . comint-dynamic-list-input-ring) (previous-history "Previous Input" . comint-previous-input) (next-history "Next Input" . comint-next-input) (previous-matching-history-from-input "Previous Matching Current Input" . comint-previous-matching-input-from-input) (next-matching-history-from-input "Next Matching Current Input" . comint-next-matching-input-from-input) (previous-matching-history "Previous Matching Input..." . comint-previous-matching-input) (next-matching-history "Next Matching Input..." . comint-next-matching-input) (backward-matching-history "Backward Matching Input..." . comint-backward-matching-input) (forward-matching-history "Forward Matching Input..." . comint-forward-matching-input) (history-isearch-backward "Isearch Input String Backward..." . comint-history-isearch-backward) (history-isearch-backward-regexp "Isearch Input Regexp Backward..." . comint-history-isearch-backward-regexp) (copy-input "Copy Old Input" . comint-copy-old-input) (kill-input "Kill Current Input" . comint-kill-input) (show-output "Show Current Output Group" . comint-show-output) (show-maximum-output "Show Maximum Output" . comint-show-maximum-output) (previous-prompt "Backward Output Group" . comint-previous-prompt) (next-prompt "Forward Output Group" . comint-next-prompt) (write-output "Write Current Output Group to File" . comint-write-output) (append-output-to-file "Append Current Output Group to File" . comint-append-output-to-file) (delete-output "Delete Current Output Group" . comint-delete-output) "In/Out") (completion "Complete" keymap (complete "Complete at Point" . completion-at-point) (complete-file "Complete File Name" . comint-dynamic-complete-filename) (complete-listing "File Completion Listing" . comint-dynamic-list-filename-completions) (complete-expand "Expand File Name" . comint-replace-by-expanded-filename) "Complete")) (mouse-2 . comint-insert-input) (kp-delete . delete-forward-char) (delete . delete-forward-char) (4 . comint-delchar-or-maybe-eof) (13 . comint-send-input) (3 keymap (22 . inf-clojure-show-var-documentation) (46 . comint-insert-previous-argument) (19 . inf-clojure-show-var-source) (4 . comint-send-eof) (16 . comint-previous-prompt) (14 . comint-next-prompt) (12 . inf-clojure-load-file) (5 . comint-show-maximum-output) (18 . comint-show-output) (15 . comint-delete-output) (13 . comint-copy-old-input) (28 . comint-quit-subjob) (26 . comint-stop-subjob) (3 . comint-interrupt-subjob) (23 . backward-kill-word) (21 . comint-kill-input) (1 . inf-clojure-show-arglists) (24 . comint-get-next-from-history) (32 . comint-accumulate) (27 keymap (111 . comint-clear-buffer) (115 . comint-next-matching-input-from-input) (114 . comint-previous-matching-input-from-input))) (C-down . comint-next-input) (C-up . comint-previous-input) (27 keymap (12 . comint-show-output) (114 . comint-history-isearch-backward-regexp) (110 . comint-next-input) (112 . comint-previous-input))) "��a" inf-clojure-apropos)
      (let ((map (copy-keymap comint-mode-map))) (define-key map "��" (function inf-clojure-eval-last-sexp)) (define-key map "�\f" (function inf-clojure-load-file)) (define-key map "��" (function inf-clojure-show-arglists)) (define-key map "��" (function inf-clojure-show-var-documentation)) (define-key map "��" (function inf-clojure-show-var-source)) (define-key map "��a" (function inf-clojure-apropos)) (define-key map "�\357" (function inf-clojure-clear-repl-buffer)) (define-key map "��" (function inf-clojure-quit)) (progn (defvar inf-clojure-mode-menu nil "Inferior Clojure REPL Menu") (easy-menu-do-define (quote inf-clojure-mode-menu) map "Inferior Clojure REPL Menu" (quote ("Inf-Clojure REPL" ["Eval last sexp" inf-clojure-eval-last-sexp t] "--" ["Load file" inf-clojure-load-file t] "--" ["Show arglists" inf-clojure-show-arglists t] ["Show documentation for var" inf-clojure-show-var-documentation t] ["Show source for var" inf-clojure-show-var-source t] ["Apropos" inf-clojure-apropos t] "--" ["Clear REPL" inf-clojure-clear-repl-buffer] ["Restart" inf-clojure-restart] ["Quit" inf-clojure-quit] "--" ["Version" inf-clojure-display-version])))) map)
      (defvar inf-clojure-mode-map (let ((map (copy-keymap comint-mode-map))) (define-key map "��" (function inf-clojure-eval-last-sexp)) (define-key map "�\f" (function inf-clojure-load-file)) (define-key map "��" (function inf-clojure-show-arglists)) (define-key map "��" (function inf-clojure-show-var-documentation)) (define-key map "��" (function inf-clojure-show-var-source)) (define-key map "��a" (function inf-clojure-apropos)) (define-key map "�\357" (function inf-clojure-clear-repl-buffer)) (define-key map "��" (function inf-clojure-quit)) (progn (defvar inf-clojure-mode-menu nil "Inferior Clojure REPL Menu") (easy-menu-do-define (quote inf-clojure-mode-menu) map "Inferior Clojure REPL Menu" (quote ("Inf-Clojure REPL" ["Eval last sexp" inf-clojure-eval-last-sexp t] "--" ["Load file" inf-clojure-load-file t] "--" ["Show arglists" inf-clojure-show-arglists t] ["Show documentation for var" inf-clojure-show-var-documentation t] ["Show source for var" inf-clojure-show-var-source t] ["Apropos" inf-clojure-apropos t] "--" ["Clear REPL" inf-clojure-clear-repl-buffer] ["Restart" inf-clojure-restart] ["Quit" inf-clojure-quit] "--" ["Version" inf-clojure-display-version])))) map))
      eval-buffer(#<buffer  *load*-259097> nil "/home/arichiardi/.live-packs/ar-emacs-pack/lib/inf-clojure/inf-clojure.el" nil t)  ; Reading at buffer position 4462
      load-with-code-conversion("/home/arichiardi/.live-packs/ar-emacs-pack/lib/inf-clojure/inf-clojure.el" "/home/arichiardi/.live-packs/ar-emacs-pack/lib/inf-clojure/inf-clojure.el" nil t)
      #<subr require>(inf-clojure nil nil)
      ad-Advice-require(#<subr require> inf-clojure)
      apply(ad-Advice-require #<subr require> inf-clojure)
      require(inf-clojure)

So I decided to stick with the previous version. It would be great to have the same keybinding though. I need some hint on how to achieve that @bbatsov, I guess I need a prefix binding?

@bbatsov
Copy link
Member

bbatsov commented Jan 22, 2018

So I decided to stick with the previous version. It would be great to have the same keybinding though. I need some hint on how to achieve that @bbatsov, I guess I need a prefix binding?

Doc functions are in a separate keymap in CIDER, and it's bound under C-c (C)-d. Take a look at the source code there and you'll understand what I mean.

@arichiardi
Copy link
Contributor Author

Do you think we should unify also the other keys?

Probably either we use C-c C-d for all of them or we don't.

The function signature was broken, also update the docstring.
Broken because emacs interprets C-A as C-a. This patch also adds the same
key binding to inf-clojure-mode (in the REPL).
@arichiardi
Copy link
Contributor Author

If we want to keep this way, the PR is ready and probably should go in as is, then we decide if we want to move the key bindings to Cider's

@bbatsov bbatsov merged commit 62bb0fc into clojure-emacs:master Jan 22, 2018
@bbatsov
Copy link
Member

bbatsov commented Jan 22, 2018

Probably either we use C-c C-d for all of them or we don't.

Probably that would be best. I see I've chosen some rather random keybindings initially. :D

@arichiardi arichiardi deleted the fix-apropos branch January 22, 2018 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants