all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* "Args out of range:" error when opening existing files
@ 2002-10-08 23:46 Joseph Shraibman
  2002-10-09 15:15 ` Glenn Morris
  0 siblings, 1 reply; 4+ messages in thread
From: Joseph Shraibman @ 2002-10-08 23:46 UTC (permalink / raw)


I keep getting errors like this when opening existing files:

Args out of range: "/etc/hosts", 0, 18

The filename differs but the 0, 18 is always the same. The buffer is actually created, 
but emacs doesn't switch to it.  Here is the contents of the messages buffer after 
running  emacs /etc/hosts on the command line:

(emacs /etc/hosts)
Loading tool-bar...done
Loading image...done
Loading tooltip...done
Loading /usr/share/emacs/site-lisp/site-start.d/lang.emacs.el (source)...done
Loading /usr/share/emacs/site-lisp/site-start.d/php-mode-init.el (source)...done
Loading /usr/share/emacs/site-lisp/site-start.d/po-mode-init.el (source)...done
Loading regexp-opt...done
For information about the GNU Project and its goals, type C-h C-p.
string-equal: Args out of range: "/etc/hosts", 0, 18

I'm using emacs 21.2.1 that I built from the redhat 8.0 source rpm. This is a redhat 6.x 
system. Before I was using an older version, but I was waiting until I upgraded emacs 
before I asked for help. I this a known problem?  I tried a google search but couldn't 
find anything.  My .emacs is:

;NOTE: use C-j in *scratch* buffer to eval lisp
(setq-default indent-tab-modes nil)

; turn off auto parsing when a java file changes.
;(setq jde-auto-parse-enable nil)
;setting this variable here wasn't working, so I changed the default in the jde source 
to nil.

(custom-set-variables
 '(global-font-lock-mode t nil (font-lock)))

;(add-to-list 'load-path (expand-file-name "/usr/local/emacsl/jde/lisp"))
;(add-to-list 'load-path (expand-file-name "/usr/local/emacsl/jde-2.2.5/lisp"))
(add-to-list 'load-path (expand-file-name "/usr/local/emacsl/jde-2.2.8/lisp"))
;(add-to-list 'load-path (expand-file-name "/usr/local/emacsl/jde-2.1.9/lisp"))

      (add-to-list 'load-path (expand-file-name "/usr/local/emacsl/semantic-1.4beta11"))
;      (add-to-list 'load-path (expand-file-name "/usr/local/emacsl/semantic-1.2.1"))
;      (add-to-list 'load-path (expand-file-name "/usr/local/emacsl/semantic"))

;      (add-to-list 'load-path (expand-file-name "/usr/local/emacsl/speedbar"))
;      (add-to-list 'load-path (expand-file-name "/usr/local/emacsl/speedbar-0.12"))
      (add-to-list 'load-path (expand-file-name "/usr/local/emacsl/speedbar-0.13a"))

      (add-to-list 'load-path (expand-file-name "/usr/local/emacsl/elib-1.0"))
      (add-to-list 'load-path (expand-file-name "/usr/local/emacsl/eieio"))

(setq-default indent-tab-modes nil)


;(require 'jde)
(setq defer-loading-jde t)
(if defer-loading-jde
    (progn
      (autoload 'jde-mode "jde" "JDE mode." t)
      (setq auto-mode-alist
            (append
             '(("\\.java\\'" . jde-mode))
             auto-mode-alist)))
  (require 'jde))


;; Sets the basic indentation for Java source files
;; to two spaces.
(defun my-jde-mode-hook ()
 (setq indent-tabs-mode nil) ; added to set no-tab mode
  (setq c-basic-offset 4))

(add-hook 'jde-mode-hook 'my-jde-mode-hook)

;this is on top and on bottom.
(setq-default indent-tab-modes nil)

;; check for files with a path containing "postgres" or "pgsql"
(setq auto-mode-alist (cons '("\\(postgres\\|pgsql\\).*\\.[ch]\\'" . pgsql-c-mode) 
auto-mode-alist))
(setq auto-mode-alist (cons '("\\(postgres\\|pgsql\\).*\\.cc\\'" . pgsql-c-mode) 
auto-mode-alist))

(defun pgsql-c-mode ()
  ;; sets up formatting for Postgres C code
  (interactive)
  (c-mode)
  (setq-default tab-width 4); This isn't the source of my tab problems
  (c-set-style "bsd")             ; set c-basic-offset to 4, plus other stuff
  (c-set-offset 'case-label '+)   ; tweak case indent to match PG custom
  (setq indent-tabs-mode t))      ; make sure we keep tabs when indenting

;this is on top and on bottom.
(setq-default indent-tab-modes nil)

; this is the emacs default that I changed
;(setq backup-enable-predicate(lambda (name) (or (< (length name) 5) (not (string-equal 
"/tmp/" (substring name 0 5))))) )

; 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)))))))

; another attempt to solve the tab hell problem
(setq indent-tabs-mode nil)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: "Args out of range:" error when opening existing files
  2002-10-08 23:46 "Args out of range:" error when opening existing files Joseph Shraibman
@ 2002-10-09 15:15 ` Glenn Morris
  2002-10-09 18:13   ` Joseph Shraibman
  0 siblings, 1 reply; 4+ messages in thread
From: Glenn Morris @ 2002-10-09 15:15 UTC (permalink / raw)


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")))

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: "Args out of range:" error when opening existing files
  2002-10-09 15:15 ` Glenn Morris
