licht1stein / obsidian.el Goto Github PK
View Code? Open in Web Editor NEWObsidian Notes for Emacs
License: GNU General Public License v3.0
Obsidian Notes for Emacs
License: GNU General Public License v3.0
Love the idea of this package!
I have about 5000 files and I'm seeing a delay of a few seconds whenever I open a file in my Obsidian path, or callobsidian-jump
, obsidian-backlink-jump
, etc. I'm using a pretty much out of box Doom config. Files within my obsidian directory open quickly when obsidian.el isn't configured.
Is this expected? Anything I can do to help debug?
When using obisidian.el, a common workflow for me is to use obsidian-capture
to create a new note. This note will be placed in the directory specified by obsidian-inbox-directory
, so I'll often want to move that to a different location for which I use obsidian-move-file
. But I have a couple of questions about this workflow.
After I create the new note using obsidian-capture
, it is not available via obsidian-insert-link
unless I restart emacs. I've tried running obsidian-update
to see if that would allow the new file to be seen by obsidian-insert-link
, but it doesn't. Is this the intended behavior, or should the new note be available for linking as soon as it is created? If so, do I need to change my workflow somehow in order to allow for this functionality?
I often don't want files to live in the obsidian-inbox-directory
so I'll eventually move them to somewhere more permanent. However, I may have already linked to them before I move them. So I was wondering if the obsidian-move-file
function does anything special to update links in other files that link to the file being moved, or should I be moving files to their final location before creating links to them to avoid breaking links?
I hope this is the proper forum for these questions. Thanks for the great work and the great tool!
Obsidian has templates, it would be nice in obsidian.el, too
I have an implementation for daily note templates here
This commit is not perfect, after visiting the daily note the second time the buffer-size
is void. I must fix that part.
I haven't looked deeply into the code, but I just did a fresh install of obsidian.el from MELPA. Following a wikilink to an not-yet-existing file (one of the first things I tried) failed because it couldn't find f-mkdir-full-path
, a function from f.el.
I did not have f.el installed; after installing it from MELPA things worked fine.
I have the following file structure
zettelkasten/
├─ mocs/
│ ├─ moc_test.md
├─ index.md
index.md:
[[moc_test]]
when i use obsidian-follow-link-at-point
on index.md
to go to moc_test.md
, it creates a new file on zettelkasten
folder, instead go to mocs/moc_test.md
when i change
index.md:
[[moc_test]]
to
index.md:
[[mocs/moc_test]]
it works, but..
What if at some point, I decide to change my file location, will I have to update the path of this file everywhere?
Your package depends on Company. But there are other completion UIs like Corfu, Auto Complete, and obviously the minibuffer. Please don't depend on Company. I don't think it is necessary to depend on Company just because you define a Company backend, because there is a package named Cape which can convert Company backend function to CAPF (Completion at point function), allowing other completion UIs to use the completion function.
Here is the patch: (I tried to create a pull request, but failed to push to my fork)
From c22227a8d7946b966eb3161cfa2a7a78bf7db215 Mon Sep 17 00:00:00 2001
From: Akib Azmain Turja <[email protected]>
Date: Tue, 9 Aug 2022 22:44:43 +0600
Subject: [PATCH] Don't depend on Company
---
obsidian.el | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/obsidian.el b/obsidian.el
index 91b56ca..330a858 100644
--- a/obsidian.el
+++ b/obsidian.el
@@ -40,7 +40,7 @@
(require 's)
(require 'cl-lib)
-(require 'company)
+(require 'company nil t)
(require 'org)
(require 'markdown-mode)
@@ -234,7 +234,10 @@ Optional argument IGNORED this is ignored."
(interactive (list 'interactive))
(cl-case command
- (interactive (company-begin-backend 'obsidian-tags-backend))
+ (interactive (if (and (featurep 'company)
+ (fboundp 'company-begin-backend))
+ (company-begin-backend 'obsidian-tags-backend)
+ (error "Company not installed")))
(prefix (when (and
(-contains-p local-minor-modes 'obsidian-mode)
(looking-back obsidian--tag-regex nil))
@@ -413,7 +416,8 @@ See `markdown-follow-link-at-point' and
;;;###autoload
(define-globalized-minor-mode global-obsidian-mode obsidian-mode obsidian-enable-minor-mode)
-(add-to-list 'company-backends 'obsidian-tags-backend)
+(when (boundp 'company-backends)
+ (add-to-list 'company-backends 'obsidian-tags-backend))
;; (obsidian-comment
;; (use-package obsidian
--
2.37.1
This obsidian link behaves differently between Obsidian and obsidian-mode
's obsidian-follow-link-at-point
:
[[bushnell's law|pequeno número de regras mas ainda assim interessantes]]
In Obsidian, it would open the file bushnell's law.md
however obsidian-follow-link-at-point
interprets it as a link to bushnell’s law.md
.
The only difference is between the apostrophes, ’
vs '
:
Printable | Hexcode | Unicode Point | Unicode Character |
---|---|---|---|
' | 27 | U+0027 | APOSTROPHE |
’ | e2 80 99 | U+2019 | RIGHT SINGLE QUOTATION MARK |
Here's the obsidian note with the link that causes this issue. The linked note was created inside Obsidian by double-clicking on its link and only later the link was opened on emacs through obsidian-follow-link-at-point
, which opened a blank buffer. That blank buffer was named bushnell’s law.md
(with the U+2019
), hinting that it might have been created due to bushnell’s law.md
(the U+2019
one) not existing even though bushnell's law.md
(the U+0027
one) already existed. I had ran obsidian-update
before opening any notes (or my vault) inside emacs.
Both notes were written in Portuguese with Obsidian configured as English, but that shouldn't cause this bug.
Other ASCII characters or Unicode points may also be affected by this bug.
Here are all notes involved, in case you want to inspect their contents:
Filename | Role |
---|---|
chess is the drosophila of ai.md | Original note |
bushnell's law.md | Linked note |
bushnell’s law.md | Blank note |
Here's my obsidian-mode
configuration if it helps, copied straight out of the README.org
:
(use-package obsidian
:ensure t
:demand t
:config
(obsidian-specify-path "/mnt/p/pCloud-TCC/Obsidian Vault/TCC")
(global-obsidian-mode t)
;; :custom
;; ;; This directory will be used for `obsidian-capture' if set.
;; (obsidian-inbox-directory "Inbox")
:bind
(:map obsidian-mode-map
;; Replace C-c C-o with Obsidian.el's implementation. It's ok to use another key binding.
("C-c C-o" . obsidian-follow-link-at-point)
;; Jump to backlinks
("C-c C-b" . obsidian-backlink-jump)
;; If you prefer you can use `obsidian-insert-link'
("C-c C-l" . obsidian-insert-wikilink)))
It's great that obsidian-follow-link-at-point
creates a new file when it does not exists (like obsidian). Now we're creating notes in the obsidian-specify-path
directory, i would like to set a default directory for creating new notes: in my case it would be $OBSIDIAN_ROOT/Inbox.
Can this package be configured to achieve that behavior and if not is it something that can be added?
Thank you!
Hi,
I use the popular Templater plugin to insert a link to today's daily note every time I make a new note. The template file looks like:
---
Links:
- "[[<% tp.date.now("YYYY-MM-DD") %>]]"
---
This throws an error "Unable to parse YAML." from yaml-parse-string
when calling a variety of functions.
Perhaps a simple fix is to be able to specify files to be ignored by obsidian.el
?
Thanks!
Currently when inserting a link, if text is highlighted the link, the link text will be inserted after the highlighted text. It would be nice if the highted text were replaced by the text link.
First of all: awesome package!
I use alias front matters to define aliases in my Obsidian notes.
For instance, my home "+Home.md" has the following at the top:
---
aliases: [000, Home, Beginning]
---
It would be great if obsidian-jump
would show 000
, Home
, and Beginning
in addition to +Home
in the list.
Thanks!
emacs's markdown-mode
can display images when the function markdown-toggle-inline-images
is run. This only works for images that use the markdown image format, but not the wikilink format that Obsidian may use.
This would be a nice feature to add to make working with Obsidian notes in emacs even nicer.
When calling obsidian-insert-link
with a non-Obsidian link such as file://
or https://
, returned link may be invalid.
The link passed to obsidian-insert-link
may get passed to file-name-directory
which will parse the link on slashes, only returning the portion that follows the final slash (/).
For example:
(file-name-nondirectory "https://en.wikipedia.org")
=> www.wikipedia.org
(file-name-nondirectory "https://en.wikipedia.org/wiki/Guitar_Songs")
=> Guitar_Songs
From the Obsidian page on tag:
You can use any of the following characters in your tags:
Alphabetical letters Numbers Underscore (_) Hyphen (-) Forward slash (/) for [Nested tags](https://help.obsidian.md/Editing+and+formatting/Tags#Nested%20tags)
Tags must contain at least one non-numerical character. For example, #1984 isn't a valid tag, but #y1984 is.
Tags can't contain blank spaces.
obsidian.el currently allows plus sign, as well as numerical-only tags, neither of which are valid Obsidian tags.
Ideally, the obsidian--tag-regex
could be updated to match that of Obsidan. The regex below comes close, but it will also extract tags from the middle of a string which I do not believe are valid Obsidian tags. (For example, it will extract #bar
from foo#bar
and treat it like a tag.)
"#[[:alnum:]_/-]*[[:alpha:]_/-]+[[:alnum:]_/-]*"
Obsidian.nvim has this feature where you're able to change the note name (specifically the file name) when creating:
-- Optional, customize how names/IDs for new notes are created.
note_id_func = function(title)
-- Create note IDs in a Zettelkasten format with a timestamp and a suffix.
-- In this case a note with the title 'My new note' will given an ID that looks
-- like '1657296016-my-new-note', and therefore the file name '1657296016-my-new-note.md'
local suffix = ""
if title ~= nil then
-- If title is given, transform it into valid file name.
suffix = title:gsub(" ", "-"):gsub("[^A-Za-z0-9-]", ""):lower()
else
-- If title is nil, just add 4 random uppercase letters to the suffix.
for _ = 1, 4 do
suffix = suffix .. string.char(math.random(65, 90))
end
end
return tostring(os.time()) .. "-" .. suffix
end,
(here a note called Hello World
would be converted to 202307061244-hello-world.md
)
I know that slipbox isn't the most popular style of naming, but I've come to love it myself.
I was wondering if this would be a reasonable addition to your package. I don't have a lot of experience with lisp, but I'm willing to give this addition a shot if you think that it's worth doing (and possible/reasonably implemented in emacs).
This is more of a question around enhancements than an issue, but I was wondering if it was possible to have multiple capture destinations and capture templates for each - something closer to org's flexible capture templates.
I use obsidian.el every day - but currently have to dump lots of "types" of notes into my root directory and then manually refile them to target folders. It would be great to do this type of refiling at note origination time.
Thanks for creating this, it really is wonderful.
obsidian.el has changed my life, it is a really great piece of software, thanks!
However, it would be even better if you could see which backlinks are referring a specific node.
Hello
Obsidian can open multiple vaults. But obsidian-mode
can treat only one vault
that is specified by obsidian-specify-path
in the init.el
.
I can make use of obsidian-*
functions for multiple vaults after I run M-x obsidian-specify-path
manually.
But it would be convenient if it is done automatically. I mean that when I am editing some markdowns of vault A,
M-x obsidian-*
are applied to vault A. And if I am editing some
markdowns of vault B, M-x obsidian-*
are applied to vault B.
I'm not sure this is a feasible feature. But it would be great if I can opt in/out this feature as I want.
Thanks,
Hi, I think I found a bug.
In my vault I have two files named aaa.md
and not-the-aaa.md
.
If in a third file called xxx.md
I put a link to [aaa](aaa.md)
and I follow it with obsidian-follow-link-at-point
, I am not redirected to aaa.md
but I'm promped so to choose which file to follow because I have two files with the same suffix aaa.md
in my directory.
I think this shouldn't happen, a link should bring me to a specific file.
I think this happens because of this function:
(defun obsidian--match-files (f all-files)
"Filter ALL-FILES to return list with same name as F."
(-filter (lambda (el) (s-ends-with-p f el)) all-files))
that match the files using the suffix, while it should probably use the full file name like this:
(defun obsidian--match-files (f all-files)
"Filter ALL-FILES to return list with same name as F."
(-filter (lambda (el) (s-equals-p f (obsidian--file-relative-name el))) all-files))
What do you think about it?
While I worked on issue #70, I tried to figure out why it can't find the existing markdown file with or without my changes.
The obsidian-find-file
tries to match the file from all-files
coming from the cache, but fails on this line:
(matches (obsidian--match-files f all-files))
And that was the strangely working function:
(defun obsidian--file-relative-name (f)
"Take file name F and return relative path for `obsidian-directory'."
(message "f %s" f)
(message "od %s" obsidian-directory)
(message "frn %s" (file-relative-name f obsidian-directory))
(file-relative-name f obsidian-directory))
What I expected is to have a generic idea what should be shown for the actually matching file, but strangely it thinks that the file is in the inbox folder. Visiting a wiki link the code iterates on all files, so for instance the moc.md
in the MY_OBSIDIAN_FOLDER
produces:
f moc.md
od /home/user/MY_OBSIDIAN_FOLDER
frn 000 Inbox/moc.md
The reason behind that is the behavior of file-relative-name
. If the first parameter, f
is a relative path, like in my case, it prefixes with the current directory (based on my reproduction in **scratch**
buffer), so if the current directory is the inbox, the actual filename will be /home/user/MY_OBSIDIAN_FOLDER/000 Inbox/moc.md
instead of /home/user/MY_OBSIDIAN_FOLDER/moc.md
, this is why the result is useless. And obviously if the file is already in the inbox, like, e.g. 000 Inbox/my-idea.md
, the result is 000 Inbox/000 Inbox/moc.md
.
So this function should not be called here.
I get an error trying to use obsidian-follow-link-at-point to follow wikilinks when they're in an incomplete task that begins with a link, like this:
- [ ] [[some project page]]
I get this error: Wrong type argument: arrayp, nil
.
However, links like this work fine:
- [ ] go do [[some project]]
Appending words to the first example doesn't fix the problem.
Note that obsidian-follow-wiki-link-at-point actually still works.
I'm running emacs 28.2 (in particular obsidian-nox on ubuntu 23.04), I got obsidian.el from MELPA.
It might be beneficial to cache the results of obsidian-update
. I might tackle this when I find some time.
I probably have some invalid yaml somewhere in my obsidian notes directory.
This is causing obsidian-jump
to fail with the below error:
Obsidian tags updated
yaml-parse-string: Unable to parse YAML. Parser finished before end of input 26/63
Ideally, invali yaml somewhere should not cause the entire command to break.
In Obisidan I can link any section of a file by using the [[filename#header-title]]
format.
In obsidian.el it doesn't jump to the filename.md
file (or preferably to the actual header, instead it creates a new file with the name filename#header-title.md
.
Furthermore, it creates the file in the inbox folder instead of the folder containing the original file - I can configure it in Obsidian.
Typically, it's good if a freshly created note is saved into the inbox, but it's also common if a non-existing linked file is created next to the original file (that contains the link).
I think obsidian-find-file
could split the filename at the #
characters and keep only the first part.
I have these files in Obsidian Vault:
主题/文件对比.md
callout_test.md
test.md
What's in test.md
[[文件对比]]
What's in 文件对比.md
[[test]]
When I was in test.md, obsidian-follow-link-at-point
creates a new file under Vault instead goto 主题/文件对比.md
.
When I was in 主题/文件对比.md
, obsidian-follow-link-at-point
list two option in minibuffer:
callout_test.md
test.md
Instead of goto test.md
.
Similar to what this PR mentions:
When I use obsidian-search etc., it finds Markdown files under the .obsidian directory (for example, .obsidian/plugins/README.md). I would like to exclude .obsidian dir.
In Obsidian it's possible to configure the location of a new file:
In obisidian.el only the third option - the inbox - works.
It would be useful to store the files next to the existing one, if the package is configured that way.
obsidian-update and obsidian-jump return "mapcar: Wrong type argument: sequencep, 108"
obsidian.el
Version: 20231211.1857
Commit: 56f6861
Summary: Obsidian Notes interface
GNU Emacs 29.1 (build 2, x86_64-w64-mingw32) of 2023-07-30
PS: Previous version obsidian.el worked fine
Update: On note opening returning "File mode specification error: (wrong-type-argument sequencep 108)"
When following a link that doesn't exist, I would expect the new note to be created in obsidian-inbox-directory
, but instead it's created in the root dir. obsidian-capture
works correctly though.
When I try to install the obsidian
package, I get the following error:
Need package 'markdown-mode-2.6` but only 2.5 is available
I don't understand how to find markdown-mode-2.6 -- the latest stable version is 2.5 from what I can see (https://github.com/jrblevin/markdown-mode/releases -- https://web.archive.org/web/20221001162717/https://github.com/jrblevin/markdown-mode/releases)
What can I do to get markdown-mode-2.6
?
Emacs Version 29.0.50 (9.0)
obsidian.el: 20221102.1643
when install obsidian.el and put config to init.el then eval-buffer:
;; obsidian.el
(require 'obsidian)
(obsidian-specify-path "~/Documents/GitHub/Chaos")
;; If you want a different directory of `obsidian-capture':
(setq obsidian-inbox-directory "Inbox")
;; Replace standard command with Obsidian.el's in obsidian vault:
(bind-key (kbd "C-c C-o") 'obsidian-follow-link-at-point 'obsidian-mode-map)
;; Use either `obsidian-insert-wikilink' or `obsidian-insert-link':
(bind-key (kbd "C-c C-l") 'obsidian-insert-wikilink 'obsidian-mode-map)
;; Following backlinks
(bind-key (kbd "C-c C-b") 'obsidian-backlink-jump 'obsidian-mode-map)
;; Optionally you can also bind `obsidian-jump' and `obsidian-capture'
;; replace "YOUR_BINDING" with the key of your choice:
; (bind-key (kbd "YOUR_BINDING") 'obsidian-jump)
; (bind-key (kbd "YOUR_BINDING") 'obsidian-capture)
;; Activate detectino of Obsidian vault
(global-obsidian-mode t)
Emacs notifies: symbol's function definition is void: bind-key
I just ran into some weird issues using the latest version of obsidian.el (v1.4.4) on emacs 29.4 on macOS 14.5. They manifested as errors loading files when running obsidian-jump
or obsidian-update
, but the files changed as did the exact error messages. I eventually managed to get around them by loading the files in question manually in emacs (sometimes with errors), or in Obsidian.
Has anyone else seen errors like these? I'm including an elisp backtrace below. It seems likely that they're coming from the underlying OS, perhaps related to iCloud syncing. Is it a known issue with iCloud syncing perhaps?
Debugger entered--Lisp error: (file-error "Read error" "Operation canceled" "/Users/misaka/Library/Mobile Documents/iCloud~md~o...")
insert-file-contents("/Users/misaka/Library/Mobile Documents/iCloud~md~o...")
obsidian-read-file-or-buffer("/Users/misaka/Library/Mobile Documents/iCloud~md~o...")
obsidian-find-tags-in-file("/Users/misaka/Library/Mobile Documents/iCloud~md~o...")
mapcar(obsidian-find-tags-in-file ("/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." "/Users/misaka/Library/Mobile Documents/iCloud~md~o..." ...))
obsidian-list-all-tags()
obsidian-update-tags-list()
obsidian-update()
obsidian-jump()
funcall-interactively(obsidian-jump)
call-interactively(obsidian-jump record nil)
command-execute(obsidian-jump record)
execute-extended-command(nil "obsidian-jump" nil)
funcall-interactively(execute-extended-command nil "obsidian-jump" nil)
...
The docstring for the function obsidian-follow-link-at-point
says that a link can be opened in a different window "if ARG is non-nil", but doesn't accept a prefix argument or any ARG value. Therefore, there is no way to open a link in a different window as stated by the docstring.
When visiting a link for a file, if the file does not yet exist, obsidian.el will create a new file for that link. However, the new file will be created in the vault's root directory even if obsidian-inbox-directory
is set. To better align with the functionality of Obsidian, if obsidian-inbox-directory
is set, these new files should be placed there instead of in the vault root.
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.