Add defgroup vterm-mgt for vterm-mgt
In the past I used `defconst` in many of my Elisp libraries where I should've used something like: ```elisp ;; some/path/to/some-lib.el (defgroup some-lib nil) (defcustom some-lib-setting nil :group 'some-lib) ``` When I encounter code that I should've structured this way, I'm cleaning it up to prefer this more idiomatic pattern.
This commit is contained in:
		
							parent
							
								
									b89d1f0a1f
								
							
						
					
					
						commit
						5cf6a0b23d
					
				
					 1 changed files with 9 additions and 4 deletions
				
			
		| 
						 | 
					@ -31,11 +31,16 @@
 | 
				
			||||||
;; Configuration
 | 
					;; Configuration
 | 
				
			||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 | 
					;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defconst vterm-mgt--instances (cycle-new)
 | 
					(defgroup vterm-mgt nil
 | 
				
			||||||
  "A cycle tracking all of my vterm instances.")
 | 
					  "Customization options for `vterm-mgt'.")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defcustom vterm-mgt-scroll-on-focus nil
 | 
					(defcustom vterm-mgt-scroll-on-focus nil
 | 
				
			||||||
  "When t, call `end-of-buffer' after focusing a vterm instance.")
 | 
					  "When t, call `end-of-buffer' after focusing a vterm instance."
 | 
				
			||||||
 | 
					  :type '(boolean)
 | 
				
			||||||
 | 
					  :group 'vterm-mgt)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defconst vterm-mgt--instances (cycle-new)
 | 
				
			||||||
 | 
					  "A cycle tracking all of my vterm instances.")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun vterm-mgt--instance? (b)
 | 
					(defun vterm-mgt--instance? (b)
 | 
				
			||||||
  "Return t if the buffer B is a vterm instance."
 | 
					  "Return t if the buffer B is a vterm instance."
 | 
				
			||||||
| 
						 | 
					@ -113,7 +118,7 @@ This function should be called from a buffer running vterm."
 | 
				
			||||||
 | 
					
 | 
				
			||||||
If for whatever reason, the state of `vterm-mgt--instances' is corrupted and
 | 
					If for whatever reason, the state of `vterm-mgt--instances' is corrupted and
 | 
				
			||||||
  misaligns with the state of vterm buffers in Emacs, use this function to
 | 
					  misaligns with the state of vterm buffers in Emacs, use this function to
 | 
				
			||||||
  attempt to restore the state."
 | 
					  restore the state."
 | 
				
			||||||
  (interactive)
 | 
					  (interactive)
 | 
				
			||||||
  (setq vterm-mgt--instances
 | 
					  (setq vterm-mgt--instances
 | 
				
			||||||
        (->> (buffer-list)
 | 
					        (->> (buffer-list)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue