Coder Social home page Coder Social logo

Comments (6)

anthrolisp avatar anthrolisp commented on June 15, 2024 1

Perfect. I created a hydra. Thank you again!

(defun zd-a ()
  (interactive)
(deft)
  (setq deft-directory "~/zd-a/")
  (deft-refresh))

(defun zd-b ()
(deft)
  (interactive)
  (setq deft-directory "~/zd-b/")
  (deft-refresh))

;(require 'hydra)
(defhydra zd-switch (nil nil :foreign-keys nil :hint nil :exit t)
  "
Open:
----------------------
_m_ A zettelkasten
_t_ B zettelkasten

_q_ quit"
  ("q" nil)
  ("a" zd-a)
  ("b" zd-b))
(global-set-key (kbd "<f9>") 'zd-switch/body)

from zetteldeft.

gklimowicz avatar gklimowicz commented on June 15, 2024 1

I do this between three Zettelkasten. I use functions, like the ones above, but also take the liberty of changing other settings:

(defun gk/nv ()
  (interactive)
  (let ((gc-cons-threshold most-positive-fixnum))
    (setq deft-directory "~/NVIDIA")
    (setq deft-recursive nil)
    (setq deft-file-limit 200)
    (setq zetteldeft-id-format "%Y%m%d-%H%M")
    (deft-refresh)))

Seems to work so far. (Since some of these have several thousand notes, I suspend garbage collection during the deft-refresh.)

from zetteldeft.

EFLS avatar EFLS commented on June 15, 2024

This is more related to deft than it is to zetteldeft.

Anyway, it should be easy for you to achieve something like this in your private setup: change the variable deft-directory and call deft-refresh afterwards. To let a simple function do that for you:

(defun set-zd-dir ()
  (interactive)
  (setq deft-directory "~/mydir")
  (deft-refresh))

You could make another function to switch back to your original directory. What it doesn't allow, however, is using two directories at once: zetteldeft wont find links between them, since it looks only in one deft directory at a time.

Does this suffice for your workflow?

from zetteldeft.

anthrolisp avatar anthrolisp commented on June 15, 2024

Awesome. Thank you!
I can switch into my second zd now. Curious about the best way to switch between them. Is there a simple way, to make the new function either switch back to the other, or else list a pre-set number of directories to select from?
Thanks again! Zetteldeft is an awesome package!

from zetteldeft.

EFLS avatar EFLS commented on June 15, 2024

The easiest would be to write two separate functions. Simply set the deft-directory variable accordingly. You could make a more complex function that prompts for a directory, but this is the simplest approach.

One thing to note: I think deft-refresh only works when deft is already loaded, so you need to start deft (with the default directory) before you can switch to another one.

Glad to hear that zetteldeft is of use to you. That's my reason to share it: to contribute to the wonderful emacs community that I benefit so much from.

from zetteldeft.

EFLS avatar EFLS commented on June 15, 2024

I've included these code snippets in zd-tutorial.

from zetteldeft.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.