all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: "Adrian Robert" <adrian.b.robert@gmail.com>
Cc: emacs- devel <emacs-devel@gnu.org>
Subject: Re: Large-file check in files.el
Date: Tue, 01 Apr 2008 11:56:25 -0400	[thread overview]
Message-ID: <jwv1w5py5i4.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: 55f7df060804010502j689f88c4k8888030298f3d065@mail.gmail.com

> ===================================================================
> 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	other threads:[~2008-04-01 15:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-01  4:55 Large-file check in files.el Adrian Robert
2008-04-01  5:57 ` Stefan Monnier
2008-04-01 12:02   ` Adrian Robert
2008-04-01 15:56     ` Stefan Monnier [this message]
2008-04-02 17:59       ` Adrian Robert
2008-04-03 14:03         ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv1w5py5i4.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=adrian.b.robert@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.