unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Emacs, mutt and a problem with locales
@ 2006-12-24 11:18 Ismael Valladolid Torres
  2006-12-24 17:44 ` macondo
  2006-12-26 14:16 ` Anders Lennartsson
  0 siblings, 2 replies; 5+ messages in thread
From: Ismael Valladolid Torres @ 2006-12-24 11:18 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 1671 bytes --]

I am running Debian unstable, and I use mutt extensively for reading
mail and GNU Emacs as the editor for the mail client.

Emacs version is 21.4.1 (modified by Debian!) and Mutt version is
1.5.13, where debianized Mutt include patches below.

patch-1.5.11.rr.compressed.1
patch-1.5.4.vk.pgp_verbose_mime
patch-1.5.5.1.nt.xtitles.3.ab.1
patch-1.5.6.dw.maildir-mtime.1
patch-1.5.6.tt.assumed_charset.1

LANG is es_ES.UTF-8 and there is no other LC_* environment variable
defined.

The problem is that Mutt shows properly any message with the correct
encoding, even I see oriental symbols in spam received with the
iso-2022-jp encoding. But when I answer a message with spanish special
characters, Emacs opens and everything starts behaving unproperly.

As an example, I read a message using Mutt, with a line like:

"Lo <accented u>nico que me dice dmesg"

I answer the message, Emacs opens and I see:

"Lo <A with a tilde followed by underscored o>nico que me dice dmesg"

And below, in Emacs status line I see "0" instead of "u", so it seems
like Emacs is not detecting that the source being edited is composed
by UTF-8 characters.

Then I edit my response, send the message, and when receiving the copy
from the mailing list I'd see:

"Lo <?>nico que me dice dmesg"

Probably because Mutt is expecting UTF-8 and Emacs inserted latin-1
special characters in my response.

I tend to think that something in my .emacs is misconfigured but I
don't know what.

Find attached my .emacs.

Any ideas welcome.

Cordially, Ismael
-- 
Ismael Valladolid Torres

http://lamediahostia.blogspot.com/     m. +34679156321
http://www.flickr.com/photos/ivalladt  j. ivalladt@jabberes.org

