jrblevin / deft Goto Github PK
View Code? Open in Web Editor NEWDeft for Emacs
Home Page: http://jblevins.org/projects/deft/
Deft for Emacs
Home Page: http://jblevins.org/projects/deft/
Is it possible to create all new notes in org-mode (with .org file extension) by default?
It would be sweet to use deft for writing markdown files for static sites.
The titles and other metadata for these files however are in Front Matter (YAML) rather than on the first line.
---
layout: post
title: Write Your Blog Using Deft!!!
---
Start of the post
...
For my particular use case, I'd like to create a template that defines the location for org-attach to be equal to the newly created file. Something like:
for 2019-11-22.org
When I set the deft-extensions
user option in my .emacs
init file as follows
(setq deft-extensions '("md" "txt"))
the deft-defaul-extension
variable still have the old value "txt"
at run time.
I think the deft-default-extension
variable should be set during Deft setup process, after evaluating user's settings.
I'd like for deft to open files in another window by default, instead of replacing the deft buffer. I didn't see immediately how this is possible reading the docs and issues. I'm not very good with elisp beyond editing config files and I'm about to dig into the deft code to see if I can figure this out, thought I'd ask on here as well.
Also, thank you so much for this app, I'm probably going to switch from Notational Velocity to deft in order to avoid switching out of spacemacs.
I know it's possible to use regxp to extract the summary. Is it possible to use regxp to parse the title from Dayone donentry(which is xml file)? Thanks.
Dr. Blevins, thanks for this awesome work!
I have been using Deft for quite a while, it is really fantastic for keeping notes. However I find it more convenient if I could keep my notes in separate places. I'm aware of the updated feature deft-recursive
, but still I may find supporting separate folders a good feature.
Proposed modification
Change deft-directory
. Instead of satisfying stringp
, we can make it a list, satisfying listp
.
Is this a reasonable feature? May I submit a PR on it or maybe you are already working on it?
Thanks
If I don't input anything to search, when I choose one file to open, deft will create an empty .org file automatically, which is not my wish.
environment:
but on ubuntu 14.04.1, this problem doesn't happen.
For those of us stuck on Windows: deft-new-file-format
contains a colon (:
), which causes the filename to be truncated, but emacs to report it as saved. Issuing a C-c C-c
in deft then "loses" the note.
Easy to workaround by setting deft-new-file-format
to "%Y-%m-%dT%H%M"
(omitting the colon) in customize
. But should the default be more windows-friendly? Maybe not!
Hi there
Great utility - many thanks. It would be very useful for me (where some of my .org files are quite long) to see what part of the text has been matched, with a little context. As far as I can tell, this isn't possible with the current options, but would make a very useful feature.
That is, instead of part of the first line, can we see where the match is?
Cheers
Ian
the docstring mentions deft-extension, which should be deft-default-extension.
So, I've noticed a weird problem with deft.
Some background and context. I'm in a situation where I'm dealing with hundreds of individual note files. Deft handles them like a champ when I limit the number of entries shown by the deft browser to something reasonable, and I've been impressed overall with how well it works. The below is my config:
(use-package deft :ensure t :config (setq deft-default-extension "org") (setq deft-file-limit 32) (setq deft-filter-only-filenames nil) (setq deft-recursive nil) :commands (deft) :bind ("<f8>" . deft) :init ) (add-hook 'deft-mode-hook (lambda () (setq display-line-numbers nil) ))
The problem is, if I kill the deft buffer and then re-open it, the length of time it hangs at "Deft initializing..." increases. On first load, it takes about half a second to initialize with 800 files in the deft directory. On second load, it's a little longer. On third load it's a second or two. On fourth load it's multiple seconds. And it just gets worse from there.
No idea what's causing it. It's really weird!
Can we have an option to set the deft-directory runtime ? a setting like deft-set-directory!
That way we can organize huge org files into their own directory structure and also speed up.
So if my emacs init contains deft-directory to be dir1, only contents from that would be listed.
I do a deft-set-directory to dir2, then contents from only dir2 will be processed. and I will not
see contents from dir1.
ws-butler is an emacs package to trim whitespace only of the lines edited by the user. It trims the whitespace 'unobtrusively' that is the file is cleaned up on the disk but the buffer still has the virtual whitespaces so that user is not interrupted with the cleanup (perhaps the project's README explains it better than me).
ws-butler
tries to preserve the point in the buffer by saving current column in before-save-hook
and after the whitespace is trimmed it moves to the column saved in the before-save-hook
. However this fails with deft's auto-save since the auto-save code is wrapped in a save-excursion
form which tries to restore the point back to the marker before the save, please note the marker is invalidated by ws-butler
when it removes associated text (trailing whitespace) so apparently the point is moved back to end of visible text after the form is executed (not sure this the desired behavior of save-excursion) which different from the column moved to by ws-butler.
For example consider the following (with point indicated by |
) before deft's auto-save
* Testing deft auto-save |
After the auto-save, with ws-butler
enabled, the point moves to end of visible text
* Testing deft auto-save|
As opposed to following with ws-butler
enabled and buffer saved by the user, where point remains at the position before save
* Testing deft auto-save |
I think the issue can be solved by not using save-excursion
because I do not see the need to save the point, deft might only need to save the current buffer which can be achieved with save-current-buffer
or with-current-buffer
forms. What do you think?
BTW thanks for this package!
The default value of deft-separator
takes a lot of space. Making deft-separator
variable a custom option would allow user to adjust it to his/her preference.
It is possible to be able to insert the image in a Deft note becuase image sometimes explains a lot.
One possible solution is write link inside the note view it inside a browser when you need it. (You may have to upload the image to the cloud)
The notes list is not aligned properly on emacs 26.1 and deft 0.8.
As of my understanding the deft-width-offset
variable was removed, right? What else could be the cause? Thank you.
Important to note: When I resize the window or refresh the buffer with "deft-refresh" it looks fine. But it happens again when you reopen the deft buffer.
Originally posted by @blackkenny in #16 (comment)
I've tried the following in my init.el
to change or disable the auto-save interval without success:
(setq deft-auto-save-interval 5.0)
(setq deft-auto-save-interval nil)
I'm running deft 0.7 in spacemacs, if that matters.
This is a suggestion. I usually work with the latest modified file so when I bring up Deft I have to move down two lines to the first file and press RET. How about removing the first two lines altogether and display the filter in the mode-line? Then the latest modified file would only be one RET away. I do not filter often and I think this would make sense, at least as an option if not as default.
I have deft installed with no customizations other than file types and directory. When the buffer opens and I start typing (no matter what the search string is) I constantly get deft-filter-match-file: Wrong type argument: stringp, nil
. This is emacs 24.5.1 on Mac.
deft 0.7, emacs 24.5.1
I have org autoloaded, and when I launch deft before org, I get the following backtrace:
Debugger entered--Lisp error: (void-function org-add-link-type)
(org-add-link-type "deft" (function (lambda (handle) (org-open-file-with-emacs (expand-file-name handle deft-directory)))))
eval-buffer(#<buffer load> nil "/Users/dharms/.emacs.d/plugins/deft.el" nil t) ; Reading at buffer position 67056
load-with-code-conversion("/Users/dharms/.emacs.d/plugins/deft.el" "/Users/dharms/.emacs.d/plugins/deft.el" nil t)
autoload-do-load((autoload "deft" nil t nil) deft)
command-execute(deft)
Howdy! I've been using Deft for a while now, and I've been thinking about some of the slowness that crops up with large numbers of notes.
The deft-file-limit
setting that was added recently has helped some, but I was wondering how hard it would be to implement an option to just do delimited searching rather than real-time incremental searching.
I ask, because according to the profiler, the vast majority of the slowdown I experience comes from deft-filter-increment
and deft-filter-decrement
/deft-filter-decrement-word
calls. The actual note browser is speedy and works great -- if I could just type my search, hit enter, and let the thing come back with a result in its own time, that'd be a lot less jarring from a user experience perspective. I don't mind hitting enter and waiting for a result, but it's kinda frustrating to have the whole thing freeze up in the middle of the word you're typing.
I just really want to commit to using the hell out of Deft, but the slowdown problem is only gonna get more noticeable as I add more notes.
Quick edit: Just to be clear, I'm aware of the C-c C-l
functionality, I just wish I could set the search bar to function that way directly.
I am trying to implement a zettlekasten-like system in emacs using deft and org-mode. I'm currently making a custom link type that allows for seeing all items that match that id rather than linking to a file directly. Put another way: I want a custom link type that has the effect of executing deft
with the contents of the link being the search string. I feel like I essentially understand how to create a custom link type, but calling deft
with an argument doesn't work. My code currently looks like this:
(org-add-link-type
"id" 'zettel/deft-search-link)
(defun zettel/deft-search-link (uid)
; "run deft, hopefully with uid as a search term"
; "FIXME: 'deft' does not take an argument. Figure out how to do this, ask the author?"
(deft uid))
My question then, is, is there a function within deft that I could be calling that does take an argument and opens a deft buffer (preferably in other window)? If not, is it easy to modify deft
to do so? Alternately, am I just going about this in a ridiculous way and there's already an easier solution?
Thanks!
If I use C-o
to open file in another window, then when I enter a file with RET
, the window created by C-o
is still present. Possible to change the behavior (or add as an option)? Usually I use C-o
just to browse through files, and after RET
a file, I expect the other window to be closed automatically.
It appears that despite the configuration, deft always saves files with .txt extension.
Running Windows 10 and GNU Emacs 26.0.90 (build 3, x86_64-w64-mingw32) of 2017-10-13. Can you help me escape the corporate windows hell with emacs? :)
My config below
;; notational velocity like package https://jblevins.org/projects/deft/
(use-package deft
:straight t)
;; setting default extensions for deft to search
(setq deft-text-mode 'org-mode)
(setq deft-directory "~/Dropbox/Oleg/Org/")
(setq deft-new-file-format "%Y-%m-%dT%H%M") ;; on windows files with ":"-symbol can't be saved, so this is editing format to save in a format without ":"
(setq deft-extensions '("org"))
;; making deft also search for files in subdirectories
(setq deft-recursive t)
(global-set-key [C-f12] 'deft)
I have some journal files to keep some notes with Emacs calendar ij
(the idea come from Abrams
, file name with the format, %Y%m%d, 20180724, without file extension.
So, what can I let deft to look for them? How to let deft find the file with the regex "\d{8}"
Here is my deft config:
(global-set-key (kbd "<f8>") 'deft)
(setq deft-use-filename-as-title t)
(setq deft-use-filter-string-for-filename t)
(setq deft-directory "/Users/jaan/Library/Application\sSupport/Notational\sData")
(setq deft-extension "txt")
; associate files in deft directory with org mode
(add-to-list 'auto-mode-alist '("/Users/jaan/Library/Application\sSupport/Notational\sData/.*[.]txt$" . org-mode))
This lets deft sync with Simplenote (via Notational Velocity and the nvAlt app) so I can access my notes from multiple devices, but lets me use org-mode to take notes on my laptop.
However, if I create a file with Simplenote (in the directory above) existing Deft sessions will not update and new files do not show up.
I need to kill the buffer and reopen Deft to see the latest files in the Deft directory.
It would be nice if Deft sessions checked for changes to the file list every second or minute.
Thanks for the package! I am using it to implement a Zettelkasten.
Is there a way to customize deft-open-file-other-window
or C-o
? The current behavior splits the window vertically. If I were to make a request for additional features, it would be for (1) a function that opens the note file in an existing other or target window without altering the existing window layout; and (2) a function very similar to deft-open-file-other-window
but which splits the window horizontally rather than vertically such that the note buffer appears below the Deft buffer.
Thanks again!
Thanks for deft I use it for all my notes!
I have a number of file types in my notes directory but I want deft to only look for .org files. The deft-extensions variable works as advertised to filter the results in the main deft index view, but the deft-find-file() function shows other file types like .md files that match the search string. Is that the intended behavior? Is there a variable to set to filter the deft-find-file() list also?
So, my deft config was as follows: I used deft-file-extension to set the extention to .org, and then used deft-text-mode to trigger a custom minor mode that marked org buffers launched via deft as special.
I used this to do two things: it let me set up a toggle that would kill or bury all deft buffers at once, and second, so that I could inhibit the hook that cleans trailing whitespace.
Without a non-file-extension way to mark deft buffers, I can't think of an easy way to replicate this functionality. Would there be general interest in a PR restoring deft-text-mode for explicit use of attaching a minor mode to deft buffers? Or, alternately, a new variable for same?
Calling org-store-link
in the Deft buffer returns an error:
user-error: No method for storing a link from this buffer
I am using the latest version of Deft in this repository, which includes commit #29.
I have Deft configured like this:
(use-package deft
:ensure t
:defer t
:bind ("H-n" . deft)
:config
(setq deft-directory "~/Dropbox/work/zettelkasten")
(setq deft-recursive t)
(setq deft-use-filename-as-title t)
(setq deft-use-filter-string-for-filename t)
(setq deft-default-extension "org")
(setq deft-extensions '("org" "md"))
(setq deft-text-mode 'org-mode)
(setq deft-auto-save-interval 0))
Thank you again for your work, Jason. I use Deft everyday.
Hi,
I've been using deft and markdown as my note-taking tool chain for like, half a year now . Now I have 40+ notes now and it works fine.
My concern is, if my notes grow up to 500+, will there be a performance issue? I'm not familiar with Lisp and I didn't see through your code. Hope you can give us a simple answer on this.
Thanks!
Qing
Hello, I use Deft in a work situation and sometimes my Deft page, which lists all titles and summary, are displayed to my group. Some of my pages contain data which is somewhat sensitive. I'd like to be able to turn off displaying the summary on the Deft page on a per-file basis. Possibly adding a header like this:
#+OPTIONS: exclude-summary
Before I embark on this, is this doable today with no changes to Deft?
If not, I think I can modify deft-parse-summary to skip adding the summary if the header/tag is found.
Thanks
I've been enjoying using deft a lot lately.
I happened to notice that deft searches match the full path of files in the deft directory. For example, if deft-directory
is ~/mydirectory/mynotes/
, then a search for mynotes
will match every note.
This seems to come from the line (insert file)
in deft-filter-match-file
. Using (insert (file-name-nondirectory file)
would make the search match only the base name of the file (along with the title and contents), of course.
If that seems like a sensible change, I'd be happy to make a pull request for it.
How would I go about getting deft to name files something like 2018-3-1-[custom title].txt?
Thanks!
Error Symbol's function definition is void: fringe-columns
.
Emacs 24.5.1 and deft a040f04
For the gpg encrypted files, e.g., foo.org.gpg, it is better if Deft has an option to hide their summaries. Also, this behavior can make gpg passphrase poped until the encrypted file is actively opened instead of everytime Deft is started.
First, @jrblevin thanks for a great utility!
I'm wonder what is the best way to run Deft and set the filter string programmatically?
I'm thinking about searching for word/hashtag/wikilink/selection under cursor in Deft notes much like Notational Velocity and nvALT do it for wikilinks.
Hello,
Thanks for all the hard work here, this is a wonderful package. One comment: I find it a bit easier to use deft in a smaller popup buffer, rather than have deft take over the entire window. AFAICT, forcing this to happen is usually done through modifying display-buffer-alist
-- e.g. in doom emacs, through set-popup-rule!
.
This doesn't work with deft as of now, as deft uses switch-to-buffer
rather than pop-to-buffer
. An easy fix is to define a new function:
(defun deft-popup ()
"Pop *Deft* buffer and load files."
(interactive)
(pop-to-buffer deft-buffer)
(if (not (eq major-mode 'deft-mode))
(deft-mode)))
but if there is no other reason for switch-to-buffer
over pop-to-buffer
, perhaps that should be the default instead?
If I have a trailing whitespace and the file is autosaved, the whitespace is often trimmed and the point moves back.
I believe ws-butler provides functionality to not move the point after blanks, but there is probably some combination of deft's auto-save and ws-butler causing it. You can see in the below gif it doesn't happen after my first *
, but after the **
, it does
#12 does not seem to help.
I want to search with Korean language in Deft. Though my Emacs input method indicates Korean language mode, all key inputs appear in English in Deft search line only. I don't know yet whether this problem is just my Emacs settings or related in Deft. Does Deft itself prevent users from inputting none English character in search line?
Hello,
I'm a big fan of deft, and through my years of use I have accumulated about 600 notes. Out of all those notes, most of them (400+) are ancient notes that I will never ever use in my life again. For example, I make quick notes all the time that I use once or twice and then they just rot there.
Having so many notes makes my deft home screen almost unuseable: it's very cluttered and also a bit slower to load.
What would be the right way to do notes housekeeping? I've been thinking that I could add a (deft-housekeeping
) command that deletes notes that haven't been read in over N months. So like, if I haven't opened a note for two years, it will delete it (or ask y/n to delete it).
Do you think such a thing would be useful, or in scope for deft? Or does it exist already?
Or should this be done as an emacs hook so that it's completely third party?
If this is not possible, how would you suggest I go around implementing this? (my elisp is subpar, but I can try)
On Emacs 24.4, the code for deft-file-naming-rules
breaks with Symbol's function definition is void
. Removing the slashes used to escape quotes fixes it.
(I don't know anything about Emacs, so I'm not submitted a PR. Not sure if this will break in previous versions...would be odd)
(setq deft-use-filter-string-for-filename t)
(setq deft-file-naming-rules '((noslash . "-")
(nospace . "-")
(case-fn . downcase)))
Background: For convoluted reasons (all my notes have the .txt extension so Notational Velocity and iOS Simplenote will display them, but they are in org format) I want to be able to change the major mode of each note buffer when it is opened by deft. This used to be possible with the deft-text-mode
var, but that was removed in d325df7 .
It seems like the deft-open-file-hook
hook should be perfect for this, but as it is run outside of the (with-current-buffer ...)
s-expr in deft-open-file
, any mode changes (e.g. calling (org-mode)
) don't actually apply to the newly opened note buffer.
Is that intentional? If not simply moving the run-hooks
call inside the (with-current-buffer ...)
block fixes the issue. I'm happy to submit a PR to that effect.
Thanks!
I am using org files to keep notes with
https://github.com/abo-abo/plain-org-wiki/blob/master/plain-org-wiki.el
As time goes by, the file is getting bigger and bigger, which bring a lot of duplication, also makes auto save and backup files big and cause a lot more extra disk io, not good for the hard drive. :-)
So I am thinking about a purely simple tag base system:
The search operation is simple too:
The tag manipulation is very simple:
This will break big notes files into smaller ones and does not affect the viewing thanks to org translusion. However, I only have a very limited knowledge of emacs. I am looking forward to hear your opinion and on how to bring the feature to this repo.
Thank you!
Hi Jason, fantastic product, thanks so much for putting this together.
I have a feature request; hoping for a way to search only by file name and not necessarily their content. I'm guessing that you're familiar with Merlin Mann's text file conventions so searching just by title would be a huge boon.
Thank you!
I add two small functions for journaling. This is quite useful for myself. I think it could be considered merged into `deft'.
I have over 1000 different files in my deft directory.
Over time, deft has started to feel very slow while filtering: there is a noticeable delay with every key press while filtering files.
My first assumption was that incremental search might be slow, but a little profiling revealed that most of the time is spent in these lines of the deft-buffer-setup
function:
(if deft-current-files
(progn
(mapc 'deft-file-widget deft-current-files))
(widget-insert (deft-no-files-message))))
I'm not sure if it's something wrong with my local emacs configuration: I'm running emacs-mac with font composition enabled via mac-auto-operator-composition-mode
. I haven't noticed a slowdown in any other modes though.
For now, I have locally edited this function to show the first 10 files from deft-current-files
. This fixes the problem for me โ typing / filtering feels realtime again, without any perceived delay.
I just wanted to report this. If anyone else has noticed a similar problem, I can provide a PR which will let you customise the total number of files displayed in deft.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.