mirror of
				https://github.com/larstvei/Focus.git
				synced 2025-11-04 02:00:11 +00:00 
			
		
		
		
	Improve org-mode support
This commit is contained in:
		
							parent
							
								
									28b7662f26
								
							
						
					
					
						commit
						6f7fbd3513
					
				
							
								
								
									
										16
									
								
								focus.el
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								focus.el
									
									
									
									
									
								
							@ -116,16 +116,20 @@ The timer calls `focus-read-only-hide-cursor' after
 | 
			
		||||
                        (apply #'derived-mode-p modes))))
 | 
			
		||||
        (if mode (cdr (assoc mode focus-mode-to-thing)) 'sentence))))
 | 
			
		||||
 | 
			
		||||
(defun focus-bounds ()
 | 
			
		||||
  "Return the current bounds, based on `focus-get-thing'."
 | 
			
		||||
  (or focus-pin-bounds
 | 
			
		||||
      (let ((thing (focus-get-thing)))
 | 
			
		||||
        (cond ((eq thing 'org-element)
 | 
			
		||||
(defun focus-org-element-bounds ()
 | 
			
		||||
  "Extract bounds from `org-element-at-point'"
 | 
			
		||||
  (let* ((elem (org-element-at-point))
 | 
			
		||||
         (beg (org-element-property :begin elem))
 | 
			
		||||
         (end (org-element-property :end elem)))
 | 
			
		||||
    (and beg end (cons beg end))))
 | 
			
		||||
              (t (bounds-of-thing-at-point thing))))))
 | 
			
		||||
 | 
			
		||||
(put 'org-element 'bounds-of-thing-at-point
 | 
			
		||||
     #'focus-org-element-bounds)
 | 
			
		||||
 | 
			
		||||
(defun focus-bounds ()
 | 
			
		||||
  "Return the current bounds, based on `focus-get-thing'."
 | 
			
		||||
  (or focus-pin-bounds
 | 
			
		||||
      (bounds-of-thing-at-point (focus-get-thing))))
 | 
			
		||||
 | 
			
		||||
(defun focus-window-bounds ()
 | 
			
		||||
  (cons (window-start) (window-end nil t)))
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user