mirror of
				https://github.com/larstvei/Focus.git
				synced 2025-11-04 02:00:11 +00:00 
			
		
		
		
	Fixes #14
In `focus-read-only-mode` the `cursor-type` was unconditionally set to `t`, and did not restore the users customized cursor type. This is fixed by storing the original value of `cursor-type` in `focus-cursor-type`.
This commit is contained in:
		
							parent
							
								
									6add57b887
								
							
						
					
					
						commit
						155da77a32
					
				
							
								
								
									
										9
									
								
								focus.el
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								focus.el
									
									
									
									
									
								
							@ -70,6 +70,9 @@ Things that are defined include `symbol', `list', `sexp',
 | 
				
			|||||||
  :type '(float)
 | 
					  :type '(float)
 | 
				
			||||||
  :group 'focus)
 | 
					  :group 'focus)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defvar focus-cursor-type cursor-type
 | 
				
			||||||
 | 
					  "Used to restore the users `cursor-type'")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defvar focus-current-thing nil
 | 
					(defvar focus-current-thing nil
 | 
				
			||||||
  "Overrides the choice of thing dictated by `focus-mode-to-thing' if set.")
 | 
					  "Overrides the choice of thing dictated by `focus-mode-to-thing' if set.")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -236,7 +239,7 @@ This is added to the `pre-command-hook' when
 | 
				
			|||||||
  (when (and focus-read-only-mode
 | 
					  (when (and focus-read-only-mode
 | 
				
			||||||
             (not (member last-command '(focus-next-thing focus-prev-thing))))
 | 
					             (not (member last-command '(focus-next-thing focus-prev-thing))))
 | 
				
			||||||
    (when focus-read-only-blink-timer (cancel-timer focus-read-only-blink-timer))
 | 
					    (when focus-read-only-blink-timer (cancel-timer focus-read-only-blink-timer))
 | 
				
			||||||
    (setq cursor-type t)
 | 
					    (setq cursor-type focus-cursor-type)
 | 
				
			||||||
    (setq focus-read-only-blink-timer
 | 
					    (setq focus-read-only-blink-timer
 | 
				
			||||||
          (run-at-time focus-read-only-blink-seconds nil
 | 
					          (run-at-time focus-read-only-blink-seconds nil
 | 
				
			||||||
                       'focus-read-only-hide-cursor (current-buffer)))))
 | 
					                       'focus-read-only-hide-cursor (current-buffer)))))
 | 
				
			||||||
@ -256,7 +259,7 @@ Enables `read-only-mode', hides the cursor and adds
 | 
				
			|||||||
Disables `read-only-mode' and shows the cursor again. It cleans
 | 
					Disables `read-only-mode' and shows the cursor again. It cleans
 | 
				
			||||||
up the `focus-read-only-blink-timer' and hooks."
 | 
					up the `focus-read-only-blink-timer' and hooks."
 | 
				
			||||||
  (read-only-mode -1)
 | 
					  (read-only-mode -1)
 | 
				
			||||||
  (setq cursor-type t)
 | 
					  (setq cursor-type focus-cursor-type)
 | 
				
			||||||
  (when focus-read-only-blink-timer
 | 
					  (when focus-read-only-blink-timer
 | 
				
			||||||
    (cancel-timer focus-read-only-blink-timer))
 | 
					    (cancel-timer focus-read-only-blink-timer))
 | 
				
			||||||
  (setq focus-read-only-blink-timer nil)
 | 
					  (setq focus-read-only-blink-timer nil)
 | 
				
			||||||
@ -293,6 +296,8 @@ up the `focus-read-only-blink-timer' and hooks."
 | 
				
			|||||||
            (define-key map (kbd "i") 'turn-off-focus-read-only-mode)
 | 
					            (define-key map (kbd "i") 'turn-off-focus-read-only-mode)
 | 
				
			||||||
            (define-key map (kbd "q") 'turn-off-focus-read-only-mode)
 | 
					            (define-key map (kbd "q") 'turn-off-focus-read-only-mode)
 | 
				
			||||||
            map)
 | 
					            map)
 | 
				
			||||||
 | 
					  (when cursor-type
 | 
				
			||||||
 | 
					    (setq focus-cursor-type cursor-type))
 | 
				
			||||||
  (if focus-read-only-mode (focus-read-only-init) (focus-read-only-terminate)))
 | 
					  (if focus-read-only-mode (focus-read-only-init) (focus-read-only-terminate)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(provide 'focus)
 | 
					(provide 'focus)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user