Coder Social home page Coder Social logo

Comments (9)

protesilaos avatar protesilaos commented on July 28, 2024 1

I am receiving this message: dired-move-to-filename: No file on this line

Maybe I should try without customizations.

Can you please report this in a new issue? It will be easier to track
things.

Also please note what you tried to produce this error. Maybe
denote-dired-rename-file?

from denote.

protesilaos avatar protesilaos commented on July 28, 2024 1

I am closing this issue now as Denote supports the idea of renaming other files.

from denote.

protesilaos avatar protesilaos commented on July 28, 2024

Thanks @Ypot!

Just in case this idea could be useful:

Yes, it is useful.

I use attached or linked local files for adding multimedia (jpg, pdf,
etc) or references (saved html, podcasts, etc) to my org notes. These
multimedia files are in a folder almost kaotically. To sort those
files in the way you've described could give to them a new dimension.

I already do this locally for my multimedia, but I don't have any Elisp
for it.

I am now trying to think how it could be done. We could have a command,
say, denote-dired-rename which only changes the name of the file at
point. It will prompt for TITLE and KEYWORDS, just like denote and
denote-org-capture, but it will also ask for a file type extension:
jpd, pdf, and others can be available as completion candidates.

Unlike the other commands, denote-dired-rename will not create a
"note" per se.

What do you think?

[ Maybe a better name is denote-dired-rename-non-note or something to
make it clear we are not operating on notes. ]

Though we need to be careful not to go very far with this idea, as it is
not directly connected to the note-taking goal.

Thanks for elisping!

You are welcome!

from denote.

Ypot avatar Ypot commented on July 28, 2024

Not sure! I just thought attachments could be benefited with an analogous naming and listing. But it's more like a brainstormed idea that could fit in your project, if it suits you.

For completion candidates I would find more useful keywords than extensions (why bother with existing extensions?).

Best regards :-)

from denote.

protesilaos avatar protesilaos commented on July 28, 2024

Hello again! Here is a prototype (I made some other changes):

(defun denote-dired-rename-file (title keywords)
  "Return path to new file with TITLE and KEYWORDS."
  (interactive
   (list
    (denote--title-prompt)
    (denote--keywords-prompt)))
  (let* ((file (dired-get-filename))
         (dir (file-name-directory file))
         (old-name (file-name-nondirectory file))
         (extension (file-name-extension file t))
         (new-name (denote--format-file
                    dir
                    (format-time-string denote--id)
                    keywords
                    (denote--sluggify title)
                    extension)))
    (when (y-or-n-p
           (format "Rename %s to %s?"
                   (propertize old-name 'face 'error)
                   (propertize (file-name-nondirectory new-name) 'face 'success)))
      (rename-file old-name new-name nil)
      (revert-buffer))))

It uses the standard prompts for TITLE and KEYWORDS and converts
them to a familiar Denote path. The file type extension is read from
the underlying file. So if you are renaming a .pdf it stays a .pdf, if
it is an .mp3 it remains that way, and so on.

The renaming only happens relative to the current directory. It does
not move the file between directories. I think this is consistent with
the task, which basically is "Give me a Denote-style file name".

EDIT: I removed the sample diff, as I already pushed the changes.

from denote.

protesilaos avatar protesilaos commented on July 28, 2024

I made some changes early today to how renaming works. The current functionality is described here: https://protesilaos.com/emacs/denote#h:532e8e2a-9b7d-41c0-8f4b-3c5cbb7d4dca

from denote.

Ypot avatar Ypot commented on July 28, 2024

I am receiving this message:
dired-move-to-filename: No file on this line

Maybe I should try without customizations.

from denote.

Ypot avatar Ypot commented on July 28, 2024

Offtopic: I am trying to send you what seems to be a "typo". But I don't know how to, I share it here (last line):

;; Generic:
;; (add-hook 'dired-mode-hook #'denote-dired-mode)
;;
;; OR better:
(add-hook 'dired-mode-hook #'denote-dired-mode-in-directories)

;; You can bind `denote' to a global key if you prefer not to use
;; `org-capture' or want an alternative.  Denote does not define any key
;; bindings though: this is for the user to decide.  For example:
(let ((map global-map))
  (define-key map (kbd "C-c n") #'denote)
  (define-key map (kbd "C-c N") #'denote-type))

(with-eval-after-load 'org-capture
  (require 'denote-org-capture)
  (setq denote-org-capture-specifiers "%l\n%i\n%?")
  (add-to-list 'org-capture-templates
               '("n" "New note (with denote.el)" plain
                 (file denote-last-path)
                 #'denote-org-capture
                 :no-save t
                 :immediate-finish nil
                 :kill-buffer t
;; Should be here just 3 )))?                 :jump-to-captured t))))

from denote.

protesilaos avatar protesilaos commented on July 28, 2024

Offtopic: I am trying to send you what seems to be a "typo".

Fixed. Thank you!

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.