mirror of
				https://github.com/larstvei/Focus.git
				synced 2025-11-04 02:00:11 +00:00 
			
		
		
		
	Add functions to pin/unpin the focused section
This commit is contained in:
		
							parent
							
								
									f310fa1c31
								
							
						
					
					
						commit
						abad47f1c4
					
				
							
								
								
									
										15
									
								
								focus.el
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								focus.el
									
									
									
									
									
								
							@ -196,6 +196,21 @@ default is overwritten. This function simply helps set the
 | 
				
			|||||||
         (thing (completing-read "Thing: " candidates)))
 | 
					         (thing (completing-read "Thing: " candidates)))
 | 
				
			||||||
    (setq focus-current-thing (intern thing))))
 | 
					    (setq focus-current-thing (intern thing))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun focus-pin ()
 | 
				
			||||||
 | 
					  "Pin the focused section to its current location or the region,
 | 
				
			||||||
 | 
					if active."
 | 
				
			||||||
 | 
					  (interactive)
 | 
				
			||||||
 | 
					  (when focus-mode
 | 
				
			||||||
 | 
					    (when (region-active-p)
 | 
				
			||||||
 | 
					      (focus-move-overlays (region-beginning) (region-end)))
 | 
				
			||||||
 | 
					   (remove-hook 'post-command-hook 'focus-move-focus t)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun focus-unpin ()
 | 
				
			||||||
 | 
					  "Unpin the focused section."
 | 
				
			||||||
 | 
					  (interactive)
 | 
				
			||||||
 | 
					  (when focus-mode
 | 
				
			||||||
 | 
					    (add-hook 'post-command-hook 'focus-move-focus nil t)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun focus-next-thing (&optional n)
 | 
					(defun focus-next-thing (&optional n)
 | 
				
			||||||
  "Moves the point to the middle of the Nth next thing."
 | 
					  "Moves the point to the middle of the Nth next thing."
 | 
				
			||||||
  (interactive "p")
 | 
					  (interactive "p")
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user