[Précédent (date)] [Suivant (date)] [Précédent (sujet)] [Suivant (sujet)] [Index par date] [Index par sujet]

Re: Emacs en mode texte: accents et couleurs.




Oui, quelle version d'emacs utilises-tu?  En supposant que tu
utilises Emacs-20.x.  Insère ceci dans ton fichier .emacs:


; Pour les caractères ISO-8859-1
;;=============================
(standard-display-european 1)  ; was set to t before
(set-input-mode nil nil 1)
(set-language-environment "Latin-1")
(load-library "iso-insert.el")

(show-paren-mode 1)
(setq show-paren-ring-bell-on-mismatch t)

;; Set up emacs to recognize certain files types and load the
;; major mode associated with the type.
(setq auto-mode-alist (mapcar 'purecopy
                              '(("\\.bib$"     . bibtex-mode)
                                ("\\.a$"       . c-mode)
                                ("\\.c$"       . c-mode)
                                ("changelog"   . debian-changelog-mode)
                                ("\\.h$"       . c-mode)
                                ("\\.el$"      . emacs-lisp-mode)
                                ("\\.emacs"    . emacs-lisp-mode)
                                ("\\.f$"       . fortran-mode)
                                ("\\.f.gz$"    . fortran-mode)
                                ("\\.for$"     . fortran-mode)
                                ("\\.gau$"     . gauss-mode) 
                                ("\\.m90$"     . f90-mode)
                                ("\\.f90$"     . f90-mode)
                                ("\\.html$"    . html-mode)
                                ("Makefile"    . makefile-mode)
                                ("makefile"    . makefile-mode)
                                ("\\.m$"       . octave-mode)
                                ("\\.octaverc" . octave-mode)
                                ("\\.tex$"     . TeX-mode)
                                ("\\.mws$"     . mws-mode)
                                ("\\.gp$"      .gnuplot-mode)
                                ("\\.txt$"     . text-mode)
                                ("\\.\\([pP][Llm]\\|al\\)$"  . perl-mode)
                                ("\\.txi$"     . Texinfo-mode))))

;;;;;;;;;;;; Mode Definitions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;*************** Adding gnuplot mode

