Coder Social home page Coder Social logo

Merging 2 notes into 1 about denote HOT 3 OPEN

zadca123 avatar zadca123 commented on July 28, 2024
Merging 2 notes into 1

from denote.

Comments (3)

protesilaos avatar protesilaos commented on July 28, 2024

Interesting idea! I have not had the chance to experiment with it. Let's leave it here for the time being and we can resume after the release of Denote version 3.0.0 and the subsequent bugfix phase.

from denote.

zadca123 avatar zadca123 commented on July 28, 2024

Currently using something like this

(defun my/denote-org-extras-merge-note-to-another ()
  "Merge the current note into another selected note as a subtree."
  (interactive)
  (when (denote-filename-is-note-p buffer-file-name)

    (let* ((other-note (denote-file-prompt))
           (current-note-type (denote-filetype-heuristics buffer-file-name))
           (current-note-title (denote-retrieve-title-or-filename buffer-file-name current-note-type))
           (current-note-keywords (denote-extract-keywords-from-path buffer-file-name))
           (current-note-content (condition-case nil ;; handling case when current note is empty
                                     (denote-org-extras-dblock--get-file-contents buffer-file-name t)
                                   (error ""))))

      (with-current-buffer (find-file-noselect other-note)
        (goto-char (point-max))
        (insert (concat "\n* " current-note-title "\n"))
        (insert current-note-content)
        (save-buffer))

      (delete-file buffer-file-name)
      (kill-buffer)
      (find-file other-note)
      (denote-keywords-add current-note-keywords t)
      (message "Merged current note into %s" (file-name-nondirectory other-note)))))

from denote.

protesilaos avatar protesilaos commented on July 28, 2024

from denote.

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.