an Emacs client for accessing Joplin notes.
Add this line on your init file:
(add-to-list 'load-path
(expand-file-name "*JOPLIN-MODE-PACKAGE-DIRECTORY*"))
(require 'joplin-mode)
(with-eval-after-load "markdown-mode"
(add-to-list 'markdown-mode-hook 'joplin-note-mode))
Or, you couse use following use-package
macro:
(use-package joplin-mode
:load-path (expand-file-name "*JOPLIN-MODE-PACKAGE-DIRECTORY*")
:requires markdown-mode
:config
(add-to-list 'markdown-mode-hook 'joplin-note-mode))
In JoplinApp, goto [Options]->[Web Clipper], and make sure you enabled the clipper service.
It should work.
Not tested.
This section assumes that you have WSL2 (Widnows subsystem for Linux) and did not change the network configuration of it. Since, your Linux box is placed on a private network range, and JoplinApp only listen to 127.0.0.0 network, you cannot connect Joplin from your Linux box. However, if you deploy proxy server on Windows, and let joplin-mode to connect to the proxy first, then you can use it.
First, check the IP address of the Windows from WSL. Open the file /etc/resolv.conf
and you can get the Windows IP address from the nameserver
field. (See Accessing network applications with WSL for more details.
$ cat /etc/resolv.conf | grep nameserver
172.22.144.1
Next, you'll need to run proxy server on Windows. The easiet one is to install mitmproxy. By default it will listen on 8080
port on your Windows. Launch the proxy server.
Then, using the Windows IP address and the proxy port, construct the proxy endpoint in your Emacs init file ($HOME/.emacs
or $HOME/.emacs.d/init.el
):
(setq joplin-url-proxy '(("http" . "172.22.144.1:8080")))
For use-package
, you could add above line in the :config
part:
(use-package joplin-mode
...
:config
(setq joplin-url-proxy '(("http" . "172.22.144.1:8080")))
...)
Make sure that you enabled Web Clipper service in JoplinApp. To test it, from your WSL terminal, do this:
$ curl -s --proxy http://172.22.144.1:8080 http://127.0.0.1:81184/
JoplinClipperServer
If you get the string "JoplinClipperServer", congratulation! Now you can access Joplin from Emacs on WSL.
If you use joplin-mode first time, it will ask your permission to get API token. Make sure you allow it in Joplin application, then in Emacs, press Return
(or Enter
) key.
M-x joplin
will list up all of your notebooks.
C-n
orn
: move to the next folderC-p
orp
: move to the previous folderRET
: visit notebook buffers
: search note (orM-x joplin-search
)
M-x joplin-search
will accept query string, and list the notes that match.
s
or/
: new searchg
: revert (call JoplinApp again with the same search query)C-n
orn
: move to the next noteC-p
orp
: move to the previous notet i
: toggle id field on the buffert c
: toggle created time of the note in the buffert u
: toggle updated time of the note in the buffer^
,C-c C-j
orC-c j j
: jump to Joplin bufferRET
: visit the noteo
: visit the note in other window
For query format, see Joplin Search Syntax.
You can mark(select) multiple notes, then do certain operations in bulk. For example, moving one or more notes to another folder(notebook).
-
m
: mark current note -
u
: unmark current note -
U
: unmark all notes -
t
: toggle marks -
% m
: mark notes that matches with regular expression -
d
: flag current note for deletion -
% d
: flag notes that matches with regular expression -
M
: move marked notes to specific notebook -
x
: delete all flagged notes
You can sort the list of notes in the search buffer:
S t
: sort by note titleS u
: sort by updated time of the noteS c
: sort by created time of the note
When you visit notebook buffer from joplin buffer (by RET
), you'll see the list of notes similar to Joplin Note Search buffer.
There are two types of note buffer in joplin-mode
:
-
If you visit Joplin note from the search buffer, joplin-mode will create a buffer for the note. Any usual saving action such as
C-x C-s
will update the note in JoplinApp. -
You can enable the minor mode
joplin-note-mode
on any emacs buffer. The installation section already provided the init code so that anymarkdown-mode
buffer will automatically enablejoplin-note-mode
.- If you press
C-c j s
,joplin-note-mode
will save the note to whatever associated file in your local file system first. - You'll need to provide the note title and notebook name.
- If the markdown has a link to a file or an image link, and the file is accessible from the local file system, joplin-mode will upload the file to JoplinApp, and convert the link target to a Joplin resource.
- Then it will upload the note text to the JoplinApp, and de-associated the buffer with whatever file in your local file system.
- Any subsequent modification in the buffer will be updated in JoplinApp not the original file.
- If you press
Common key bindings:
C-c j s
: save the buffer to JoplinAppC-c j l
: upload the file as a Joplin resource in the link at the point, convert the link target. You don't need to use this asC-c j s
will upload all local links.C-c j j
: jump to the parent bufferC-c j r
: list all resources belongs to this noteC-c j t
: show tags of the current noteC-u C-c j t
: edit tags of the current note
If you visit a note from Joplin, not from your local disk, joplin-mode will create buffer with markdown-mode
and view-mode
enabled, which means the buffer is read-only by default. You can scroll the buffer with your usuall keybindings in addition to <RET>
, which also scroll forward. Pressing e
will quit the view-mode and makes the buffer editable. Pressing q
will quit the view-mode and delete the buffer. See also (the view-mode manual)[https://www.gnu.org/software/emacs/manual/html_node/emacs/View-Mode.html].
Here are current backlogs that I need to do. Any help will be greatly appreciated.
- The order of search results are not the same as JoplinApp. I have not figured out how to sort the response from JoplinApp. If somebody is able to demonstrate the search query request using
curl(1)
, and how to sort the output to match with JoplinApp... - Some help on how to register joplin-mode to Melpa.
- keyword completion on search; autocompleting Joplin search operators such as "any:", "title:", "body:", etc. I do not want to rely on external packages such as helm, but want to implement with vanilla Emacs features.
- In the current implementation, all Joplin note buffer are bound to a single temporary file. This is necessary to override Emacs's default saving action to upload to JoplinApp. Ideally, Joplin note buffer should not be bound to any local temporary files.
- Clean up the source code, and possibly optimize it.