;;(load custom-file 'noerror)
-;;; auto-complete
-
-;; auto-completion in minibuffer
-;; disabled while I look for another alternative
-;;(icomplete-mode)
-
-(unless (string= (daemonp) "server")
- (setq ac-use-comphist nil))
-(require 'auto-complete-config)
-(ac-config-default)
-
-
-;; complete after 1 char instead of default 2
-(setq ac-auto-start 1
- ac-delay 0.001)
-
-(add-to-list 'ac-modes 'org-mode 'sql-mode)
-
-
-;; for org mode completion source taken from wiki.
-;; it did not work. no idea why. todo, investigate
-;; the ac-sources code is at http://www.emacswiki.org/emacs/AutoCompleteSources
-;; i've deleted it here so as to save space and not spam this file
-;;(defun my-ac-org-mode ()
-;; (setq ac-sources (append ac-sources '(ac-source-org))))
-
-
-;; this makes the org-self-insert command not do a flyspell spell check.
-;; low priority thing to look into sometime
-(ac-flyspell-workaround)
-
-(define-key ac-completing-map (kbd "<up>") nil)
-(define-key ac-completing-map (kbd "<down>") nil)
-(define-key ac-completing-map (kbd "<S-return>") 'ac-expand)
-(define-key ac-completing-map "\t" 'ac-complete)
-;;(define-key ac-completing-map (kbd "<tab>") 'ac-complete)
-(define-key ac-completing-map (kbd "TAB") 'ac-complete)
-
-
-;;; auto-complete readline-complete
+;;; shell mode stuff
(require 'readline-complete)
;; not sure how I made these, but I deleted, and
;; it would be nice to make them again sometime
;;(require 'src-loaddefs)
-;; disabled cuz broken
-;; redefining function in readline-complete so ac-complete only uses readline as a source
-(defun ac-rlc-setup-sources ()
- "Add me to shell-mode-hook!"
- (setq ac-sources '(ac-source-shell)))
-(add-hook 'shell-mode-hook 'ac-rlc-setup-sources)
;; generally unnecessary, but why not
(setq explicit-shell-file-name "bash")
(setenv "EMACS" "")
(setq explicit-bash-args nil)
(setq comint-process-echoes t)
-;; default of 30 is way too slow. todo, consider pushing this upstream
-(setq rlc-attempts 5)
-
-(add-to-list 'ac-modes 'shell-mode)
-;; readline-complete recommends this (i assume this format),
-;; but greping finds no reference in emacs or my .emacs.d
-;; so I'm assuming it is for an older emacs
-;;(setq explicit-ssh-args '("-t"))
-(add-hook 'shell-mode-hook
- (lambda ()
- ;;(define-key shell-mode-map (kbd "<tab>") 'auto-complete)
- (define-key shell-mode-map (kbd "TAB") 'auto-complete)
- ))
+;; todo: consider if this is needed in company mode.
+;; and we also set shift-return to ac-expand.
+;;
+;; (add-hook 'shell-mode-hook
+;; (lambda ()
+;; ;;(define-key shell-mode-map (kbd "<tab>") 'auto-complete)
+;; (define-key shell-mode-map (kbd "TAB") 'auto-complete)
+;; ))
-;;; readline complete fix
;; I need this function here, where INSIDE_EMACS is replaced with LC_INSIDE_EMACS.
;; ian: last update 2017-1-7. update this periodically from upstream
(set-process-coding-system proc decoding encoding))
proc))
+;;; auto-complete
+
+(add-hook 'after-init-hook 'global-company-mode)
+
;;; auto save
;; todo: patch this so i can turn it off like my-as-off-local.
;; todo, this is causing error message on loading file, prolly not working
;;(flycheck-mode +1)
- (setq ac-sources (delq 'ac-source-dictionary ac-sources))
(highlight-symbol-mode)
(make-local-variable 'column-number-mode)
;; this says do autofilling using newcomment.el. The "only" is a misnomer.
(global-set-key (kbd "\r") 'indent-new-comment-line)
-;; don't use enter for autocomplete, we use tab or something
-(define-key ac-completing-map (kbd "<return>") nil)
-(define-key ac-completing-map "\r" nil)
-
(add-hook 'org-mode-hook
(lambda ()
;; copied from org-mode, replace org-enter with org-enter-indent
+;; auto-completion in minibuffer
+;; disabled while I look for another alternative
+;;(icomplete-mode)
+
+(unless (string= (daemonp) "server")
+ (setq ac-use-comphist nil))
+(require 'auto-complete-config)
+(ac-config-default)
+
+
+;; complete after 1 char instead of default 2
+(setq ac-auto-start 1
+ ac-delay 0.001)
+
+(add-to-list 'ac-modes 'org-mode 'sql-mode)
+
+
+;; for org mode completion source taken from wiki.
+;; it did not work. no idea why. todo, investigate
+;; the ac-sources code is at http://www.emacswiki.org/emacs/AutoCompleteSources
+;; i've deleted it here so as to save space and not spam this file
+;;(defun my-ac-org-mode ()
+;; (setq ac-sources (append ac-sources '(ac-source-org))))
+
+
+;; this makes the org-self-insert command not do a flyspell spell check.
+;; low priority thing to look into sometime
+(ac-flyspell-workaround)
+
+
+(define-key ac-completing-map (kbd "<up>") nil)
+(define-key ac-completing-map (kbd "<down>") nil)
+(define-key ac-completing-map (kbd "<S-return>") 'ac-expand)
+(define-key ac-completing-map "\t" 'ac-complete)
+;;(define-key ac-completing-map (kbd "<tab>") 'ac-complete)
+(define-key ac-completing-map (kbd "TAB") 'ac-complete)
+
+
+
+;;; auto-complete readline-complete
+
+(require 'readline-complete)
+;; not sure how I made these, but I deleted, and
+;; it would be nice to make them again sometime
+;;(require 'src-loaddefs)
+
+;; disabled cuz broken
+;; redefining function in readline-complete so ac-complete only uses readline as a source
+(defun ac-rlc-setup-sources ()
+ "Add me to shell-mode-hook!"
+ (setq ac-sources '(ac-source-shell)))
+(add-hook 'shell-mode-hook 'ac-rlc-setup-sources)
+
+
+;; readline-complete says to add this line.
+;; however, it up my procfs directory tracking hook
+;; because get-process doesn't notice the child shell.
+;; instead, I've removed export EMACS=t from
+;; comint-exec-1 (the function which initially sets it)
+;; by finding it in emacs sources and redefinind it here
+;; and done stty echo in my bashrc
+;;(setq explicit-bash-args '("-c" "export EMACS=; stty echo; bash"))
+
+;; generally unnecessary, but why not
+(setq explicit-shell-file-name "bash")
+(setenv "EMACS" "")
+(setq explicit-bash-args nil)
+(setq comint-process-echoes t)
+
+;; default of 30 is way too slow. todo, consider pushing this upstream
+(setq rlc-attempts 5)
+
+(add-to-list 'ac-modes 'shell-mode)
+
+;; readline-complete recommends this (i assume this format),
+;; but greping finds no reference in emacs or my .emacs.d
+;; so I'm assuming it is for an older emacs
+;;(setq explicit-ssh-args '("-t"))
+
+(add-hook 'shell-mode-hook
+ (lambda ()
+ ;;(define-key shell-mode-map (kbd "<tab>") 'auto-complete)
+ (define-key shell-mode-map (kbd "TAB") 'auto-complete)
+ ))
+
+
+;;; readline complete fix
+
+;; I need this function here, where INSIDE_EMACS is replaced with LC_INSIDE_EMACS.
+;; ian: last update 2017-1-7. update this periodically from upstream
+;; like when we do a major emacs update
+(defun comint-exec-1 (name buffer command switches)
+ (let ((process-environment
+ (nconc
+ ;; If using termcap, we specify `emacs' as the terminal type
+ ;; because that lets us specify a width.
+ ;; If using terminfo, we specify `dumb' because that is
+ ;; a defined terminal type. `emacs' is not a defined terminal type
+ ;; and there is no way for us to define it here.
+ ;; Some programs that use terminfo get very confused
+ ;; if TERM is not a valid terminal type.
+ ;; ;; There is similar code in compile.el.
+ (if (and (boundp 'system-uses-terminfo) system-uses-terminfo)
+ (list "TERM=dumb" "TERMCAP="
+ (format "COLUMNS=%d" (window-width)))
+ (list "TERM=emacs"
+ (format "TERMCAP=emacs:co#%d:tc=unknown:" (window-width))))
+ (list (format "LC_INSIDE_EMACS=%s,comint" emacs-version))
+ process-environment))
+ (default-directory
+ (if (file-accessible-directory-p default-directory)
+ default-directory
+ "/"))
+ proc decoding encoding changed)
+ (let ((exec-path (if (and command (file-name-directory command))
+ ;; If the command has slashes, make sure we
+ ;; first look relative to the current directory.
+ (cons default-directory exec-path) exec-path)))
+ (setq proc (apply 'start-file-process name buffer command switches)))
+ ;; Some file name handler cannot start a process, fe ange-ftp.
+ (unless (processp proc) (error "No process started"))
+ (let ((coding-systems (process-coding-system proc)))
+ (setq decoding (car coding-systems)
+ encoding (cdr coding-systems)))
+ ;; Even if start-file-process left the coding system for encoding data
+ ;; sent from the process undecided, we had better use the same one
+ ;; as what we use for decoding. But, we should suppress EOL
+ ;; conversion.
+ (if (and decoding (not encoding))
+ (setq encoding (coding-system-change-eol-conversion decoding 'unix)
+ changed t))
+ (if changed
+ (set-process-coding-system proc decoding encoding))
+ proc))
+
+
+;; don't use enter for autocomplete, we use tab or something
+(define-key ac-completing-map (kbd "<return>") nil)
+(define-key ac-completing-map "\r" nil)
+
+
+;;; removed from (defun prog-mode-defaults ()
+;;
+;;(setq ac-sources (delq 'ac-source-dictionary ac-sources))
+
+
+
+
+
+
+
;; git version of gnus
;; (add-to-list 'load-path "~/.emacs.d/src/gnus/lisp")
;; (eval-after-load "info"