dot/emacs, el/dot-emacs.el: Javascript support
[profile] / dot / emacs
index 5aa8918..80f0cb5 100644 (file)
--- a/dot/emacs
+++ b/dot/emacs
@@ -23,6 +23,7 @@
 
 (setq load-path (nconc load-path (list "~/lib/emacs")))
 (require 'dot-emacs)
+(require 'cl)
 
 ;;;--------------------------------------------------------------------------
 ;;; Some random initialisation.
 
 ;; ---- Some mail and news configuration ---
 
-(setq mail-from-style 'parens)
-(setq mail-signature t)
-(setq mail-yank-prefix "> ")
-(setq mail-archive-file-name "~/Mail/sent")
+(setq mail-from-style 'angles
+      mail-signature t
+      mail-yank-prefix "> "
+      mail-archive-file-name "~/Mail/sent"
+      compose-mail-user-agent-warnings nil)
 
 (setq rmail-display-summary t)
 (setq rmail-file-name "~/Mail/rmail")
 (setq message-signature-separator "^-- \\(\\|\\[mdw\\]\\)$"
       message-yank-prefix "> "
       message-yank-cited-prefix "> "
+      message-send-mail-function 'message-send-mail-with-sendmail
       message-indent-citation-function '(message-indent-citation
                                         mdw-trim-spaces-after-citing))
 
 (setq ispell-program-name "aspell-hack"
       ispell-local-dictionary "en_GB-ize-w_accents"
       flyspell-default-dictionary "en_GB-ize-w_accents"
+      ispell-local-dictionary-alist
+      '(("en_GB-ize-w_accents" "[[:alpha:]]" "[^[:alpha:]]" "'" t
+        ("-d" "en_GB-ize-w_accents") nil utf-8))
       ispell-silently-savep t)
 (trap
   (require 'uniquify)
 (setq display-time-24hr-format t)
 (display-time)
 (column-number-mode 1)
-(trap
-  (if window-system
-      (let ((view-diary-entries-initially t))
-       (calendar))))
+(trap (if window-system (calendar)))
 
 ;;;--------------------------------------------------------------------------
 ;;; MailCrypt.
 (add-hook 'org-agenda-mode-hook
          #'(lambda () (mdw-clobber-evil-keymap org-agenda-mode-map)))
 (or mdw-fast-startup
-    (progn
-      (org-remember-insinuate)
-      (global-set-key [?\C-c ?r] 'org-remember)))
+    (trap (progn
+           (org-remember-insinuate)
+           (global-set-key [?\C-c ?r] 'org-remember))))
 
 ;; Minor mode listing
 
        '(c-mode-hook c++-mode-hook objc-mode-hook java-mode-hook
          csharp-mode-hook perl-mode-hook cperl-mode-hook
          python-mode-hook pyrec-mode-hook icon-mode-hook awk-mode-hook
-         tcl-mode-hook go-mode-hook
+         tcl-mode-hook go-mode-hook js-mode-hook
          asm-mode-hook TeX-mode-hook LaTeX-mode-hook
          TeXinfo-mode-hook tex-mode-hook latex-mode-hook
          texinfo-mode-hook emacs-lisp-mode-hook scheme-mode-hook
               (tramp-remote-sh "/bin/sh"))
              ,@tramp-methods)))
      (setq tramp-default-method "ssh")
-     (setq tramp-default-method-alist
-          `(("\\`\\(localhost\\|\\)\\'" ""
-             ,(cond ((executable-find "become") "become")
-                    ((executable-find "really") "really")
-                    (t "su")))))))
+     (let ((rootlyness (cond ((executable-find "really") "really")
+                            ((executable-find "become") "become")
+                            ((executable-find "sudo") "sudo")
+                            (t "su")))
+          (this-host (concat "\\`\\(localhost\\|"
+                             (system-name) "\\|\\)\\'"))
+          (this-user (concat "\\`\\(" (user-login-name) "\\|"
+                             (user-real-login-name) "\\|\\)\\'")))
+       (setq tramp-default-method-alist
+            `((,this-host nil ,rootlyness)
+              (nil ,this-user "ssh")
+              (nil "." ,rootlyness)))
+       (setq tramp-default-proxies-alist
+            `((,this-host nil nil)
+              (nil "." "/ssh:%h:"))))))
 
 ;;;--------------------------------------------------------------------------
 ;;; General fontification.
   (add-hook 'apcalc-mode-hook 'mdw-fontify-apcalc t)
 
   (add-hook 'java-mode-hook 'mdw-fontify-java t)
+  (add-hook 'js-mode-hook 'mdw-fontify-javascript t)
   (add-hook 'csharp-mode-hook 'mdw-fontify-csharp t)
 
   (add-hook 'awk-mode-hook 'mdw-fontify-awk t)