refactor(wpcarro/emacs): Prefer simpler project-find-file
This version better interacts with google3. Change-Id: Ib65618dbdc7d76a27479a4e0cfc52c079537dc64 Reviewed-on: https://cl.tvl.fyi/c/depot/+/4808 Tested-by: BuildkiteCI Reviewed-by: wpcarro <wpcarro@gmail.com> Autosubmit: wpcarro <wpcarro@gmail.com>
This commit is contained in:
		
							parent
							
								
									c022f2ba2e
								
							
						
					
					
						commit
						7c3fef10d9
					
				
					 1 changed files with 4 additions and 15 deletions
				
			
		|  | @ -34,22 +34,11 @@ | |||
| 
 | ||||
| (cl-defstruct bookmark label path kbd) | ||||
| 
 | ||||
| ;; TODO: Consider hosting this function somewhere other than here, since it | ||||
| ;; feels useful above of the context of bookmarks. | ||||
| ;; TODO: Assess whether it'd be better to use the existing function: | ||||
| ;; `counsel-projectile-switch-project-action'.  See the noise I made on GH for | ||||
| ;; more context: https://github.com/ericdanan/counsel-projectile/issues/137 | ||||
| 
 | ||||
| (defun bookmark-handle-directory-dwim (path) | ||||
|   "Open PATH as either a project directory or a regular directory. | ||||
| If PATH is `projectile-project-p', open with `counsel-projectile-find-file'. | ||||
| Otherwise, open with `counsel-find-file'." | ||||
|   (if (projectile-project-p path) | ||||
|       (with-temp-buffer | ||||
|         (cd (projectile-project-p path)) | ||||
|         (call-interactively #'counsel-projectile-find-file)) | ||||
|     (let ((ivy-extra-directories nil)) | ||||
|       (counsel-find-file path)))) | ||||
|   "Open PATH as either a project directory or a regular directory." | ||||
|   (with-temp-buffer | ||||
|     (cd path) | ||||
|     (call-interactively #'project-find-file))) | ||||
| 
 | ||||
| (defconst bookmark-handle-directory #'bookmark-handle-directory-dwim | ||||
|   "Function to call when a bookmark points to a directory.") | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue