all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* help: windows emacs is adding CR to my .abbrev_defs files!
@ 2007-12-09  3:20 funkyj
  2007-12-09  4:52 ` funkyj
  0 siblings, 1 reply; 2+ messages in thread
From: funkyj @ 2007-12-09  3:20 UTC (permalink / raw)
  To: help-gnu-emacs

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.

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

* Re: help: windows emacs is adding CR to my .abbrev_defs files!
  2007-12-09  3:20 help: windows emacs is adding CR to my .abbrev_defs files! funkyj
@ 2007-12-09  4:52 ` funkyj
  0 siblings, 0 replies; 2+ messages in thread
From: funkyj @ 2007-12-09  4:52 UTC (permalink / raw)
  To: help-gnu-emacs

I figured it out on my own.

Here it is in case anyone has the problem.  In my .emacs

(require 'dos-w32)

;; this next line gets us most of what we want.
(setq file-name-buffer-file-type-alist '((".*" . t)))

;; this line fixes the problem that .abbrev_defs gets written with
;; CRLF
(setq-default buffer-file-coding-system 'iso-latin-1-unix)

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

end of thread, other threads:[~2007-12-09  4:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-09  3:20 help: windows emacs is adding CR to my .abbrev_defs files! funkyj
2007-12-09  4:52 ` funkyj

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.