A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

New answers tagged


I am grateful to @Drew for also providing me with similar code for Emacs Dired. With it, clicking on a large file in Dired will result in a message about the file being too big to open. (defun my-dired-find-file () "Like `dired-find-file', but raise error file is too big." (interactive) (let ((find-file-run-dired t) (switch-to-buffer-...


It sounds like you want this only for interactive use, i.e., a command. Define your own substitute for command find-file (or find-file-other-window etc.). Have you command check the file size, using functions file-attributes and file-attribute-size, and refuse to open the file if it is bigger than some threshold you set. For example (untested): (defvar my-...

Top 50 recent answers are included