mirror of
				https://github.com/larstvei/dot-emacs.git
				synced 2025-11-04 01:20:11 +00:00 
			
		
		
		
	Add setup for webdev
And add some notes on tree-sitter and eglot.
This commit is contained in:
		
							parent
							
								
									9c513cea10
								
							
						
					
					
						commit
						bce50846fa
					
				
							
								
								
									
										42
									
								
								init.org
									
									
									
									
									
								
							
							
						
						
									
										42
									
								
								init.org
									
									
									
									
									
								
							@ -886,6 +886,15 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
* Mode specific
 | 
					* Mode specific
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					** Eglot
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   I am using [[https://joaotavora.github.io/eglot/][eglot]], which is built in from [[https://git.savannah.gnu.org/cgit/emacs.git/tree/etc/NEWS?h=emacs-29#n3273][emacs 29.1]]. Some performance issues
 | 
				
			||||||
 | 
					   led me to set =eglot-events-buffer-size= to 0.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   #+begin_src emacs-lisp
 | 
				
			||||||
 | 
					   (setq eglot-events-buffer-size 0)
 | 
				
			||||||
 | 
					   #+end_src
 | 
				
			||||||
 | 
					
 | 
				
			||||||
** Compilation
 | 
					** Compilation
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   I often run ~latexmk -pdf -pvc~ in a compilation buffer, which recompiles
 | 
					   I often run ~latexmk -pdf -pvc~ in a compilation buffer, which recompiles
 | 
				
			||||||
@ -1233,6 +1242,39 @@
 | 
				
			|||||||
   (add-hook 'go-mode-hook 'eglot-ensure)
 | 
					   (add-hook 'go-mode-hook 'eglot-ensure)
 | 
				
			||||||
   #+end_src
 | 
					   #+end_src
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					** Webdev
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   My webdev setup isn't much, but with eglot, I don't find myself missing
 | 
				
			||||||
 | 
					   much. It depends on [[https://tree-sitter.github.io/tree-sitter/][Tree-sitter]], which was added in [[https://git.savannah.gnu.org/cgit/emacs.git/tree/etc/NEWS?h=emacs-29#n36][emacs 29.1]].
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   The following is what I use for plain Javascript:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   #+begin_src emacs-lisp
 | 
				
			||||||
 | 
					   (add-to-list 'auto-mode-alist '("\\.jsx?\\'" . js-ts-mode))
 | 
				
			||||||
 | 
					   (add-hook 'js-ts-mode-hook 'eglot-ensure)
 | 
				
			||||||
 | 
					   #+end_src
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   Similarly for Typescript:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   #+begin_src emacs-lisp
 | 
				
			||||||
 | 
					   (add-to-list 'auto-mode-alist '("\\.tsx?\\'" . tsx-ts-mode))
 | 
				
			||||||
 | 
					   (add-hook 'tsx-ts-mode-hook 'eglot-ensure)
 | 
				
			||||||
 | 
					   (setq typescript-ts-mode-indent-offset 4)
 | 
				
			||||||
 | 
					   #+end_src
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   I am using [[https://svelte.dev][Svelte]] for some projects, where I find [[https://web-mode.org][web-mode]] along with the
 | 
				
			||||||
 | 
					   [[https://github.com/sveltejs/language-tools][Svelte Language Server]] to work well.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   #+begin_src emacs-lisp
 | 
				
			||||||
 | 
					   (add-to-list 'auto-mode-alist '("\\.svelte\\'" . web-mode))
 | 
				
			||||||
 | 
					   (add-hook 'web-mode-hook 'eglot-ensure)
 | 
				
			||||||
 | 
					   (with-eval-after-load "web-mode"
 | 
				
			||||||
 | 
					     (add-to-list 'web-mode-engines-alist '("svelte" . "\\.svelte\\'")))
 | 
				
			||||||
 | 
					   (with-eval-after-load "eglot"
 | 
				
			||||||
 | 
					     (add-to-list 'eglot-server-programs
 | 
				
			||||||
 | 
					                  '(web-mode . ("svelteserver" "--stdio"))))
 | 
				
			||||||
 | 
					   #+end_src
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* Key bindings
 | 
					* Key bindings
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Inspired by [[http://stackoverflow.com/questions/683425/globally-override-key-binding-in-emacs][this StackOverflow post]] I keep a =custom-bindings-map= that
 | 
					  Inspired by [[http://stackoverflow.com/questions/683425/globally-override-key-binding-in-emacs][this StackOverflow post]] I keep a =custom-bindings-map= that
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user