all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Glenn Morris <gmorris+news@ast.cam.ac.uk>
Subject: Re: "Args out of range:" error when opening existing files
Date: Wed, 09 Oct 2002 16:15:16 +0100	[thread overview]
Message-ID: <491y6zbq4b.fsf@ast.cam.ac.uk> (raw)
In-Reply-To: uq6rj57k0p9i4d@corp.supernews.com

Joseph Shraibman wrote:

> I keep getting errors like this when opening existing files:
[...]
> string-equal: Args out of range: "/etc/hosts", 0, 18

I think you could solve this pretty easily:

i) Does it happen if you start Emacs with -q?

No, so it's something caused by your .emacs file.

ii) Maybe look for "string-equal" in .emacs? Oh look, there it is, with a
"0" and an "18" too:

> ; this prevents the creating of ~ backup files in the jsp directory, bec.
> ; the ~ files are visible to anyone who accesses them with a web browser
> (setq backup-enable-predicate
>       (lambda (name)
>         (or (< (length name) 5)
>             (and
>              (not (string-equal "/tmp/" (substring name 0 5)))
>              (not (string-equal "/local/www/htdocs/"
>                                 (substring name 0 18)))))))

Comment this out and your problems will go away.

(substring name 0 18)

is clearly going to give an error when you visit a file whose full name has
less than 18 characters.

So you want to have no backups for files beneath "/local/www/htdocs/".
I use something like this:

(defun my-backup-enable-predicate (name)
  "Function to use for `backup-enable-predicate'.
Runs `normal-backup-enable-predicate', but checks further if that is non-nil."
  (when (normal-backup-enable-predicate name)
    (let* ((dir "/local/www/htdocs/")
           (comp (compare-strings dir 0 nil name 0 nil)))
      ;; Directory is under dir.
      (not (and (not (eq comp t))
                (< comp (- (length dir))))))))

(setq backup-enable-predicate 'my-backup-enable-predicate)

Or, as you say you are using Emacs 21, you could use the variable
backup-directory-alist to keep the backups for your htdocs somewhere else.
For example:

(setq backup-directory-alist
      '(("^/local/www/htdocs/" . "/path/to/secure/directory")))

  reply	other threads:[~2002-10-09 15:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-08 23:46 "Args out of range:" error when opening existing files Joseph Shraibman
2002-10-09 15:15 ` Glenn Morris [this message]
2002-10-09 18:13   ` Joseph Shraibman
  -- strict thread matches above, loose matches on Subject: below --
2002-10-09 18:48 Bingham, Jay

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=491y6zbq4b.fsf@ast.cam.ac.uk \
    --to=gmorris+news@ast.cam.ac.uk \
    /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.