[macemacsjp-english 729] Configuring Auctex and flyspell

Back to archive index

Brian J. Lopes statm****@gmail*****
Sun Nov 5 06:16:20 JST 2006


Hello Everyone,

I keep having trouble configuring the newer version of Carbon Emacs to
work with Auctex and flyspell.  For some reason, if I try to run emacs
with --debug-init it doesn't know those flags.  What I want is to
enable a bunch of options in Auctex as well as enable flyspell while
in latex mode.  The parts I have for text mode are:

(setq default-major-mode 'text-mode) ;Set default mode to be text
(add-hook 'text-mode-hook 'flyspell-mode) ; flyspell for text mode
(add-hook 'text-mode-hook 'turn-on-auto-fill) ;Enable line breaks in text

And what I want in LaTeX mode is:

(require 'tex-site)

;(add-hook 'LaTeX-mode-hook 'turn-on-auto-fill)
(add-hook 'LaTeX-mode-hook
   (function (lambda ()
                (require 'reftex)
                (turn-on-reftex)
                (setq reftex-plug-into-AUCTeX t)
                (outline-minor-mode)
                (turn-on-auto-fill)
                (setq ispell-parser 'tex)
                (flyspell-mode)
                (setq TeX-auto-save t)
                (setq TeX-parse-self t)
                (setq-default TeX-master nil)
                 )))

Now it seems to run flyspell and auto-fill when in text mode, but
neither of them seem to work when I'm in LaTeX mode.  Could someone
please help me, I think I'm going insane.  Just when I thought I might
actually understand my .emacs file, I just proved that I just created
a cut-and-paste monster.

I will enclose the full emacs for reference below this, so please
ignore if if you don't want to parse the huge file.

Thanks,
Brian



=====================================================================
;MY .emacs FILE
;Note the extra lisp packages I downloaded to ~/.elisp
;This website is done using the htmlize package on emacs
 
;; Mark highlighted regions (in X)
(setq-default transient-mark-mode t) 
(setq mark-even-if-inactive t)

;; OS X style text selection/movement
(pc-selection-mode)


(server-start) ;Start emacsclient server

(setq inhibit-startup-messsage t) ;Go straight to file (not working on OS X)

(setq default-major-mode 'text-mode) ;Set default mode to be text
(add-hook 'text-mode-hook 'flyspell-mode) ; flyspell for text mode
(add-hook 'text-mode-hook 'turn-on-auto-fill) ;Enable line breaks in text


(add-hook 'html-mode-hook 'turn-off-auto-fill) ; Disable line breaks in html

(display-time) ;;to display time

(setq column-number-mode t) ; show column numbers

(set-cursor-color "red") ;;to set the cursor color

(defun fix-stupid-backspace-key-issue ()
  "Fix this dumb terminal. Ugh."
  (interactive)
  (unless window-system ; No need to do this in them. :)
    ;; The following two lines are from the `Keyboard Translations' page
    ;; of the Emacs manual.
    ;; Translate `C-h' to <DEL>.
    (keyboard-translate ?\C-h ?\C-?)
    (message "Backspce has been fixed.")))

(if window-system 
    (progn
;    (pc-selection-mode) ;M$ Windows-like keybindings (blocks transient-mark-mode for some reason)
;    (set-default-font "-*-*-medium-r-*-*-16-*-*-*-*-*-iso8859-1") ;Set default font
    (set-foreground-color "#aec2e3") ;;if X window set foreground color to carolina blue
    (set-background-color "#10224a")) ;;if X window set background to dark blue
    (progn
;    (fix-stupid-backspace-key-issue) ;Call command automatically see below (Not necessary on OS X)
    (set-foreground-color "white");if using -nw then foreground white
    (set-background-color "black"))) ;;if using -nw then background black


(global-set-key [(control tab)] 'other-window) ;set so that C-TAB cycles windows

;;;================= Use recommended R formatting =======================
;;; C 
(add-hook 'c-mode-hook 
(lambda () (c-set-style "bsd"))) 
;;; ESS 
(add-hook 'ess-mode-hook 
(lambda () 
(ess-set-style 'C++) 
;; Because 
;; DEF GNU BSD K&R C++ 
;; ess-indent-level 2 2 8 5 4 
;; ess-continued-statement-offset 2 2 8 5 4 
;; ess-brace-offset 0 0 -8 -5 -4 
;; ess-arg-function-offset 2 4 0 0 0 
;; ess-expression-offset 4 2 8 5 4 
;; ess-else-offset 0 0 0 0 0 
;; ess-close-brace-offset 0 0 0 0 0 
(add-hook 'local-write-file-hooks 
(lambda () 
(ess-nuke-trailing-whitespace))))) 
(setq ess-nuke-trailing-whitespace-p 'ask) 
;; or even 
;; (setq ess-nuke-trailing-whitespace-p t) 
;;; Perl 
(add-hook 'perl-mode-hook 
(lambda () (setq perl-indent-level 4))) 
;;;======================================================================



;;Scrolling window display by arrow keys
(defvar smooth-scroll-step 1
  "Smooth scroll commands bound to <control> + <arrow keys> scroll window display as many characters as this value by default.")

;; Set up C-x <left> and C-x <right> for easy buffer movement
;; This use will be available in Emacs 22 as next/previous-buffer

(if (< emacs-major-version 22)
    (progn
      (defalias 'switch-to-next-buffer 'bury-buffer)
      (defun switch-to-previous-buffer ()
        "Switches to previous buffer"
        (interactive)
        (switch-to-buffer (nth (- (length (buffer-list)) 1) (buffer-list))))))
(if (< emacs-major-version 22)          ; Use C-x <left> and C-x <right>
    (progn                              ; for buffer navigation
      (global-set-key [(control x) (left)] 'switch-to-previous-buffer)
      (global-set-key [(control x) (right)] 'switch-to-next-buffer)))


;;;;;;;;;;;EMACS LISP PACKAGES;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;You can use C-h p (for finder-by-keyword) for list of available packages on system

(setq load-path (append load-path (list nil "/Applications/myapps/Emacs.app/Contents/Resources/lisp") load-path)) ; Look in Carbon Emacs lisp folder next (for Mac emacs)
(setq load-path (append load-path (list nil "/Applications/myapps/Emacs.app/Contents/Resources/site-lisp") load-path)) ; Look in Carbon Emacs lisp folder next (for Mac emacs)
(setq load-path (append load-path (list nil "~/.elisp") load-path)) ; Look in local elisp folder first

;; (setq load-path (append load-path (list nil "/Applications/myapps/Emacs.app/Contents/Resources/site-lisp") load-path)) ; Look in Carbon Emacs lisp folder next (for Mac emacs)
;; (setq load-path (append load-path (list nil "/Applications/myapps/Emacs.app/Contents/Resources/share/emacs/22.0.50/site-lisp") load-path))


;; ripped from 
;; http://www.tug.org/pipermail/macostex-archives/2004-September/009765.html
;; To load AUCTeX (Enhanced LaTeX editing)
;; tex/auctex stuff
(require 'tex-site)

;(add-hook 'LaTeX-mode-hook 'turn-on-auto-fill)
(add-hook 'LaTeX-mode-hook
 	  (function (lambda ()
 		      (require 'reftex)
 		      (turn-on-reftex)
 		      (setq reftex-plug-into-AUCTeX t)
 		      (outline-minor-mode)
  		      (turn-on-auto-fill)
 		      (setq ispell-parser 'tex)
 		      (flyspell-mode)
 		      (setq TeX-auto-save t)
 		      (setq TeX-parse-self t)
 		      (setq-default TeX-master nil)
 		      )))



;; To load reverse-search on latex documents
(require 'xdvi-search)

;; To load ispell for spell-checking
(require 'ispell)


;; Html Helper Mode
;; http://www.nongnu.org/baol-hth/index.html
;; http://www.nongnu.org/baol-hth
; Great package, but I'm not a fan of their indentation
(autoload 'html-helper-mode "html-helper-mode" "Yay HTML" t)
(setq auto-mode-alist (cons '("\\.html$" . html-helper-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.php$" . html-helper-mode) auto-mode-alist))
;(setq html-helper-address-string "brlop****@WNT*****")
(defvar html-helper-never-indent 1) ;Turn off indentation in html-helper-mode

;; CSS mode
;; http://www.garshol.priv.no/download/software/css-mode
(autoload 'css-mode "css-mode")
(setq auto-mode-alist (cons '("\\.css\\'" . css-mode) auto-mode-alist))
(setq cssm-indent-function #'cssm-c-style-indenter)

;; Convert the current buffer into colour HTML output
;; http://fly.srk.fer.hr/~hniksic/emacs
(require 'htmlize) 

;; To load sgml-mode for SGML & HTML editing
(require 'sgml-mode)

;; Lisp packages only to be used on Carbon Emacs
;; They have problems with Apple emacs
(when (eq window-system 'mac)
;; To load ess (Emacs Speaks Statistics)
(require 'ess-site)
;; Use w3m mode in emacs
(setq w3m-command "/sw/bin/w3m")
(require 'w3m-load)
;; To load preview LaTeX (included in AucTeX)
(load "preview.el" nil t t)

;; Set Mac Print dialog
(when (fboundp 'mac-print-mode)
  (mac-print-mode 1)
  (global-set-key (kbd "C-c p") 'mac-print-buffer))

)



;To set the default frame parameters in OS X Emacs Carbon
(setq default-frame-alist
      (append
       (list
        '(active-alpha . 0.9)  ;; active frame
        '(inactive-alpha . 0.8) ;; non active frame
        ) default-frame-alist)
      )


;;;;;;;;;;;;;;;;;;;;;;OS X Tricks;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun tiger-speaks (beg end)
  "Read the text in the region using Tiger command 'say'"
  (interactive "r")
  (shell-command-on-region beg end "say"))

;;; Macintosh fonts
;(set-terminal-coding-system 'iso-8859-1)
;(setq mac-keyboard-text-encoding kTextEncodingMacRoman)
;(setq mac-keyboard-text-encoding =20 kTextEncodingISOLatin2)
;(setq default-frame-alist '((width . 126)
;                            (height . 48)
;                            (font . "fontset-mac")))

;;; This is to set fonts for Carbon emacs
(when (eq window-system 'mac)
  (require 'carbon-font)
  (fixed-width-set-default-fontset "-*-*-medium-r-normal--16-*-*-*-*-*-fontset-hiraginomin")

;; disable Mac anti-aliasing fonts
(setq mac-allow-anti-aliasing nil)  ;; turn off anti-aliasing

;; set location of Emacs in OS X
(set-frame-position (selected-frame) 40 20)
;; Set dimensions
(set-frame-size (selected-frame) 90 39)
)






More information about the macemacsjp-english mailing list
Back to archive index