phillord / lentic

Create views of the same content in two Emacs buffers
183 stars 12 forks source link

Setup with Spacemacs #44

Closed BorisKourt closed 8 years ago

BorisKourt commented 8 years ago

Hello Phil,

Thank you for making lentic, this is exactly what I have been looking for to write literate Clojure code.

I am having a bit of a setup roadblock, and I am aware that this is entirely my fault, but was wondering if you could point me in the right direction.

I am using Spacemacs (coming directly from vim) and am running a largely untouched configuration from them. I added and installed lentic through the way they recommended.

I followed the advice and cloned the lentic repository, opened lentic.el and answered y to the prompt. I don't see any warnings, but I can't continue from here. I am only seeing a single buffer, and C-c c just gives me a C-c c is undefined this must be due to a re-mapping from Spacemacs.

Whats the best way to check if lentic is installed correctly and is ready? Before I restart without Spacemacs entirely.

Best, Boris

phillord commented 8 years ago

Boris Kourtoukov notifications@github.com writes:

Thank you for making lentic, this is exactly what I have been looking for to write literate Clojure code.

I am having a bit of a setup roadblock, and I am aware that this is entirely my fault, but was wondering if you could point me in the right direction.

I am using Spacemacs (coming directly from vim) and am running a largely untouched configuration from them. I added and installed lentic through the way they recommended.

I've never used spacemacs, so can you tell me what is the way they recommend?

I followed the advice and cloned the lentic repository, opened lentic.el and answered y to the prompt. I don't see any warnings, but I can't continue from here. I am only seeing a single buffer, and C-c c just gives me a C-c c is undefined this must be due to a re-mapping from Spacemacs.

If you load "lentic.el" you will not get any keybindings as these are all provided in lentic-mode.el. If you install using M-x packages-install lentic, then all of this should happen automatically.

Whats the best way to check if lentic is installed correctly and is ready? Before I restart without Spacemacs entirely.

I've just given it a go in spacemacs (using M-x packages-install) and it seems to work, although you are correct that spacemacs kills the default keybindings.

M-x lentic-mode-create-new-view-in-selected-window

should open a new view. And opening "block-comment.clj" (from the lentic repo) followed by

M-x lentic-mode-create-from-init

should create a new buffer called "block-comment.tex" (which you have to change to) which then is "lentic" with block-comment.clj.

Not sure what to do about the keybindings, other than to ask the spacemacs people!

Phil

BorisKourt commented 8 years ago

Thanks so much for the detailed instructions. I've been trying them and trying to figure out whats the issue with my setup.

   ;; List of additional packages that will be installed without being
   ;; wrapped in a layer. If you need some configuration for these
   ;; packages then consider to create a layer, you can also put the
   ;; configuration in `dotspacemacs/config'.
   dotspacemacs-additional-packages '(lentic)

This is in the .spacemacs file, and how they suggest one installs additional packages. And by the looks of it, it pulled in Lentic correctly.

Do I need to do anything to configure lentic directly in the way they suggest in the comment?


M-x lentic-mode-create-new-view-in-selected-window

Doesn't appear to open a new window or buffer but the header for the window does change to lentic: lentic.el I say it doesn't appear to make a new window or buffer because if I list open windows or buffers there is only that one ( and various scratch/spacemacs ones.)

Buffers:

  * *lentic: lentic.el*   52341 Emacs-Lisp       
    lentic.el             52341 Emacs-Lisp       ~/Documents/sandbox/lentic/lentic.el
 %* *spacemacs*             709 Spacemacs buffer 
    *scratch*                 0 Text             
 %* *Messages*            10302 Messages         
  * *helm M-x*             2536 Helm             
  * *helm-descbinds*         41 Helm  

M-x lentic-mode-create-from-init

I tried running that anyway, and it gives me Already initialized.

Then I realized you meant that I should open block-comment.clj myself (I thought it was part of what happens with the first command) So I did that and ran the above command and then I get the following buffers:

    block-comment.clj       990 Clojure          ~/Documents/sandbox/lentic/examples/block-comment.clj
  * *lentic: lentic.el*   52341 Emacs-Lisp       
    lentic.el             52341 Emacs-Lisp       ~/Documents/sandbox/lentic/lentic.el
 %* *spacemacs*             709 Spacemacs buffer 
    *scratch*                 0 Text             
 %* *Messages*            18525 Messages         
  * block-comment.tex       915 LaTeX/MPS        ~/Documents/sandbox/lentic/examples/block-comment.tex
  * *lentic-log*             44 Fundamental      
  * *helm M-x*             2522 Helm             
  * *helm-descbinds*         41 Helm             

Does this mean everything is fine?

Visually I only see block-comment.clj in one window and lentic.el in another.

phillord commented 8 years ago

Boris Kourtoukov notifications@github.com writes:

Thanks so much for the detailed instructions. I've been trying them and trying to figure out whats the issue with my setup.

   ;; List of additional packages that will be installed without being
   ;; wrapped in a layer. If you need some configuration for these
   ;; packages then consider to create a layer, you can also put the
   ;; configuration in `dotspacemacs/config'.
   dotspacemacs-additional-packages '(lentic)