[-- Attachment #2: .emacs --]
[-- Type: text/plain, Size: 6447 bytes --]

;; emacs - GNU Emacs initialization file

;; Copyright (C) 2005 Ismael Valladolid Torres <ivalladt@gmail.com>

;; This file is not part of GNU Emacs.

;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 2
;; of the License, or (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program; if not, write to the Free Software
;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
;; 02110-1301, USA.

;; See the file COPYING for details.

;; Search for local elisp libraries to load
(setq elisp (expand-file-name "~/.elisp"))

(when (file-directory-p elisp)
  (add-to-list 'load-path elisp))

;; A different default frame font on NT and on X
(defvar default-frame-font)

;; Eval the command below to get a list of available fonts
;; (prin1-to-string (x-list-fonts "*"))

;; Stuff to be run only on X
(cond ((eq window-system 'x)
       (if (file-directory-p "/usr/share/fonts/X11/proggy")
	   (setq default-frame-font "-windows-proggycleansz-medium-r-normal--13-80-96-96-c-70-iso8859-1")
	 (setq default-frame-font "fixed"))
       
       ;; Enable clipboard only if running Gnome
       (when (getenv "GNOME_DESKTOP_SESSION_ID")
	 (setq x-select-enable-clipboard 't))
       
       (set-scroll-bar-mode 'right))
      
      ;; Stuff to be run only on NT
      ((eq window-system 'w32)
	   (setq default-frame-font "-raster-ProggyCleanSZ-normal-r-normal-normal-10-75-96-96-c-70-iso8859-1")
       
       ;; Enable printing through Windows and/or the web browser
       (when (and (locate-library "htmlize") (locate-library "w32-winprint"))
	 (load-library "htmlize")
	 (load-library "w32-winprint"))
       
       ;; Cygwin related stuff
       (when (file-directory-p "C:/cygwin/bin")
	 
	 ;; Make NT Emacs use Cygwin bash, copied verbatim from Cygwin FAQ
	 ;; at http://www.cygwin.com/faq/
	 
	 ;; This assumes that Cygwin is installed in C:\cygwin (the
	 ;; default) and that C:\cygwin\bin is not already in your
	 ;; Windows Path (it generally should not be).
	 ;;
	 (setq exec-path (cons "C:/cygwin/bin" exec-path))
	 (setenv "PATH" (concat "C:\\cygwin\\bin;" (getenv "PATH")))
	 ;;
	 ;; NT-emacs assumes a Windows command shell, which you change
	 ;; here.
	 ;;
	 (setq process-coding-system-alist '(("bash" . undecided-unix)))
	 (setq shell-file-name "bash")
	 (setenv "SHELL" shell-file-name) 
	 (setq explicit-shell-file-name shell-file-name) 
	 ;;
	 ;; This removes unsightly ^M characters that would otherwise
	 ;; appear in the output of java applications.
	 ;;
	 (add-hook 'comint-output-filter-functions
		   'comint-strip-ctrl-m)
	 
	 ;; End of verbatim copied code
	 
	 ;; Make NT Emacs understand Cygwin paths
	 (when (require 'cygwin-mount nil t)
	   (cygwin-mount-activate))
	 
	 ;; Make Tramp work with Cygwin's ssh
	 (when (require 'tramp nil t)
	   (setq tramp-default-method "sshx"))
	 
	 ;; Some email niceties that need to be installed manually when
	 ;; running mutt on Cygwin
	 (when (file-executable-p "C:/cygwin/bin/mutt.exe")
	   (when (require 'post nil t)
	     (setq auto-mode-alist
		   (cons '("/tmp/mutt.*$" . post-mode) auto-mode-alist)))
	   (require 'muttrc nil t)))
       
;;        ;; Not needed when running gnuclientw.exe with the -s option??
;;        (when (and (require 'gnuserv nil t) (executable-find "gnuserv"))
;; 	 (gnuserv-start))
       ))

;; Stuff to be run when displaying through any window system
(when window-system
  ;; Don't iconify Emacs by mistake
  (global-unset-key "\C-z")
  (tool-bar-mode 0)

  ;; Default frame colors and font
  (setq default-frame-alist
	(list
	 (cons 'font default-frame-font)
	 (cons 'background-color "midnight blue")
	 (cons 'cursor-color "gainsboro")
	 (cons 'foreground-color "gray80")))
  (setq initial-frame-alist default-frame-alist)

  ;; Enable mouse wheel when available
  (when (require 'mwheel nil t)
    (mwheel-install)))

;; Personal keyboard macros
(global-set-key "\C-ca" 'mark-whole-buffer)
(global-set-key "\C-cc" 'comment-region)
(global-set-key "\C-cg" 'goto-line)
(global-set-key "\C-cs" 'sort-lines)
(global-set-key "\C-cu" 'uncomment-region)

;; Settings common to all modes
(auto-compression-mode 't)
(column-number-mode 't)
(global-font-lock-mode 't)

(put 'overwrite-mode 'disabled t)

(setq debug-on-error 't)
(setq inhibit-default-init 't)
(setq require-final-newline 't)
(setq transient-mark-mode 't)

;; Display buffer file name in the frame title
(setq frame-title-format '(buffer-file-name "%f" ("%b")))
;; (setq frame-title-format "%b")

;; Backup and version control
(setq backup-by-copying t)
(setq backup-directory-alist '(("." . "~/.saves")))
(setq delete-old-versions t)
(setq kept-new-versions 6)
(setq kept-old-versions 2)
(setq version-control t)

;; Settings for highlight changes mode
(global-highlight-changes "passive")
(global-set-key (kbd "\C-ch") 'highlight-changes-mode)
(custom-set-faces
 '(highlight-changes-face ((t (:foreground "white")))))

;; Binary files to be edited in hex dump format
(add-to-list 'auto-mode-alist '("\\.bin\\'" . hexl-mode))
(add-to-list 'auto-mode-alist '("\\.cap\\'" . hexl-mode))
(add-to-list 'auto-mode-alist '("\\.ijc\\'" . hexl-mode))

;; ;; Turn on auto fill for text files
;; (add-hook 'text-mode-hook 'turn-on-auto-fill)
(add-to-list 'auto-mode-alist '("\\.txt\\'" . text-mode)) 

;; Select unicode when editing these files
(add-to-list 'file-coding-system-alist '("\\.\\(ht\\|x\\)ml\\'" . utf-8))

;; Enable my markup language modes
(when (locate-library "my-html-mode") (load-library "my-html-mode"))
(when (locate-library "my-xml-mode") (load-library "my-xml-mode"))

;; Enable some customized major modes
(require 'a-mode nil t)
(require 'pcom-mode nil t)
(require 'pcom-log-mode nil t)

;; Find some default files
(setq today (format-time-string "%Y%m%d"))

(when (file-directory-p (expand-file-name "~/doc/log"))
  (find-file (concat (expand-file-name "~/doc/log/") today ".txt")))

(find-file (concat temporary-file-directory "blog" today ".html"))

;; Local Variables:
;; mode: lisp
;; End:

[-- Attachment #3: Type: text/plain, Size: 152 bytes --]

_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

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

* Re: Emacs, mutt and a problem with locales
       [not found] <mailman.2308.1166959163.2155.help-gnu-emacs@gnu.org>
@ 2006-12-24 12:48 ` Charles philip Chan
  2006-12-24 17:05   ` Ismael Valladolid Torres
  0 siblings, 1 reply; 5+ messages in thread
From: Charles philip Chan @ 2006-12-24 12:48 UTC (permalink / raw)


On 24 Dec 2006, ivalladolidt@terra.es wrote:

> But when I answer a message with spanish special
> characters, Emacs opens and everything starts behaving unproperly.

Try putting:

    (set-language-environment "UTF-8")

in your ~/.emacs. You should also set emacs to use a unicode
font. Please refer to this:

http://www.emacswiki.org/cgi-bin/emacs-en?CategoryInternationalization

Charles

-- 
Linux!  Guerrilla UNIX Development     Venimus, Vidimus, Dolavimus.
(By mah@ka4ybr.com, Mark A. Horton KA4YBR)

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

* Re: Emacs, mutt and a problem with locales
  2006-12-24 12:48 ` Emacs, mutt and a problem with locales Charles philip Chan
@ 2006-12-24 17:05   ` Ismael Valladolid Torres
  0 siblings, 0 replies; 5+ messages in thread
From: Ismael Valladolid Torres @ 2006-12-24 17:05 UTC (permalink / raw)
  Cc: help-gnu-emacs

Charles philip Chan escribe:
> On 24 Dec 2006, ivalladolidt@terra.es wrote:
> 
> > But when I answer a message with spanish special
> > characters, Emacs opens and everything starts behaving unproperly.
> 
> Try putting:
> 
>     (set-language-environment "UTF-8")
> 
> in your ~/.emacs. You should also set emacs to use a unicode
> font. Please refer to this:
> 
> http://www.emacswiki.org/cgi-bin/emacs-en?CategoryInternationalization

Thanks, solved like this:

(when (string-match "UTF-8" (getenv "LANG"))
  (set-language-environment "UTF-8"))

Thanks for the ideas.

Cordially, Ismael
-- 
Ismael Valladolid Torres

http://lamediahostia.blogspot.com/     m. +34679156321
http://www.flickr.com/photos/ivalladt  j. ivalladt@jabberes.org

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

* Re: Emacs, mutt and a problem with locales
  2006-12-24 11:18 Ismael Valladolid Torres
@ 2006-12-24 17:44 ` macondo
  2006-12-26 14:16 ` Anders Lennartsson
  1 sibling, 0 replies; 5+ messages in thread
From: macondo @ 2006-12-24 17:44 UTC (permalink / raw)
  Cc: help-gnu-emacs, mutt-users

On Sun, 24 Dec 2006, Ismael Valladolid Torres wrote:

> LANG is es_ES.UTF-8 and there is no other LC_* environment variable
> defined.
> 
> The problem is that Mutt shows properly any message with the correct
> encoding, even I see oriental symbols in spam received with the
> iso-2022-jp encoding. But when I answer a message with spanish special
> characters, Emacs opens and everything starts behaving unproperly.
> 
> As an example, I read a message using Mutt, with a line like:
> 
> "Lo <accented u>nico que me dice dmesg"
> 
> I answer the message, Emacs opens and I see:
> 
> "Lo <A with a tilde followed by underscored o>nico que me dice dmesg"
> 
> And below, in Emacs status line I see "0" instead of "u", so it seems
> like Emacs is not detecting that the source being edited is composed
> by UTF-8 characters.
> 
> Then I edit my response, send the message, and when receiving the copy
> from the mailing list I'd see:
> 
> "Lo <?>nico que me dice dmesg"

Hi Ismael, this what i got in my /etc/environment:

LC_ALL=es_ES.ISO-8859-15@euro
LANGUAGE=en_US
LC_TYPE=es_ES.ISO-8859-15@euro
LANG=es_ES.ISO-8859-15@euro

#reboot

the second line allows me to read the terminal messages (apt-get) in
english. In Pine for locales i got ISO-8859-1 ISO-8859-15 UTF-8
I don't know if you need a comma after each one in Mutt.

greetings,
macondo



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

* Re: Emacs, mutt and a problem with locales
  2006-12-24 11:18 Ismael Valladolid Torres
  2006-12-24 17:44 ` macondo
@ 2006-12-26 14:16 ` Anders Lennartsson
  1 sibling, 0 replies; 5+ messages in thread
From: Anders Lennartsson @ 2006-12-26 14:16 UTC (permalink / raw)
  Cc: help-gnu-emacs

I asked essentially the same question in October. There are some
helpful comments from others in that thread [1] [2].

I essentially added the following lines to my .emacs based on
information given by others but interpreted by me:

(prefer-coding-system locale-coding-system)
(when (not window-system)
  (set-keyboard-coding-system locale-coding-system)
  (set-terminal-coding-system locale-coding-system)
)

The first one is for general use, but if you start emacs in a terminal
window you may need the other lines. With the environment variable
LANG=en_US.UTF-8 now everything works nicely with mutt and emacs, both
in sarge, etch and sid.

I also had to convert my alias file to utf-8, otherwise mutt wouldn't
understand the character encoding when putting in the expanded
addresses.

Anders

[1] http://lists.debian.org/debian-user/2006/10/msg03418.html

[2] http://lists.debian.org/debian-user/2006/11/msg00023.html



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

end of thread, other threads:[~2006-12-26 14:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.2308.1166959163.2155.help-gnu-emacs@gnu.org>
2006-12-24 12:48 ` Emacs, mutt and a problem with locales Charles philip Chan
2006-12-24 17:05   ` Ismael Valladolid Torres
2006-12-24 11:18 Ismael Valladolid Torres
2006-12-24 17:44 ` macondo
2006-12-26 14:16 ` Anders Lennartsson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).