help-gnu-emacs
[Top][All Lists]
Advanced

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

help: windows emacs is adding CR to my .abbrev_defs files!


From: funkyj
Subject: help: windows emacs is adding CR to my .abbrev_defs files!
Date: Sat, 8 Dec 2007 19:20:21 -0800 (PST)
User-agent: G2/1.0

I'm using

    GNU Emacs 21.3.1 (i386-mingw-nt5.1.2600) of 2004-03-10 on NYAUMO

on Windows XP and I'm having a problem where, when emacs writes an
.abbrev_defs file it encodes the file in DOS format (i.e. CR at the
end of each line).

I have mostly succeeded in getting emacs to stop "helping" me with
distinguishing between unix and DOS files by putting:

    (require 'dos-w32)
    (setq file-name-buffer-file-type-alist '((".*" . t)))

in my .emacs.  This tells emacs that ALL files are to be treated as
binary so don't "help" me with the CRLF thing.

abbrev.el defines this function:

    (defun write-abbrev-file (file)
      "Write all abbrev definitions to a file of Lisp code.
    The file written can be loaded in another session to define the
same abbrevs.
    The argument FILE is the file name to write."
      (interactive
       (list
        (read-file-name "Write abbrev file: "
                        (file-name-directory (expand-file-name abbrev-
file-name))
                        abbrev-file-name)))
      (or (and file (> (length file) 0))
          (setq file abbrev-file-name))
      (save-excursion
       (set-buffer (get-buffer-create " write-abbrev-file"))
       (erase-buffer)
       (let ((tables abbrev-table-name-list))
         (while tables
           (insert-abbrev-table-description (car tables) nil)
           (setq tables (cdr tables))))
       (write-region 1 (point-max) file)
       (erase-buffer)))

which does the work of writing my .abbrev_defs file.  Looking at the
help for 'write-region' It says:

    This does code conversion according to the value of
    `coding-system-for-write', `buffer-file-coding-system', or
    `file-coding-system-alist', and sets the variable
    `last-coding-system-used' to the coding system actually used.

I think I'm getting warm but, being only an occasional emacs lisp
interloper I have not yet figured out the solution.

I see that the default value emacs shows me

    buffer-file-coding-system's value is iso-latin-1-dos

I tried changing this variable to nil but my change always seems to be
buffer local!?

I also looked at 'file-coding-system-alist' and
'find-buffer-file-type-coding-system' but I'm in over my head here.

All I want is for Emacs to NEVER EVER "help" me by adding CR to the
end of lines.  I also don't want emacs to "help" me by making CR
characters invisible rather than showing me "^M" in the buffer (I
think my 'dos-w32' code above successfully does this).

I would appreciate it if any of you emacs lisp gurus can close this
issue.




reply via email to

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