You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm willing to correct this issue in a pull request, in the mean time, I think it'd be better to have a a customizable file extension to create new files.
(defcustomxeft-default-file-extension".txt""The default file extension for new file creation.":type'string)
Also, this allows this to modify the following functions :
(defcustomxeft-filename-fn
(lambda (search-phrase)
(concat search-phrase xeft-default-file-extension))
"A function that takes the search phrase and returns a filename.":type'function)
And avoid the bug in xeft-create-note which was defaulting to asking for a text extension even though it was not the case. I also removed inserting the file name and create an empty buffer instead.
(defunxeft-create-note ()
"Create a new note with the current search phrase as the title."
(interactive)
(let* ((search-phrase (xeft--get-search-phrase))
(file-path (expand-file-name
(funcall xeft-filename-fn search-phrase)
xeft-directory))
(exists-p (file-exists-p file-path)))
;; If there is no match, create the file without confirmation,;; otherwise prompt for confirmation. NOTE: this is not DRY, but;; should be ok.
(when (or (search-forward"Press RET to create a new note"nilt)
;; changed here for the prompt
(y-or-n-p (format"Create file %s%s? " search-phrase xeft-default-file-extension)))
(find-file file-path)
;; changed here for new file creation
(unless exists-p
(write-region""nil file-path))
(run-hooks'xeft-find-file-hook))))
Cheers, thanks for the great package!
The text was updated successfully, but these errors were encountered:
Thanks. I applied all the changes you mentioned except for not inserting the search phrase when creating a new note. Why do you not want the title? It is not a good idea to remove the first line since xeft uses it as title when showing search results.
Because I mainly org files and not text files, which means it does not display the title on top of the description. I'm not really sure what would be optimal here, maybe displaying the file name? This is what I get for example for one entry :
Hi, I'm willing to correct this issue in a pull request, in the mean time, I think it'd be better to have a a customizable file extension to create new files.
Also, this allows this to modify the following functions :
And avoid the bug in
xeft-create-note
which was defaulting to asking for a text extension even though it was not the case. I also removed inserting the file name and create an empty buffer instead.Cheers, thanks for the great package!
The text was updated successfully, but these errors were encountered: