Comments (18)
For what it's worth I just use [[]]
and have no problem. Any finds everything with a [[
fine:
(defun zd-avy-link-search ()
"Call on avy to jump and search link ids indicated with [[.
Opens immediately if there is only one result."
(interactive)
(save-excursion
(avy-goto-char-2 ?\[?\[)
(zd-search-global (zd-lift-id (zd-get-thing-at-point)))))
though I'm also just working in markdown. But I don't see why this would be a problem in org as well, unless you're doing a lot of other linking?
from zetteldeft.
That's a good suggestion to make the package more universally usable.
I'll have to look into it, but it should be possible, although zd-avy-link-search
would indeed be affected.
EDIT: Another issue would be the fontification. Currently, §
type IDs are easily detected. I'd have to think of an alternative way of highlighting links.
from zetteldeft.
For the record, since I never used § links, I did not even know you highlighted links, so I would not miss that feature :)
from zetteldeft.
Would it make sense to just define a link as anything within [[]]
? or is that too limiting?
from zetteldeft.
I've made some adjustments so that you can change the §
if you like. Do so by changing the zd-link-indicator
variable. You should also be able to set it to nil
.
Take a look at the changes in this commit.
Make sure to (setq zd-link-indicator nil)
before loading zetteldeft.
I hope I didn't break anything else!
How does this work in The Archive? Are links always included in [[
? I haven't chosen that option, because of potential clashes with the way org-mode handles links.
from zetteldeft.
I've made some adjustments so that you can change the
§
if you like. Do so by changing thezd-link-indicator
variable. You should also be able to set it tonil
.
Cool, I'll take a look when I have some time to play with it. Thanks!
How does this work in The Archive? Are links always included in
[[
? I haven't chosen that option, because of potential clashes with the way org-mode handles links.
The Archive always uses [[]]
for links. I don't know that it's the optimal solution, because org sees that as a link to a header in the file, and asks if I want to create the header every time I accidentally activate one.
from zetteldeft.
I just updated, but I can't test this yet because #6 means that I can't actually do searches. I mention it here just in case the two are related.
from zetteldeft.
@mediapathic I can't seem to replicate the issue. With zd-link-indicator
set to nil
, I'm still able to do actions like zd-copy-id-current-file
and zd-find-file-id-insert
.
Could you share your deft
and zetteldeft
setup?
from zetteldeft.
Hey, sorry about the delay. I include the relevant lines from my .init, but there's really nothing particularly weird that I see here. I have just realized that I'm setting my deft-extensions twice, and that is dumb, but I doubt it's relevant.
However, in looking through the customize options and the way they write to the customize block in my init, I note:
` '(zd-link-indicator "nil")
Which I think means that it's reading "nil" as a literal string. I can't figure out how to set it to actually nil
. In customize I've tried nil
, 'nil
, and just deleting the string, but it always seems to be interpreted literally and thus searches return that string instead of what it should be. Can you ELI5 how to actually make that nil?
Just in case, here's my init details:
;;;; deft ;;
(setq deft-extensions '("md" "org" "txt"))
(use-package deft
; :bind ("<f8>" . deft)
:commands (deft)
:config (setq deft-directory "~/Dropbox/Writing/Zettel/org/org-zettel"
deft-extensions '("md" "org" "txt")
deft-recursive nil
deft-use-filename-as-title t
deft-use-filter-string-for-filename t
deft-default-extension "md"
deft-auto-save-interval 10.0
)
)
;;;; Zetteldeft
(use-package zetteldeft
:quelpa (zetteldeft :fetcher git :url "https://github.com/EFLS/zetteldeft.git")
:ensure t)
from zetteldeft.
You should use (setq zd-link-indicator nil)
to set it to nil (no quotes or anything). The problem with your line, I'd guess, is that it doesn't include setq
.
You could add that line to the :config
part of your use-package zetteldeft
setup.
To just execute the setq
line, move to the closing bracket and hit C-x C-e
.
Finally, to see whether that worked, you can hit C-h v
zd-link-indicator
to check its value.
As an aside, there are many good introductions to elisp
. This one by Barry Schwartz, for example, might be of help to grasp the basics: https://harryrschwartz.com/2014/04/08/an-introduction-to-emacs-lisp.html
from zetteldeft.
You should use
(setq zd-link-indicator nil)
to set it to nil (no quotes or anything). The problem with your line, I'd guess, is that it doesn't includesetq
.
I was unclear: that line is part of the auto-generated customize block, so it is already implicitly part of a setq
statement. I just copied and pasted the line in isolation for clarity. What I was asking was, in the Customize interface, is the correct thing to set the field to nil
or just leave it blank. I suppose in my case that doesn't matter if I'm setting it in use-package but just to note this may be unclear to future users.
Finally, to see whether that worked, you can hit
C-h v
zd-link-indicator
to check its value.
When I eval (setq zd-link-indicator nil)
and check that variable, it is indeed set to nil, so I guess that's not the issue, sorry about the red herring.
But, nonetheless, ids are still not working. zd-find-file-id-insert
inserts nothing, zd-copy-id-current-file
copies nothing.
Any other thoughts of avenues to explore?
from zetteldeft.
Very strange. I can't reproduce it, and don't really have much to go on.
Nothing else in your custom block that maybe interferes with zetteldeft?
And what about other functions? Could you report the following for me:
- what happens when you run
zd-find-file
? Andzd-find-file-full-title-insert
? Are those two (some of the most basic functions) working at least? - what the value is of variables
zd-id-regex
andzd-id-format
?
Finally (or maybe test this first), what is the result when you evaluate the following code?
(zd-lift-id "2018-11-09-1934 This is a test title")
I'm not really experienced in tracing bugs, so guessing a little here on how we could see what's going on behind the scenes.
from zetteldeft.
Very strange. I can't reproduce it, and don't really have much to go on.
Nothing else in your custom block that maybe interferes with zetteldeft?And what about other functions? Could you report the following for me:
- what happens when you run
zd-find-file
? Andzd-find-file-full-title-insert
? Are those two (some of the most basic functions) working at least?
These work as expected. I get a helm search with all my zk, the first opens the file, the second inserts the title.
- what the value is of variables
zd-id-regex
zd-id-regex is a variable defined in ‘zetteldeft.el’.
Its value is "[0-9]\{4\}\(-[0-9]\{2,\}\)\{3\}"
and
zd-id-format
?
zd-id-format is a variable defined in ‘zetteldeft.el’.
Its value is "%Y%m%d%H%M"
Original value was "%Y-%m-%d-%H%M"
I don't read regex very well, but is that regex trying to pick up ids with dashes in them? If so, this would be odd, because searches with the non-dash id used to work.
Finally (or maybe test this first), what is the result when you evaluate the following code?
(zd-lift-id "2018-11-09-1934 This is a test title")
I see no result from evaluating that.
I'm not really experienced in tracing bugs, so guessing a little here on how we could see what's going on behind the scenes.
I appreciate your continuing effort! I hope it will turn out that this is an actual problem I am helping you solve and not just a mistake on my part.
from zetteldeft.
Ah I see what's happening. Setting the value of zd-id-format
is disrupting the id
functions.
In the documentation of the variable, I explain:
Be warned: the regexp to find these IDs is set separately.
I should update the documentation, because now it is severely lacking.
Anyway, you should update the zd-id-regex
so that it can find your customized IDs. Try the following:
(setq zd-id-regex "[0-9]\\{4\\}\\([0-9]\\{2,\\}\\)\\{3\\}")
from zetteldeft.
So close! That was definitely the issue, because the id functions work now. However, I think the regex is wrong, because it is consistently chopping off the first part of the id. So, for example,
201901231754 BOOK - Delaney On Writing
becomes
1901231754
ie, chopping off the leading "20". This seems to be a consistent pattern in the sparse couple of files I've tested with.
from zetteldeft.
Okay, so we have at least identified the cause.
I don't know why I suggested that terrible regex in my earlier reply (lack of time, I guess), because it could be much simpler. Since your IDs consists of 12 digits, it could be as easy as setting it to that. To make it a little more strict, however, I suggest the following:
(setq zd-id-regex "20[0-9]\\{10\\}")
Now it will only detect a sequence of 20
followed by 10 other digits.
Let me know if it works. I'll update the documentation of zd-id-format
to include a note that users have to configure the regex as well.
from zetteldeft.
Fantastic! That seems to work great. Thank you so much!
I would recommend for documentation including this particular regex as an example at least, as I suspect most people who want to change their id style will want to change it to this, which I believe is currently the most popular style.
Again, thank you for all the support.
from zetteldeft.
Great to hear that it works now. I updated the documentation to make things more clear.
from zetteldeft.
Related Issues (20)
- Error in zetteldeft-new-file-and-backlink and update the function HOT 2
- Deft doesn't strip #+STARTUP options at the beginning of note from title HOT 4
- FeatureRequest: Inform about dead link when `C-c d f` HOT 4
- Question: Batch rename tags on all related zettels HOT 1
- Which special characters can be used to distinguish special tags? HOT 3
- Question: What is a backlink HOT 1
- FeatureRequest: Handle special characters in zettels filenames HOT 7
- zetteldeft-find-file behave different HOT 1
- FeatureRequest: create new note in a sub-directory HOT 1
- zetteldeft-full-search-find-file: possibility to see results as we type keywords? HOT 3
- Org-capture via org-protocol to create notes directly from the browser HOT 2
- Right hand side back-links window HOT 3
- zetteldeft-find-file not using follow mode HOT 5
- Strange line break HOT 2
- Sorting of files in zetteldeft-find-file HOT 2
- Add a function analogous to zetteldeft-insert-link-{zd,org}-style but for markdown
- make the function to extract a title from a note customizable
- shouldn't zetteldeft--check return nonnil or nil rather than signalling an error? HOT 1
- Incompatibility with Org 9.5.5? HOT 3
- Is this expected behavior for dynamic blocks? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zetteldeft.