0

windows 10 (64 bit)

Emacs 26.1, Dired+

I need tool that can compare files by content with highlight different symbols.

Example: enter image description here

As you can see I mark two files. Is it possible to compare this files in dired mode? Smt like press C-c and compare only mark files.

M-x dired-diff

Error:

dired-get-filename: Cannot operate on ‘.’ or ‘..’

To avoid this error I need to set cursor over file.

enter image description here Is it possible Emacs ,by default, compare marks files? Without asking me about files.

1

That's not how dired-diff works - it does not operate on the marked files. Same thing for diredp-ediff.

These commands operate on the current-line's file and another file whose name you enter.

C-h f diredp-ediff tells you, about the file name you enter:

Try to guess a useful default value for FILE2, as follows:

  • If the mark is active, use the file at mark.

  • Else if the file at cursor is a autosave file or a backup file, use the corresponding base file.

  • Else if there is any backup file for the file at point, use the newest backup file for it.

  • Else use the file at point.

This will do more or less what you want:

(defun diredp-ediff-marked-files ()
  "..."
  (interactive)
  (let ((files  (dired-get-marked-files)))
    (unless (and (listp files)  (= 2 (length files)))
      (error "There are not (only) 2 marked files"))
    (ediff-files (car files) (cadr files))))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.