Closed prtkm closed 8 years ago
I think that's probably Lispy, though I don't know much about it. I mentioned it in a previous issue.
Does that happen only when editing lisp code? If so, it is lispy, and why in the world would you do such a thing ;)
John
Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu
On Tue, Aug 23, 2016 at 3:11 PM, Devon Walker notifications@github.com wrote:
I think that's probably Lispy https://github.com/abo-abo/lispy, though I don't know much about it. I mentioned it in a previous issue https://github.com/jkitchin/scimax/issues/14.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jkitchin/scimax/issues/15#issuecomment-241844047, or mute the thread https://github.com/notifications/unsubscribe-auth/ABiRViLMtEyUtHFDhUf2EuY-tZw89OuEks5qi0XegaJpZM4JrPcy .
I don't want to disable it, but of course I ended up finding a way to break it! While copying over some old personalization code from jmax, I ended up having unbalanced parentheses.
I couldn't find an elegant way around it in lispy-mode, and had to add a comment line, then add closing parentheses, then remove the comments!
The best way to fix it is C-q ). That "quotes" the character you want to insert. Before I learned that, I used copy and paste ;)
Also, it is super nice to put your cursor on an opening (, and press n to copy the whole sexp. Then you can paste it elsewhere. or press q and get an avy jump to opening paren in the sexp.
see https://github.com/abo-abo/lispy#introduction
John
Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu
On Tue, Aug 23, 2016 at 3:22 PM, Prateek Mehta notifications@github.com wrote:
I don't want to disable it, but of course I ended up finding a way to break it! While copying over some old personalization code from jmax, I ended up having unbalanced parentheses.
I couldn't find an elegant way around it in lispy-mode, and had to add a comment line, then add closing parentheses, then remove the comments!
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jkitchin/scimax/issues/15#issuecomment-241847214, or mute the thread https://github.com/notifications/unsubscribe-auth/ABiRVlLDJOnxIRIq4vAv6lOXcli8Djmnks5qi0iOgaJpZM4JrPcy .
Fancy! Those seem to work great :).
It is fair to say lispy has made me love programming again ;) but worse, to dislike languages where I can't use lispy. Try using [ and ] to navigate the parens....
Any caveats if I simply turn on lispy-mode in a py or org file?
I don't think it does anything in org-mode. I haven't had a lot of experience with it in Python, but it supposedly has some support for it. I think it puts some non-standard looking spaces in python, so I rarely use it for python. see the end of this section: https://github.com/abo-abo/lispy#ide-like-features for some ideas of what could be done. We usually do it all in org-mode.
John
Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu
On Tue, Aug 23, 2016 at 3:42 PM, Prateek Mehta notifications@github.com wrote:
Any caveats if I simply turn on lispy-mode in a py or org file?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jkitchin/scimax/issues/15#issuecomment-241852616, or mute the thread https://github.com/notifications/unsubscribe-auth/ABiRVssnfozJfCKODrPxBUr7xbV4GL65ks5qi00mgaJpZM4JrPcy .
Ok great! I'll refrain from playing around with it in python then....
Unlrelated, your src code face colors don't go well with my dark theme ;) (https://github.com/jkitchin/scimax/blob/master/scimax-org.el#L463)
Any caveats if I simply turn on lispy-mode in a py or org file?
Lispy is derived from vi and is works well with lisp. If you want similar functionality across all file types, the vi command set is available with the Evil package. However, it is quite different in many ways and learning to use it may be better left a hobby in the short term.
@prtkm M-x customize-face ;)
Time to set everything to gray20! One more question, which face/group do I need to customize to get a non-monospace font when I'm writing prose in org-mode, while still keeping monospaced text in code blocks?
This seems to have worked on my Mac.
You can set properties like this for your default font (see [[id:F7A8790F-383C-4F97-BB6B-69BDBBA5CE22][List of fonts]]).
(set-face-attribute 'default nil :font "Times New Roman"))
And then you can also change the font in src blocks, including the color, like this:
(set-face-attribute 'org-block-python nil :background "gray80" :font "Menlo") (set-face-attribute 'org-block-emacs-lisp nil :background "gray80" :font "Menlo") (set-face-attribute 'org-table nil :font "Menlo")
\ List of fonts :PROPERTIES: :ID: F7A8790F-383C-4F97-BB6B-69BDBBA5CE22 :END:
Run this to see what fonts are available:
(print (font-family-list))
This is amazing! Something I always wanted in emacs :). Thanks!
Just realized that running your example above would change the default font for all modes, and not just org-mode, which would mean a non-monospaced font for things like python mode, etc. Probably need to have an if statement that changes the font only for org mode...
Probably just a hook will do it. See the org-mode-hook variable.
On Wednesday, August 24, 2016, Prateek Mehta notifications@github.com wrote:
Just realized that running your example above would change the default font for all modes, and not just org-mode, which would mean a non-monospaced font for things like python mode, etc. Probably need to have an if statement that changes the font only for org mode...
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jkitchin/scimax/issues/15#issuecomment-242193061, or mute the thread https://github.com/notifications/unsubscribe-auth/ABiRVhOM4824s4VmJInUAFhzwWQKQgzLks5qjKXzgaJpZM4JrPcy .
John
Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu
I think I'll add a hook. There's this other thing called variable-pitch-mode that allows you to switch between fixed and variable width fonts
On second thought, I'm not sure if a hook would work right with the code you added though. If I'm not mistaken, it would change the fonts upon entering org-mode, but for all buffers. Ideally I'd want to change the fonts only for the org buffer.
So this seems to work:
(defun set-org-mode-fonts () "Set prose font to a variable width (proportional) font, keep code blocks monospaced" (interactive) (setq buffer-face-mode-face '(:family "Calibri")) (buffer-face-mode) (set-face-attribute 'org-block-python nil :background "gray20" :font "Consolas") (set-face-attribute 'org-block-emacs-lisp nil :background "gray20" :font "Consolas") (set-face-attribute 'org-table nil :font "Consolas") )
(add-hook 'org-mode-hook 'set-org-mode-fonts)
Also, new tools to deal with light/dark themes :)
(defun turn-off-lights () (interactive) (mapc 'disable-theme custom-enabled-themes) (load-theme 'tangotango t) (sml/apply-theme 'respectful) (set-face-attribute 'org-block-python nil :background "gray20") (set-face-attribute 'org-block-emacs-lisp nil :background "gray20") (set-face-attribute 'org-block-sh nil :background "gray20") (set-face-attribute 'org-block-ipython nil :background "gray20") (set-face-attribute 'org-block-jupyter-hy nil :background "gray20") )
(defun turn-on-lights () (interactive) (mapc 'disable-theme custom-enabled-themes) (load-theme 'leuven t) (sml/apply-theme 'light) (set-face-attribute 'org-block-python nil :background "DarkSeaGreen1") (set-face-attribute 'org-block-emacs-lisp nil :background "LightCyan1") (set-face-attribute 'org-block-sh nil :background "gray90") (set-face-attribute 'org-block-ipython nil :background "thistle1") (set-face-attribute 'org-block-jupyter-hy nil :background "gray90") )
Hi John,
While the autopairing of parentheses, quotes, etc is nice, I've noticed that if you delete the closing parentheses or quote, it seems to delete everything within the quote or the parentheses. Can you tell me which function/mode controls the pairing in the init files so I can learn more about how it works?