[Malvern] Any emacs wizards out there?

Phil Ironside phil at creativespaces.co.uk
Mon Jul 3 22:00:06 BST 2006


Hi Rob

I'm not a great emacs user but I do dabble now ann then when I feel the 
urge. Just curious why you decided to give it  a try?

Have you tried deleting/commenting out different lines and then 
re-starting it/

On 3 Jul 2006, at 18:27, Robin Wilson wrote:

> Hi
>
> I don't know if there are any emacs wizards on this mailing list, but 
> I wouldn't be surprised if there were, so I thought I'd try my 
> question here.
>
> Basically, I've just started using emacs, and I love it already, and 
> have been configuring things just how I like them in my .emacs file. 
> However, when I start emacs it tells me there is an error in the 
> .emacs file and says "End of file during parsing". I've had a look in 
> my .emacs file for any obvious errors, but can't find any.
>
> I must say I'm not an expert at .emacs files, and most of this file 
> was bits from elsewhere on the net all put together in one file.
>
> It'd be great if one of you could help, and I've pasted the contents 
> of my .emacs file below.
>
> Cheers,
>
> Robin
>
>
> ---Listing of .emacs file starts below---
>
> ;; -*-Emacs-Lisp-*-
> (global-set-key "\C-w"     'backward-kill-word)
> (global-set-key "\C-x\C-k" 'kill-region)
> (global-set-key "\C-c\C-k" 'kill-region)
>
> ;; This file is designed to be re-evaled; use the variable first-time
> ;; to avoid any problems with this.
> (defvar first-time t
>   "Flag signifying this is the first time that .emacs has been evaled")
>
> ;; Function keys
> (global-set-key [f1] 'manual-entry)
> (global-set-key [f2] 'info)
> (global-set-key [f3] 'repeat-complex-command)
> (global-set-key [f4] 'advertised-undo)
> (global-set-key [f5] 'compile)
> (global-set-key [f6] 'previous-error)
> (global-set-key [f7] 'next-error)
> (global-set-key [f8] 'find-file)
> (global-set-key [f9] 'save-buffer)
> (global-set-key [f10] 'buffer-list)
> (global-set-key [f11] 'compile)
> (global-set-key [f12] 'direc)
> (global-set-key [C-f1] 'comp
>
> ;; Mouse
> (global-set-key [mouse-3] 'imenu)
>
> ;; Misc
> (global-set-key [C-tab] "\C-q\t")   ; Control tab quotes a tab.
> (setq backup-by-copying-when-mismatch t)
> ;; Treat 'y' or <CR> as yes, 'n' as no.
> (fset 'yes-or-no-p 'y-or-n-p)
>
> ;; Load packages
> (require 'desktop)
> (require 'tar-mode)
>
> ;; Pretty diff mode
> (autoload 'ediff-buffers "ediff" "Intelligent Emacs interface to diff" 
> t)
> (autoload 'ediff-files "ediff" "Intelligent Emacs interface to diff" t)
> (autoload 'ediff-files-remote "ediff"
>   "Intelligent Emacs interface to diff")
>
> (if first-time
>     (setq auto-mode-alist
>       (append '(("\\.cpp$" . c++-mode)
>             ("\\.hpp$" . c++-mode)
>             ("\\.lsp$" . lisp-mode)
>             ("\\.scm$" . scheme-mode)
>             ("\\.pl$" . perl-mode)
>             ) auto-mode-alist)))
>
> ;; Auto font lock mode
> (defvar font-lock-auto-mode-list
>   (list 'c-mode 'c++-mode 'c++-c-mode 'emacs-lisp-mode 'lisp-mode 
> 'perl-mode 'scheme-mode)
>   "List of modes to always start in font-lock-mode")
>
> (defvar font-lock-mode-keyword-alist
>   '((c++-c-mode . c-font-lock-keywords)
>     (perl-mode . perl-font-lock-keywords))
>   "Associations between modes and keywords")
>
> (defun font-lock-auto-mode-select ()
>   "Automatically select font-lock-mode if the current major mode is in 
> font-lock-auto-mode-list"
>   (if (memq major-mode font-lock-auto-mode-list)
>       (progn
>     (font-lock-mode t))
>     )
>   )
>
> (global-set-key [M-f1] 'font-lock-fontify-buffer)
>
> ;; New dabbrev stuff
> ;(require 'new-dabbrev)
> (setq dabbrev-always-check-other-buffers t)
> (setq dabbrev-abbrev-char-regexp "\\sw\\|\\s_")
> (add-hook 'emacs-lisp-mode-hook
>       '(lambda ()
>          (set (make-local-variable 'dabbrev-case-fold-search) nil)
>          (set (make-local-variable 'dabbrev-case-replace) nil)))
> (add-hook 'c-mode-hook
>       '(lambda ()
>          (set (make-local-variable 'dabbrev-case-fold-search) nil)
>          (set (make-local-variable 'dabbrev-case-replace) nil)))
> (add-hook 'text-mode-hook
>       '(lambda ()
>          (set (make-local-variable 'dabbrev-case-fold-search) t)
>          (set (make-local-variable 'dabbrev-case-replace) t)))
>
> ;; C++ and C mode...
> (defun my-c++-mode-hook ()
>   (setq tab-width 4)
>   (define-key c++-mode-map "\C-m" 'reindent-then-newline-and-indent)
>   (define-key c++-mode-map "\C-ce" 'c-comment-edit)
>   (setq c++-auto-hungry-initial-state 'none)
>   (setq c++-delete-function 'backward-delete-char)
>   (setq c++-tab-always-indent t)
>   (setq c-indent-level 4)
>   (setq c-continued-statement-offset 4)
>   (setq c++-empty-arglist-indent 4))
>
> (defun my-c-mode-hook ()
>   (setq tab-width 4)
>   (define-key c-mode-map "\C-m" 'reindent-then-newline-and-indent)
>   (define-key c-mode-map "\C-ce" 'c-comment-edit)
>   (setq c-auto-hungry-initial-state 'none)
>   (setq c-delete-function 'backward-delete-char)
>   (setq c-tab-always-indent t)
> ;; BSD-ish indentation style
>   (setq c-indent-level 4)
>   (setq c-continued-statement-offset 4)
>   (setq c-brace-offset -4)
>   (setq c-argdecl-indent 0)
>   (setq c-label-offset -4))
>
> ;; Perl mode
> (defun my-perl-mode-hook ()
>   (setq tab-width 4)
>   (define-key c++-mode-map "\C-m" 'reindent-then-newline-and-indent)
>   (setq perl-indent-level 4)
>   (setq perl-continued-statement-offset 4))
>
> ;; Scheme mode...
> (defun my-scheme-mode-hook ()
>   (define-key scheme-mode-map "\C-m" 
> 'reindent-then-newline-and-indent))
>
> ;; Emacs-Lisp mode...
> (defun my-lisp-mode-hook ()
>   (define-key lisp-mode-map "\C-m" 'reindent-then-newline-and-indent)
>   (define-key lisp-mode-map "\C-i" 'lisp-indent-line)
>   (define-key lisp-mode-map "\C-j" 'eval-print-last-sexp))
>
> ;; Add all of the hooks...
> (add-hook 'c++-mode-hook 'my-c++-mode-hook)
> (add-hook 'c-mode-hook 'my-c-mode-hook)
> (add-hook 'scheme-mode-hook 'my-scheme-mode-hook)
> (add-hook 'emacs-lisp-mode-hook 'my-lisp-mode-hook)
> (add-hook 'lisp-mode-hook 'my-lisp-mode-hook)
> (add-hook 'perl-mode-hook 'my-perl-mode-hook)
>
> ;; Complement to next-error
> (defun previous-error (n)
>   "Visit previous compilation error message and corresponding source 
> code."
>   (interactive "p")
>   (next-error (- n)))
>
> ;; Misc...
> (transient-mark-mode 1)
> (setq mark-even-if-inactive t)
> (setq visible-bell nil)
> (setq next-line-add-newlines nil)
> (setq compile-command "make")
> (setq suggest-key-bindings nil)
> (put 'eval-expression 'disabled nil)
> (put 'narrow-to-region 'disabled nil)
> (put 'set-goal-column 'disabled nil)
> (if (>= emacs-major-version 21)
>     (setq show-trailing-whitespace t))
>
> ;; Elisp archive searching
> (autoload 'format-lisp-code-directory "lispdir" nil t)
> (autoload 'lisp-dir-apropos "lispdir" nil t)
> (autoload 'lisp-dir-retrieve "lispdir" nil t)
> (autoload 'lisp-dir-verify "lispdir" nil t)
>
> ;; Font lock mode
> (defun my-make-face (face color &optional bold)
>   "Create a face from a color and optionally make it bold"
>   (make-face face)
>   (copy-face 'default face)
>   (set-face-foreground face color)
>   (if bold (make-face-bold face))
>   )
>
> (if (eq window-system 'x)
>     (progn
>       (my-make-face 'blue "blue")
>       (my-make-face 'red "red")
>       (my-make-face 'green "dark green")
>       (setq font-lock-comment-face 'blue)
>       (setq font-lock-string-face 'bold)
>       (setq font-lock-type-face 'bold)
>       (setq font-lock-keyword-face 'bold)
>       (setq font-lock-function-name-face 'red)
>       (setq font-lock-doc-string-face 'green)
>       (add-hook 'find-file-hooks 'font-lock-auto-mode-select)
>
>       (setq baud-rate 1000000)
>       (global-set-key "\C-cmm" 'menu-bar-mode)
>       (global-set-key "\C-cms" 'scroll-bar-mode)
>       (global-set-key [backspace] 'backward-delete-char)
>                     ;      (global-set-key [delete] 'delete-char)
>       (standard-display-european t)
>       (load-library "iso-transl")))
>
> ;; X11 or PC using direct screen writes
> (if window-system
>     (progn
>       ;;      (global-set-key [M-f1] 'hilit-repaint-command)
>       ;;      (global-set-key [M-f2] [?\C-u M-f1])
>       (setq hilit-mode-enable-list
>         '(not text-mode c-mode c++-mode emacs-lisp-mode lisp-mode
>           scheme-mode)
>         hilit-auto-highlight nil
>         hilit-auto-rehighlight 'visible
>         hilit-inhibit-hooks nil
>         hilit-inhibit-rebinding t)
>       (require 'hilit19)
>       (require 'paren))
>   (setq baud-rate 2400)         ; For slow serial connections
>   )
>
> ;; TTY type terminal
> (if (and (not window-system)
>      (not (equal system-type 'ms-dos)))
>     (progn
>       (if first-time
>       (progn
>         (keyboard-translate ?\C-h ?\C-?)
>         (keyboard-translate ?\C-? ?\C-h)))))
>
> ;; Under UNIX
> (if (not (equal system-type 'ms-dos))
>     (progn
>       (if first-time
>       (server-start))))
>
> ;; Add any face changes here
> (add-hook 'term-setup-hook 'my-term-setup-hook)
> (defun my-term-setup-hook ()
>   (if (eq window-system 'pc)
>       (progn
> ;;  (set-face-background 'default "red")
>     )))
>
> ;; Indicate that this file has been read at least once
> (setq first-time nil)
>
> ---Listing of .emacs file ends here---
>
>
> _______________________________________________
> Malvern mailing list
> Malvern at mailman.lug.org.uk
> https://mailman.lug.org.uk/mailman/listinfo/malvern
>




More information about the Malvern mailing list