This is in the .spacemacs file, and how they suggest one installs additional packages. And by the looks of it, it pulled in Lentic correctly.

Do I need to do anything to configure lentic directly in the way they suggest in the comment?

Probably yes! AFAICT, the spacemacs vim key bindings are overlapping with the default ones I provide.

I don't really know how to do this, I'm afraid.

--- M-x lentic-mode-create-new-view-in-selected-window Doesn't appear to open a new window or buffer but the header for the window does change to lentic: lentic.el I say it doesn't appear to make a new window or buffer because if I list open windows or buffers there is only that one ( and various scratch/spacemacs ones.)

Yeah, that is it working. It's opened a new view (called "lentic: lentic.el"). This is a new buffer that has separate point/mark/overlays and everything, but should always show the same text.

M-x lentic-mode-create-from-init

I tried running that anyway, and it gives me Already initialized.

Then I realized you meant that I should open block-comment.clj myself (I thought it was part of what happens with the first command) So I did that and ran the above command and then I get the following buffers:

    block-comment.clj       990 Clojure          ~/Documents/sandbox/lentic/examples/block-comment.clj
  * *lentic: lentic.el*   52341 Emacs-Lisp       
    lentic.el             52341 Emacs-Lisp       ~/Documents/sandbox/lentic/lentic.el
 %* *spacemacs*             709 Spacemacs buffer 
    *scratch*                 0 Text             
 %* *Messages*            18525 Messages         
  * block-comment.tex       915 LaTeX/MPS        ~/Documents/sandbox/lentic/examples/block-comment.tex
  * *lentic-log*             44 Fundamental      
  * *helm M-x*             2522 Helm             
  * *helm-descbinds*         41 Helm             

Does this mean everything is fine?

Visually I only see block-comment.clj in one window and lentic.el in another.

So, yes, it's worked but the window display is not working as it should.

You have two lentic buffers here. Lentic.el and lentic: lentic.el contain identical text. Change one, and the other will change in the same way. All this gains you is independent point and mark. I think this will become a feature of lentic, but at the moment it's not that useful.

You also have block-comment.clj and block-comment.tex. These have somewhat different text -- one is valid clojure, one valid latex, but you should be able to change the words in either while maintaining these two syntaxes.

In the ideal world, you want to see block-comment.tex and block-comment.clj at the same time. M-x lentic-mode-show-all-lentic should do this (in a base emacs). Whether it works with spacemacs is a different question.

Phil

BorisKourt commented 8 years ago

Thanks for your help, I will close this and try figuring out the configuration.

vv111y commented 5 years ago

@BorisKourt Did you get this working correctly? I want to get this going asap. FYI I am putting together an outshine/outorg/navi layer, and I want to include this as well. I think we should be able to setup good keybindings, perhaps a hydra.

And thanks to @phillord, this is a great idea

BorisKourt commented 5 years ago

Unfortunately I don't think I did.