emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Large-file check in files.el


From: Stefan Monnier
Subject: Re: Large-file check in files.el
Date: Tue, 01 Apr 2008 11:56:25 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

> ===================================================================
> RCS file: /cvsroot/emacs/emacs/lisp/files.el,v
> retrieving revision 1.966
> diff -c -b -r1.966 files.el
> *** files.el  14 Mar 2008 17:14:09 -0000      1.966
> --- files.el  1 Apr 2008 12:00:30 -0000
> ***************
> *** 1507,1512 ****
> --- 1507,1523 ----
>     :version "22.1"
>     :type '(choice integer (const :tag "Never request confirmation" nil)))

> + (defun should-abort-large-file (attributes opType &optional buf nowarn)
> +   "Utility function: return t if file is larger than
> large-file-warning-threshold
> + and user declines loading it.  If buf or nowarn are true, always return 
> nil."
> +   (if (and large-file-warning-threshold (nth 7 attributes) (not (or
> buf nowarn)))
> +       (and (> (nth 7 attributes) large-file-warning-threshold)
> +        (not (y-or-n-p
> +              (format "File %s is large (%dMB), really %s? "
> +                      (file-name-nondirectory filename)
> +                      (/ (nth 7 attributes) 1048576) opType))))
> +     nil))

I'd call it "warn-about-large-file" or something like that and would let
it do the (error "Aborted!").

Please try C-u M-x checkdoc-current-buffer RET
Don't take its recommendations are gospel (even it tends to want to
force it upon you), but they're often useful for people to learn about
conventions, e.g. the first line of a docstring should be
self-contained, and arguments should appear in upper-case.
Also in Elisp, we tend to use "op-type" rather than "opType".
Finally "buf" shouldn't be an argument (only "nowarn" is needed).


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]