(require 'kw-compl)
(autoload 'gnuplot-mode "gnuplot" "gnuplot major mode" t)
(autoload 'gnuplot-make-buffer "gnuplot" "open a buffer in gnuplot mode" t)
;; This line binds the function-10 key so that it opens a buffer into
;; gnuplot mode 

(global-set-key [(f10)] 'gnuplot-make-buffer)

;; Maple mws-mode

(autoload 'mws-mode "mws" "Maple Worksheet display mode" t)

;; BiBTeX mode
(require 'tex-site)
(setq bibtex-mode-hook 
      '(lambda () 
         (auto-fill-mode 1)
         (if (eq window-system 'x)
             (font-lock-mode 1))
         ))


;; Elisp mode
(setq emacs-lisp-mode-hook
      '(lambda () 
         (if (eq window-system 'x)
             (font-lock-mode 1))
         ))

;; Gauss mode
        
(setq gauss-mode-hook 
      '(lambda ()
         (auto-fill-mode t)
         (abbrev-mode t)
         (if (eq window-system 'x)
             (font-lock-mode t))
         ))

;; ---------C++ Options ---------------------
(add-hook 'c++-mode-hook
          '(lambda ()
             (c-set-style "Stroustrup")
             (c-toggle-auto-state)
             (c-toggle-hungry-state)))
;; --------End of C++ Options --------------



;; F77 mode
(require 'fortran)
(setq fortran-mode-hook 
      '(lambda ()
         (fortran-auto-fill-mode 1)
         (abbrev-mode 1)
         (custom-set-variables
          '(fortran-blink-matching-if t)
          '(fortran-check-all-num-for-matching-do t)
          '(fortran-do-indent 3)
          '(fortran-if-indent 4)
          '(fortran-break-before-delimiters nil)
          (custom-set-faces))
         (set
          (make-local-variable 'parens-require-spaces)
          nil)
         (global-font-lock-mode t)))
        

;; To enter perl-mode automatically, add 
(autoload 'perl-mode "perl-mode")

;; to your .emacs file and change the first line of your perl script to:
;; #!/usr/bin/perl --    # -*-Perl-*-
;; With arguments to perl:
;; #!/usr/bin/perl -P-   # -*-Perl-*-
;; To handle files included with do 'filename.pl';, add something like

;(setq auto-mode-alist (append (list (cons "\\.pl\\'" 'perl-mode))
;                               auto-mode-alist))
;; to your .emacs file; otherwise the .pl suffix defaults to prolog-mode.


;; F90 mode
(require 'f90)
(setq f90-mode-hook
      '(lambda () 
         (setq f90-do-indent 3
               f90-if-indent 3
               f90-type-indent 3
               f90-program-indent 2
               f90-continuation-indent 5
               f90-comment-region "!!$"
               f90-directive-comment-re "!hpf\\$"
               f90-indented-comment-re "!"
               f90-break-delimiters "[-+\\*/,><=% \t]"
               f90-break-before-delimiters t
               f90-beginning-ampersand t
               f90-smart-end 'blink
               f90-auto-keyword-case 'upcase-word
               f90-leave-line-no  nil
               f90-startup-message t
               indent-tabs-mode nil
               fill-column 80)
         ;;The rest is not default.
         (abbrev-mode 1)             ; turn on abbreviation mode
         (f90-auto-fill-mode 1)      ; turn on auto-filling
         (column-number-mode 1)      ; turn on column number mode
         (if (eq window-system 'x)
             (font-lock-mode 1))          ; for highlighting
         (if f90-auto-keyword-case   ; change case of all keywords on startup
             (f90-change-keywords f90-auto-keyword-case))
         ))

;; Fundamental mode
(setq fundamental-mode-hook 
      '(lambda ()
         (turn-on-auto-fill)
         ))

;; HTML mode
(setq html-mode-hook 
      '(lambda () 
         (if (eq window-system 'x)
             (font-lock-mode 1))
         ))
(setq sgml-mode-hook 
      '(lambda () 
         (if (eq window-system 'x)
             (font-lock-mode 1))
         ))

;; Makefile mode
(setq makefile-mode-hook
      '(lambda () 
         (if (eq window-system 'x)
             (font-lock-mode 1))
           ))

;; Octave mode
(require 'octave-mod)
(require 'octave-inf) 
(autoload 'octave-mode "octave-mod" nil t)
(autoload 'run-octave "octave-inf" nil t)
(add-hook 'octave-mode-hook
          (lambda () 
            (setq octave-send-echo-input nil)
            (abbrev-mode 1)
            (auto-fill-mode 1)
            (RET-behaves-as-LFD)
            (if (eq window-system 'x)
                (font-lock-mode 1))
            ))


(add-hook 'inferior-octave-mode-hook
          (lambda ()
            (turn-on-font-lock)
            (define-key inferior-octave-mode-map [up]
              'comint-previous-input)
            (define-key inferior-octave-mode-map [down]
              'comint-next-input)
            ))


;; Global font-lock-mode

(setq font-lock-maximum-decoration t)
(global-font-lock-mode t)  ;; removed this for xemacs

;; Text mode
(setq text-mode-hook 
      '(lambda ()
         (turn-on-auto-fill)
         ))

;;--------------- TeX section -----------------------

;; Using package iso-tex.el for proper handling of the
;; ISO-8859-1 character set.
(require 'ispell)
(require 'tex-site)
(autoload 'iso-tex-minor-mode
                     "iso-tex"
                     "Translate TeX to ISO 8859/1 while visiting a file."
                     t)
(setq TeX-mode-hook 

                 (function (lambda () (interactive)
                             (iso-tex-minor-mode 1)
                             (setq LaTeX-indent-level 4)
;                            (setq LaTeX-item-indent 2)
                             (setq ispell-parser 'tex)
                             (if (eq window-system 'x)
                                 (font-lock-mode 1))
                             )))

(setq tex-dvi-print-command "dvips"
      tex-dvi-view-command "xdvi"
      tex-view-style "xdvi %d -paper us")
(setq tex-printer-default "lp1")



;;*********** Autoload texinfo mode

(load "texinfo")
(add-hook 'texinfo-mode-hook
          '(lambda ()
             (font-lock-mode t)
             (setq font-lock-keywords winmgr-font-lock-keywords)
           (font-lock-fontify-buffer)))

;;************** customizing fvwm like wm

(setq auto-mode-alist
      (append '(("\\.[A-Za-z]*wm$" . winmgr-mode)
               ("\\.[A-Za-z]*wm2rc" . winmgr-mode)
              ("\\.[A-Za-z]*wmrc*" . winmgr-mode)
              ("\\fvwm-*" . winmgr-mode))
              auto-mode-alist))

(autoload 'winmgr-mode "winmgr-mode"
  "Mode for editing window manager config files")

(add-hook 'winmgr-mode-hook
          '(lambda ()
             (font-lock-mode t)
             (setq font-lock-keywords winmgr-font-lock-keywords)
           (font-lock-fontify-buffer)))


;; Setting gauss-mode.el

(autoload 'gauss-mode "gauss-mode" "Enter Gauss-mode." t)
(setq gauss-check-all-num-for-matching-do t)
(setq gauss-blink-matching-if t)


;; ======================================================
;; This is the customization of the stata mode for emacs


(autoload 'stata"/usr/share/emacs/site-lisp/stata.el"  "inferior stata mode" t )
(autoload 'stata-help "stata" "stata help mode" t)
(autoload 'stata-mode "/usr/share/emacs/site-lisp/stata.el" "stata mode" t)

(if (assoc "\\.do$" auto-mode-alist) nil
  (setq auto-mode-alist
        (append 
         '(("\\.do$" . stata-mode)
           ("\\.ado$" . stata-mode))
         auto-mode-alist)))


; Here we add the mode which font-locking is not clearly available
; otherwise like Info-mode

(cond (window-system
        (setq hilit-mode-enable-list  '(;not        ;on enlève le not
                                       ;c-mode
                                       ;c++-mode
                                       ;makefile-mode
                                       ; outline-mode
                                        Info-mode 
                                        )
             hilit-background-mode   'dark
             hilit-inhibit-hooks     nil
             hilit-inhibit-rebinding nil)
        (require 'hilit19)))






>>>>> "fd" == Francois-Nicola Demers <[email protected]> writes:

fd> Bonjour,
fd> Est-ce qu'il y a moyen d'obtenir de la couleur (coloration pour la

fd> prog.) et un bon affichage des accents sous GNU Emacs en mode
fd> texte?  Pour l'instant, les accents sont remplacés par des "\351"
fd> (par exemple) ou des "?".

fd> Merci.

fd> F.-Nicola Demers [email protected]

-- 
==================================================================
Dominic Mitchell             Email: [email protected]
Department of Economics      
Queen's University
Kingston, Ontario            The XXI century starts on 2001-01-01!
Canada, K7L 3N6              Le XXI siècle débute le 2001-01-01!
==================================================================