@ 2002-10-09 18:13   ` Joseph Shraibman
  0 siblings, 0 replies; 4+ messages in thread
From: Joseph Shraibman @ 2002-10-09 18:13 UTC (permalink / raw)


Ugh. Right under my nose.  I changed it to:

(setq backup-enable-predicate(lambda (name)
			       (not (or
				     (and (> (length name) 5) 
(string-equal "/tmp/" (substring name 0 5)))
				     (and (> (length name) 18) 
(string-equal "/local/www/htdocs/" (substring name 0 18)))
				     )
				    )
))

(tin screwed up the indentation).

BTW I noticed before when I edited .emacs emacs automatically entered 
lisp mode, but since I upgraded it doesn't do it anymore. Is this some 
redhat thing or a change in emacs?

-- 
--
TuPari
Joseph Shraibman
jks(at)iname.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: "Args out of range:" error when opening existing files
@ 2002-10-09 18:48 Bingham, Jay
  0 siblings, 0 replies; 4+ messages in thread
From: Bingham, Jay @ 2002-10-09 18:48 UTC (permalink / raw)


Joseph,

Although I can't answer your emacs-lisp-mode question directly since I do not have a machine running redhat, perhaps I can help you narrow the field some.  I run emacs 21.2 in two environments (the pre-compiled version on a windows pc under Win2000 and one that I just built on a solaris 2.8 unix machine).  I don't have any problem with either of these builds not automatically entering emacs-lisp-mode.

Hope this helps some.
-_
J_)
C_)ingham
.    HP - NonStop Austin Software & Services - Software Product Assurance
.    Austin, TX
. Language is the apparel in which your thoughts parade in public.
. Never clothe them in vulgar and shoddy attire.          -Dr. George W. Crane-

 -----Original Message-----
From: 	Joseph Shraibman [mailto:jks@spam.me.not.akula.com] 
Sent:	Wednesday, October 09, 2002 1:13 PM
To:	help-gnu-emacs@gnu.org
Subject:	Re: "Args out of range:" error when opening existing files

Ugh. Right under my nose.  I changed it to:

(setq backup-enable-predicate(lambda (name)
			       (not (or
				     (and (> (length name) 5) 
(string-equal "/tmp/" (substring name 0 5)))
				     (and (> (length name) 18) 
(string-equal "/local/www/htdocs/" (substring name 0 18)))
				     )
				    )
))

(tin screwed up the indentation).

BTW I noticed before when I edited .emacs emacs automatically entered 
lisp mode, but since I upgraded it doesn't do it anymore. Is this some 
redhat thing or a change in emacs?

-- 
--
TuPari
Joseph Shraibman
jks(at)iname.com
_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnu-emacs

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-10-09 18:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-08 23:46 "Args out of range:" error when opening existing files Joseph Shraibman
2002-10-09 15:15 ` Glenn Morris
2002-10-09 18:13   ` Joseph Shraibman
  -- strict thread matches above, loose matches on Subject: below --
2002-10-09 18:48 Bingham, Jay

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.