text:
How do I create a fully customized keymap, so that I can use that instead of the default global one?
My .emacs file is over 1500 lines long mainly because of unbinding a ton of global keybinds.

I've searched all over and could find no tutorials for making a fully customized keymap from scratch.

I know I can totally obliterate the global keymap by (use-global-map (make-sparse-keymap)).

But where do I go from there?
;;-----------------------------------------------------------------;;
;;-----------------------------------------------------------------;;
;;-----------------------------------------------------------------;;
;;-------------------------KEYBINDINGS-----------------------------;;
;;-----------------------------------------------------------------;;
;;-----------------------------------------------------------------;;
;;-----------------------------------------------------------------;;

;; Nothing
(defun x ()
  (interactive)
  (message "NULL"))

(require 'bind-key)

(define-key input-decode-map [?\C-i] (kbd "<C-i>"))
(define-key input-decode-map [?\C-\S-i] (kbd "<C-S-i>"))
(define-key input-decode-map [?\C-m] (kbd "<C-m>"))

;;-----------------------------------------------------------------;;
;;-------------------------UNBOUND KEYS----------------------------;;
;;-----------------------------------------------------------------;;

;; Numbers And Symbols
(bind-key* "C-`" 'x)
(bind-key* "C-1" 'x)
(bind-key* "C-2" 'x)
(bind-key* "C-3" 'x)
(bind-key* "C-4" 'x)
(bind-key* "C-5" 'x)
(bind-key* "C-6" 'x)
(bind-key* "C-7" 'x)
(bind-key* "C-8" 'x)
(bind-key* "C-9" 'x)
(bind-key* "C-0" 'x)
(bind-key* "C--" 'x)
(bind-key* "C-=" 'x)

(bind-key* "C-~" 'x)
(bind-key* "C-!" 'x)
(bind-key* "C-@" 'x)
(bind-key* "C-#" 'x)
(bind-key* "C-$" 'x)
(bind-key* "C-%" 'x)
(bind-key* "C-^" 'x)
(bind-key* "C-&" 'x)
(bind-key* "C-*" 'x)
(bind-key* "C-(" 'x)
(bind-key* "C-)" 'x)
(bind-key* "C-_" 'x)
(bind-key* "C-+" 'x)

(bind-key* "M-`" 'x)
(bind-key* "M-1" 'x)
(bind-key* "M-2" 'x)
(bind-key* "M-3" 'x)
(bind-key* "M-4" 'x)
(bind-key* "M-5" 'x)
(bind-key* "M-6" 'x)
(bind-key* "M-7" 'x)
(bind-key* "M-8" 'x)
(bind-key* "M-9" 'x)
(bind-key* "M-0" 'x)
(bind-key* "M--" 'x)
(bind-key* "M-=" 'x)

(bind-key* "M-~" 'x)
(bind-key* "M-!" 'x)
(bind-key* "M-@" 'x)
(bind-key* "M-#" 'x)
(bind-key* "M-$" 'x)
(bind-key* "M-%" 'x)
(bind-key* "M-^" 'x)
(bind-key* "M-&" 'x)
(bind-key* "M-*" 'x)
(bind-key* "M-(" 'x)
(bind-key* "M-)" 'x)
(bind-key* "M-_" 'x)
(bind-key* "M-+" 'x)

(bind-key* "C-M-`" 'x)
(bind-key* "C-M-1" 'x)
(bind-key* "C-M-2" 'x)
(bind-key* "C-M-3" 'x)
(bind-key* "C-M-4" 'x)
(bind-key* "C-M-5" 'x)
(bind-key* "C-M-6" 'x)
(bind-key* "C-M-7" 'x)
(bind-key* "C-M-8" 'x)
(bind-key* "C-M-9" 'x)
(bind-key* "C-M-0" 'x)
(bind-key* "C-M--" 'x)
(bind-key* "C-M-=" 'x)

(bind-key* "C-M-~" 'x)
(bind-key* "C-M-!" 'x)
(bind-key* "C-M-@" 'x)
(bind-key* "C-M-#" 'x)
(bind-key* "C-M-$" 'x)
(bind-key* "C-M-%" 'x)
(bind-key* "C-M-^" 'x)
(bind-key* "C-M-&" 'x)
(bind-key* "C-M-*" 'x)
(bind-key* "C-M-(" 'x)
(bind-key* "C-M-)" 'x)
(bind-key* "C-M-_" 'x)
(bind-key* "C-M-+" 'x)
;; End Numbers And Symbols

;; Letters And Symbols
(bind-key* "C-a" 'x)
(bind-key* "C-b" 'x)
(bind-key* "C-d" 'x)
(bind-key* "C-e" 'x)
(bind-key* "C-f" 'x)
(bind-key* "C-g" 'x)
(bind-key* "C-h" 'x)
(bind-key* "C-k" 'x)
(bind-key* "C-n" 'x)
(bind-key* "C-o" 'x)
(bind-key* "C-p" 'x)
(bind-key* "C-q" 'x)
(bind-key* "C-r" 'x)
(bind-key* "C-s" 'x)
(bind-key* "C-t" 'x)
(bind-key* "C-u" 'x)
(bind-key* "C-v" 'x)
(bind-key* "C-w" 'x)
(bind-key* "C-y" 'x)
(bind-key* "C-z" 'x)
(bind-key* "C-]" 'x)
(bind-key* "C-\\" 'x)
(bind-key* "C-;" 'x)
(bind-key* "C-'" 'x)
(bind-key* "C-," 'x)
(bind-key* "C-." 'x)
(bind-key* "C-/" 'x)

(bind-key* "C-A" 'x)
(bind-key* "C-B" 'x)
(bind-key* "C-D" 'x)
(bind-key* "C-E" 'x)
(bind-key* "C-F" 'x)
(bind-key* "C-G" 'x)
(bind-key* "C-H" 'x)
(bind-key* "C-K" 'x)
(bind-key* "C-N" 'x)
(bind-key* "C-O" 'x)
(bind-key* "C-P" 'x)
(bind-key* "C-Q" 'x)
(bind-key* "C-R" 'x)
(bind-key* "C-S" 'x)
(bind-key* "C-T" 'x)
(bind-key* "C-U" 'x)
(bind-key* "C-V" 'x)
(bind-key* "C-W" 'x)
(bind-key* "C-Y" 'x)
(bind-key* "C-Z" 'x)
(bind-key* "C-{" 'x)
(bind-key* "C-}" 'x)
(bind-key* "C-|" 'x)
(bind-key* "C-:" 'x)
(bind-key* "C-\"" 'x)
(bind-key* "C-<" 'x)
(bind-key* "C->" 'x)
(bind-key* "C-?" 'x)

(bind-key* "M-a" 'x)
(bind-key* "M-b" 'x)
(bind-key* "M-c" 'x)
(bind-key* "M-d" 'x)
(bind-key* "M-e" 'x)
(bind-key* "M-f" 'x)
(bind-key* "M-g" 'x)
(bind-key* "M-h" 'x)
(bind-key* "M-i" 'x)
(bind-key* "M-j" 'x)
(bind-key* "M-k" 'x)
(bind-key* "M-l" 'x)
(bind-key* "M-m" 'x)
(bind-key* "M-n" 'x)
(bind-key* "M-o" 'x)
(bind-key* "M-p" 'x)
(bind-key* "M-q" 'x)
(bind-key* "M-r" 'x)
(bind-key* "M-s" 'x)
(bind-key* "M-t" 'x)
(bind-key* "M-u" 'x)
(bind-key* "M-v" 'x)
(bind-key* "M-w" 'x)
(bind-key* "M-y" 'x)
(bind-key* "M-z" 'x)
(bind-key* "M-[" 'x)
(bind-key* "M-]" 'x)
(bind-key* "M-\\" 'x)
(bind-key* "M-;" 'x)
(bind-key* "M-'" 'x)
(bind-key* "M-," 'x)
(bind-key* "M-." 'x)
(bind-key* "M-/" 'x)

(bind-key* "M-A" 'x)
(bind-key* "M-B" 'x)
(bind-key* "M-C" 'x)
(bind-key* "M-D" 'x)
(bind-key* "M-E" 'x)
(bind-key* "M-F" 'x)
(bind-key* "M-G" 'x)
(bind-key* "M-H" 'x)
(bind-key* "M-M" 'x)
(bind-key* "M-N" 'x)
(bind-key* "M-P" 'x)
(bind-key* "M-Q" 'x)
(bind-key* "M-R" 'x)
(bind-key* "M-S" 'x)
(bind-key* "M-T" 'x)
(bind-key* "M-V" 'x)
(bind-key* "M-W" 'x)
(bind-key* "M-Y" 'x)
(bind-key* "M-Z" 'x)
(bind-key* "M-{" 'x)
(bind-key* "M-}" 'x)
(bind-key* "M-|" 'x)
(bind-key* "M-:" 'x)
(bind-key* "M-\"" 'x)
(bind-key* "M-<" 'x)
(bind-key* "M->" 'x)
(bind-key* "M-?" 'x)

(bind-key* "C-M-a" 'x)
(bind-key* "C-M-b" 'x)
(bind-key* "C-M-c" 'x)
(bind-key* "C-M-d" 'x)
(bind-key* "C-M-e" 'x)
(bind-key* "C-M-f" 'x)
(bind-key* "C-M-g" 'x)
(bind-key* "C-M-h" 'x)
(bind-key* "C-M-i" 'x)
(bind-key* "C-M-j" 'x)
(bind-key* "C-M-k" 'x)
(bind-key* "C-M-l" 'x)
(bind-key* "C-M-m" 'x)
(bind-key* "C-M-n" 'x)
(bind-key* "C-M-o" 'x)
(bind-key* "C-M-p" 'x)
(bind-key* "C-M-q" 'x)
(bind-key* "C-M-r" 'x)
(bind-key* "C-M-s" 'x)
(bind-key* "C-M-t" 'x)
(bind-key* "C-M-u" 'x)
(bind-key* "C-M-v" 'x)
(bind-key* "C-M-w" 'x)
(bind-key* "C-M-x" 'x)
(bind-key* "C-M-y" 'x)
(bind-key* "C-M-z" 'x)
(bind-key* "C-M-[" 'x)
(bind-key* "C-M-]" 'x)
(bind-key* "C-M-\\" 'x)
(bind-key* "C-M-;" 'x)
(bind-key* "C-M-'" 'x)
(bind-key* "C-M-," 'x)
(bind-key* "C-M-." 'x)
(bind-key* "C-M-/" 'x)

(bind-key* "C-M-A" 'x)
(bind-key* "C-M-B" 'x)
(bind-key* "C-M-C" 'x)
(bind-key* "C-M-D" 'x)
(bind-key* "C-M-E" 'x)
(bind-key* "C-M-F" 'x)
(bind-key* "C-M-G" 'x)
(bind-key* "C-M-H" 'x)
(bind-key* "C-M-I" 'x)
(bind-key* "C-M-J" 'x)
(bind-key* "C-M-K" 'x)
(bind-key* "C-M-L" 'x)
(bind-key* "C-M-M" 'x)
(bind-key* "C-M-N" 'x)
(bind-key* "C-M-O" 'x)
(bind-key* "C-M-P" 'x)
(bind-key* "C-M-Q" 'x)
(bind-key* "C-M-R" 'x)
(bind-key* "C-M-S" 'x)
(bind-key* "C-M-T" 'x)
(bind-key* "C-M-U" 'x)
(bind-key* "C-M-V" 'x)
(bind-key* "C-M-W" 'x)
(bind-key* "C-M-X" 'x)
(bind-key* "C-M-Y" 'x)
(bind-key* "C-M-Z" 'x)
(bind-key* "C-M-{" 'x)
(bind-key* "C-M-}" 'x)
(bind-key* "C-M-|" 'x)
(bind-key* "C-M-:" 'x)
(bind-key* "C-M-\"" 'x)
(bind-key* "C-M-<" 'x)
(bind-key* "C-M->" 'x)
(bind-key* "C-M-?" 'x)
;; End Letters And Symbols

;; Numbers And Symbols With C-x Prefix
(bind-key* "C-x `" 'x)
(bind-key* "C-x 1" 'x)
(bind-key* "C-x 2" 'x)
(bind-key* "C-x 3" 'x)
(bind-key* "C-x 4" 'x)
(bind-key* "C-x 5" 'x)
(bind-key* "C-x 6" 'x)
(bind-key* "C-x 7" 'x)
(bind-key* "C-x 8" 'x)
(bind-key* "C-x 9" 'x)
(bind-key* "C-x 0" 'x)
(bind-key* "C-x -" 'x)
(bind-key* "C-x =" 'x)

(bind-key* "C-x ~" 'x)
(bind-key* "C-x !" 'x)
(bind-key* "C-x @" 'x)
(bind-key* "C-x #" 'x)
(bind-key* "C-x $" 'x)
(bind-key* "C-x %" 'x)
(bind-key* "C-x ^" 'x)
(bind-key* "C-x &" 'x)
(bind-key* "C-x *" 'x)
(bind-key* "C-x (" 'x)
(bind-key* "C-x )" 'x)
(bind-key* "C-x _" 'x)
(bind-key* "C-x +" 'x)

(bind-key* "C-x C-`" 'x)
(bind-key* "C-x C-1" 'x)
(bind-key* "C-x C-2" 'x)
(bind-key* "C-x C-3" 'x)
(bind-key* "C-x C-4" 'x)
(bind-key* "C-x C-5" 'x)
(bind-key* "C-x C-6" 'x)
(bind-key* "C-x C-7" 'x)
(bind-key* "C-x C-8" 'x)
(bind-key* "C-x C-9" 'x)
(bind-key* "C-x C-0" 'x)
(bind-key* "C-x C--" 'x)
(bind-key* "C-x C-=" 'x)

(bind-key* "C-x C-~" 'x)
(bind-key* "C-x C-!" 'x)
(bind-key* "C-x C-@" 'x)
(bind-key* "C-x C-#" 'x)
(bind-key* "C-x C-$" 'x)
(bind-key* "C-x C-%" 'x)
(bind-key* "C-x C-^" 'x)
(bind-key* "C-x C-&" 'x)
(bind-key* "C-x C-*" 'x)
(bind-key* "C-x C-(" 'x)
(bind-key* "C-x C-)" 'x)
(bind-key* "C-x C-_" 'x)
(bind-key* "C-x C-+" 'x)

(bind-key* "C-x M-`" 'x)
(bind-key* "C-x M-1" 'x)
(bind-key* "C-x M-2" 'x)
(bind-key* "C-x M-3" 'x)
(bind-key* "C-x M-4" 'x)
(bind-key* "C-x M-5" 'x)
(bind-key* "C-x M-6" 'x)
(bind-key* "C-x M-7" 'x)
(bind-key* "C-x M-8" 'x)
(bind-key* "C-x M-9" 'x)
(bind-key* "C-x M-0" 'x)
(bind-key* "C-x M--" 'x)
(bind-key* "C-x M-=" 'x)

(bind-key* "C-x M-~" 'x)
(bind-key* "C-x M-!" 'x)
(bind-key* "C-x M-@" 'x)
(bind-key* "C-x M-#" 'x)
(bind-key* "C-x M-$" 'x)
(bind-key* "C-x M-%" 'x)
(bind-key* "C-x M-^" 'x)
(bind-key* "C-x M-&" 'x)
(bind-key* "C-x M-*" 'x)
(bind-key* "C-x M-(" 'x)
(bind-key* "C-x M-)" 'x)
(bind-key* "C-x M-_" 'x)
(bind-key* "C-x M-+" 'x)

(bind-key* "C-x C-M-`" 'x)
(bind-key* "C-x C-M-1" 'x)
(bind-key* "C-x C-M-2" 'x)
(bind-key* "C-x C-M-3" 'x)
(bind-key* "C-x C-M-4" 'x)
(bind-key* "C-x C-M-5" 'x)
(bind-key* "C-x C-M-6" 'x)
(bind-key* "C-x C-M-7" 'x)
(bind-key* "C-x C-M-8" 'x)
(bind-key* "C-x C-M-9" 'x)
(bind-key* "C-x C-M-0" 'x)
(bind-key* "C-x C-M--" 'x)
(bind-key* "C-x C-M-=" 'x)

(bind-key* "C-x C-M-~" 'x)
(bind-key* "C-x C-M-!" 'x)
(bind-key* "C-x C-M-@" 'x)
(bind-key* "C-x C-M-#" 'x)
(bind-key* "C-x C-M-$" 'x)
(bind-key* "C-x C-M-%" 'x)
(bind-key* "C-x C-M-^" 'x)
(bind-key* "C-x C-M-&" 'x)
(bind-key* "C-x C-M-*" 'x)
(bind-key* "C-x C-M-(" 'x)
(bind-key* "C-x C-M-)" 'x)
(bind-key* "C-x C-M-_" 'x)
(bind-key* "C-x C-M-+" 'x)
;; End Numbers And Symbols With C-x Prefix

;; Letters And Symbols With C-x Prefix
(bind-key* "C-x a" 'x)
(bind-key* "C-x b" 'x)
(bind-key* "C-x c" 'x)
(bind-key* "C-x d" 'x)
(bind-key* "C-x e" 'x)
(bind-key* "C-x f" 'x)
(bind-key* "C-x g" 'x)
(bind-key* "C-x h" 'x)
(bind-key* "C-x i" 'x)
(bind-key* "C-x j" 'x)
(bind-key* "C-x k" 'x)
(bind-key* "C-x l" 'x)
(bind-key* "C-x m" 'x)
(bind-key* "C-x n" 'x)
(bind-key* "C-x o" 'x)
(bind-key* "C-x p" 'x)
(bind-key* "C-x q" 'x)
(bind-key* "C-x r" 'x)
(bind-key* "C-x s" 'x)
(bind-key* "C-x t" 'x)
(bind-key* "C-x u" 'x)
(bind-key* "C-x v" 'x)
(bind-key* "C-x w" 'x)
(bind-key* "C-x x" 'x)
(bind-key* "C-x y" 'x)
(bind-key* "C-x z" 'x)
(bind-key* "C-x [" 'x)
(bind-key* "C-x ]" 'x)
(bind-key* "C-x \\" 'x)
(bind-key* "C-x ;" 'x)
(bind-key* "C-x '" 'x)
(bind-key* "C-x ," 'x)
(bind-key* "C-x ." 'x)
(bind-key* "C-x /" 'x)

(bind-key* "C-x A" 'x)
(bind-key* "C-x B" 'x)
(bind-key* "C-x C" 'x)
(bind-key* "C-x D" 'x)
(bind-key* "C-x E" 'x)
(bind-key* "C-x F" 'x)
(bind-key* "C-x G" 'x)
(bind-key* "C-x H" 'x)
(bind-key* "C-x I" 'x)
(bind-key* "C-x J" 'x)
(bind-key* "C-x K" 'x)
(bind-key* "C-x L" 'x)
(bind-key* "C-x M" 'x)
(bind-key* "C-x N" 'x)
(bind-key* "C-x O" 'x)
(bind-key* "C-x P" 'x)
(bind-key* "C-x Q" 'x)
(bind-key* "C-x R" 'x)
(bind-key* "C-x S" 'x)
(bind-key* "C-x T" 'x)
(bind-key* "C-x U" 'x)
(bind-key* "C-x V" 'x)
(bind-key* "C-x W" 'x)
(bind-key* "C-x X" 'x)
(bind-key* "C-x Y" 'x)
(bind-key* "C-x Z" 'x)
(bind-key* "C-x {" 'x)
(bind-key* "C-x }" 'x)
(bind-key* "C-x |" 'x)
(bind-key* "C-x :" 'x)
(bind-key* "C-x \"" 'x)
(bind-key* "C-x <" 'x)
(bind-key* "C-x >" 'x)
(bind-key* "C-x ?" 'x)

cont...... (maxed out character limit)

(bind-key* "C-c C-~" 'x)
(bind-key* "C-c C-!" 'x)
(bind-key* "C-c C-@" 'x)
(bind-key* "C-c C-#" 'x)
(bind-key* "C-c C-$" 'x)
(bind-key* "C-c C-%" 'x)
(bind-key* "C-c C-^" 'x)
(bind-key* "C-c C-&" 'x)
(bind-key* "C-c C-*" 'x)
(bind-key* "C-c C-(" 'x)
(bind-key* "C-c C-)" 'x)
(bind-key* "C-c C-_" 'x)
(bind-key* "C-c C-+" 'x)

(bind-key* "C-c M-`" 'x)
(bind-key* "C-c M-1" 'x)
(bind-key* "C-c M-2" 'x)
(bind-key* "C-c M-3" 'x)
(bind-key* "C-c M-4" 'x)
(bind-key* "C-c M-5" 'x)
(bind-key* "C-c M-6" 'x)
(bind-key* "C-c M-7" 'x)
(bind-key* "C-c M-8" 'x)
(bind-key* "C-c M-9" 'x)
(bind-key* "C-c M-0" 'x)
(bind-key* "C-c M--" 'x)
(bind-key* "C-c M-=" 'x)

(bind-key* "C-c M-~" 'x)
(bind-key* "C-c M-!" 'x)
(bind-key* "C-c M-@" 'x)
(bind-key* "C-c M-#" 'x)
(bind-key* "C-c M-$" 'x)
(bind-key* "C-c M-%" 'x)
(bind-key* "C-c M-^" 'x)
(bind-key* "C-c M-&" 'x)
(bind-key* "C-c M-*" 'x)
(bind-key* "C-c M-(" 'x)
(bind-key* "C-c M-)" 'x)
(bind-key* "C-c M-_" 'x)
(bind-key* "C-c M-+" 'x)

(bind-key* "C-c C-M-`" 'x)
(bind-key* "C-c C-M-1" 'x)
(bind-key* "C-c C-M-2" 'x)
(bind-key* "C-c C-M-3" 'x)
(bind-key* "C-c C-M-4" 'x)
(bind-key* "C-c C-M-5" 'x)
(bind-key* "C-c C-M-6" 'x)
(bind-key* "C-c C-M-7" 'x)
(bind-key* "C-c C-M-8" 'x)
(bind-key* "C-c C-M-9" 'x)
(bind-key* "C-c C-M-0" 'x)
(bind-key* "C-c C-M--" 'x)
(bind-key* "C-c C-M-=" 'x)

(bind-key* "C-c C-M-~" 'x)
(bind-key* "C-c C-M-!" 'x)
(bind-key* "C-c C-M-@" 'x)
(bind-key* "C-c C-M-#" 'x)
(bind-key* "C-c C-M-$" 'x)
(bind-key* "C-c C-M-%" 'x)
(bind-key* "C-c C-M-^" 'x)
(bind-key* "C-c C-M-&" 'x)
(bind-key* "C-c C-M-*" 'x)
(bind-key* "C-c C-M-(" 'x)
(bind-key* "C-c C-M-)" 'x)
(bind-key* "C-c C-M-_" 'x)
(bind-key* "C-c C-M-+" 'x)
;; End Numbers And Symbols With C-c Prefix

;; Letters And Symbols With C-c Prefix
(bind-key* "C-c a" 'x)
(bind-key* "C-c b" 'x)
(bind-key* "C-c c" 'x)
(bind-key* "C-c d" 'x)
(bind-key* "C-c e" 'x)
(bind-key* "C-c f" 'x)
(bind-key* "C-c g" 'x)
(bind-key* "C-c h" 'x)
(bind-key* "C-c i" 'x)
(bind-key* "C-c j" 'x)
(bind-key* "C-c k" 'x)
(bind-key* "C-c l" 'x)
(bind-key* "C-c m" 'x)
(bind-key* "C-c n" 'x)
(bind-key* "C-c o" 'x)
(bind-key* "C-c p" 'x)
(bind-key* "C-c q" 'x)
(bind-key* "C-c r" 'x)
(bind-key* "C-c s" 'x)
(bind-key* "C-c t" 'x)
(bind-key* "C-c u" 'x)
(bind-key* "C-c v" 'x)
(bind-key* "C-c w" 'x)
(bind-key* "C-c x" 'x)
(bind-key* "C-c y" 'x)
(bind-key* "C-c z" 'x)
(bind-key* "C-c [" 'x)
(bind-key* "C-c ]" 'x)
(bind-key* "C-c \\" 'x)
(bind-key* "C-c ;" 'x)
(bind-key* "C-c '" 'x)
(bind-key* "C-c ," 'x)
(bind-key* "C-c ." 'x)
(bind-key* "C-c /" 'x)

(bind-key* "C-c A" 'x)
(bind-key* "C-c B" 'x)
(bind-key* "C-c C" 'x)
(bind-key* "C-c D" 'x)
(bind-key* "C-c E" 'x)
(bind-key* "C-c F" 'x)
(bind-key* "C-c G" 'x)
(bind-key* "C-c H" 'x)
(bind-key* "C-c I" 'x)
(bind-key* "C-c J" 'x)
(bind-key* "C-c K" 'x)
(bind-key* "C-c L" 'x)
(bind-key* "C-c M" 'x)
(bind-key* "C-c N" 'x)
(bind-key* "C-c O" 'x)
(bind-key* "C-c P" 'x)
(bind-key* "C-c Q" 'x)
(bind-key* "C-c R" 'x)
(bind-key* "C-c S" 'x)
(bind-key* "C-c T" 'x)
(bind-key* "C-c U" 'x)
(bind-key* "C-c V" 'x)
(bind-key* "C-c W" 'x)
(bind-key* "C-c X" 'x)
(bind-key* "C-c Y" 'x)
(bind-key* "C-c Z" 'x)
(bind-key* "C-c {" 'x)
(bind-key* "C-c }" 'x)
(bind-key* "C-c |" 'x)
(bind-key* "C-c :" 'x)
(bind-key* "C-c \"" 'x)
(bind-key* "C-c <" 'x)
(bind-key* "C-c >" 'x)
(bind-key* "C-c ?" 'x)

(bind-key* "C-c C-a" 'x)
(bind-key* "C-c C-b" 'x)
(bind-key* "C-c C-c" 'x)
(bind-key* "C-c C-d" 'x)
(bind-key* "C-c C-e" 'x)
(bind-key* "C-c C-f" 'x)
(bind-key* "C-c C-g" 'x)
(bind-key* "C-c C-h" 'x)
(bind-key* "C-c C-i" 'x)
(bind-key* "C-c C-j" 'x)
(bind-key* "C-c C-k" 'x)
(bind-key* "C-c C-l" 'x)
(bind-key* "C-c C-m" 'x)
(bind-key* "C-c C-n" 'x)
(bind-key* "C-c C-o" 'x)
(bind-key* "C-c C-p" 'x)
(bind-key* "C-c C-q" 'x)
(bind-key* "C-c C-r" 'x)
(bind-key* "C-c C-s" 'x)
(bind-key* "C-c C-t" 'x)
(bind-key* "C-c C-u" 'x)
(bind-key* "C-c C-v" 'x)
(bind-key* "C-c C-w" 'x)
(bind-key* "C-c C-x" 'x)
(bind-key* "C-c C-y" 'x)
(bind-key* "C-c C-z" 'x)
(bind-key* "C-c C-]" 'x)
(bind-key* "C-c C-\\" 'x)
(bind-key* "C-c C-;" 'x)
(bind-key* "C-c C-'" 'x)
(bind-key* "C-c C-," 'x)
(bind-key* "C-c C-." 'x)
(bind-key* "C-c C-/" 'x)

(bind-key* "C-c C-A" 'x)
(bind-key* "C-c C-B" 'x)
(bind-key* "C-c C-C" 'x)
(bind-key* "C-c C-D" 'x)
(bind-key* "C-c C-E" 'x)
(bind-key* "C-c C-F" 'x)
(bind-key* "C-c C-G" 'x)
(bind-key* "C-c C-H" 'x)
(bind-key* "C-c C-I" 'x)
(bind-key* "C-c C-J" 'x)
(bind-key* "C-c C-K" 'x)
(bind-key* "C-c C-L" 'x)
(bind-key* "C-c C-M" 'x)
(bind-key* "C-c C-N" 'x)
(bind-key* "C-c C-O" 'x)
(bind-key* "C-c C-P" 'x)
(bind-key* "C-c C-Q" 'x)
(bind-key* "C-c C-R" 'x)
(bind-key* "C-c C-S" 'x)
(bind-key* "C-c C-T" 'x)
(bind-key* "C-c C-U" 'x)
(bind-key* "C-c C-V" 'x)
(bind-key* "C-c C-W" 'x)
(bind-key* "C-c C-X" 'x)
(bind-key* "C-c C-Y" 'x)
(bind-key* "C-c C-Z" 'x)
(bind-key* "C-c C-{" 'x)
(bind-key* "C-c C-}" 'x)
(bind-key* "C-c C-|" 'x)
(bind-key* "C-c C-:" 'x)
(bind-key* "C-c C-\"" 'x)
(bind-key* "C-c C-<" 'x)
(bind-key* "C-c C->" 'x)
(bind-key* "C-c C-?" 'x)

(bind-key* "C-c M-a" 'x)
(bind-key* "C-c M-b" 'x)
(bind-key* "C-c M-c" 'x)
(bind-key* "C-c M-d" 'x)
(bind-key* "C-c M-e" 'x)
(bind-key* "C-c M-f" 'x)
(bind-key* "C-c M-g" 'x)
(bind-key* "C-c M-h" 'x)
(bind-key* "C-c M-i" 'x)
(bind-key* "C-c M-j" 'x)
(bind-key* "C-c M-k" 'x)
(bind-key* "C-c M-l" 'x)
(bind-key* "C-c M-m" 'x)
(bind-key* "C-c M-n" 'x)
(bind-key* "C-c M-o" 'x)
(bind-key* "C-c M-p" 'x)
(bind-key* "C-c M-q" 'x)
(bind-key* "C-c M-r" 'x)
(bind-key* "C-c M-s" 'x)
(bind-key* "C-c M-t" 'x)
(bind-key* "C-c M-u" 'x)
(bind-key* "C-c M-v" 'x)
(bind-key* "C-c M-w" 'x)
(bind-key* "C-c M-x" 'x)
(bind-key* "C-c M-y" 'x)
(bind-key* "C-c M-z" 'x)
(bind-key* "C-c M-[" 'x)
(bind-key* "C-c M-]" 'x)
(bind-key* "C-c M-\\" 'x)
(bind-key* "C-c M-;" 'x)
(bind-key* "C-c M-'" 'x)
(bind-key* "C-c M-," 'x)
(bind-key* "C-c M-." 'x)
(bind-key* "C-c M-/" 'x)

(bind-key* "C-c M-A" 'x)
(bind-key* "C-c M-B" 'x)
(bind-key* "C-c M-C" 'x)
(bind-key* "C-c M-D" 'x)
(bind-key* "C-c M-E" 'x)
(bind-key* "C-c M-F" 'x)
(bind-key* "C-c M-G" 'x)
(bind-key* "C-c M-H" 'x)
(bind-key* "C-c M-I" 'x)
(bind-key* "C-c M-J" 'x)
(bind-key* "C-c M-K" 'x)
(bind-key* "C-c M-L" 'x)
(bind-key* "C-c M-M" 'x)
(bind-key* "C-c M-N" 'x)
(bind-key* "C-c M-O" 'x)
(bind-key* "C-c M-P" 'x)
(bind-key* "C-c M-Q" 'x)
(bind-key* "C-c M-R" 'x)
(bind-key* "C-c M-S" 'x)
(bind-key* "C-c M-T" 'x)
(bind-key* "C-c M-U" 'x)
(bind-key* "C-c M-V" 'x)
(bind-key* "C-c M-W" 'x)
(bind-key* "C-c M-X" 'x)
(bind-key* "C-c M-Y" 'x)
(bind-key* "C-c M-Z" 'x)
(bind-key* "C-c M-{" 'x)
(bind-key* "C-c M-}" 'x)
(bind-key* "C-c M-|" 'x)
(bind-key* "C-c M-:" 'x)
(bind-key* "C-c M-\"" 'x)
(bind-key* "C-c M-<" 'x)
(bind-key* "C-c M->" 'x)
(bind-key* "C-c M-?" 'x)

(bind-key* "C-c C-M-a" 'x)
(bind-key* "C-c C-M-b" 'x)
(bind-key* "C-c C-M-c" 'x)
(bind-key* "C-c C-M-d" 'x)
(bind-key* "C-c C-M-e" 'x)
(bind-key* "C-c C-M-f" 'x)
(bind-key* "C-c C-M-g" 'x)
(bind-key* "C-c C-M-h" 'x)
(bind-key* "C-c C-M-i" 'x)
(bind-key* "C-c C-M-j" 'x)
(bind-key* "C-c C-M-k" 'x)
(bind-key* "C-c C-M-l" 'x)
(bind-key* "C-c C-M-m" 'x)
(bind-key* "C-c C-M-n" 'x)
(bind-key* "C-c C-M-o" 'x)
(bind-key* "C-c C-M-p" 'x)
(bind-key* "C-c C-M-q" 'x)
(bind-key* "C-c C-M-r" 'x)
(bind-key* "C-c C-M-s" 'x)
(bind-key* "C-c C-M-t" 'x)
(bind-key* "C-c C-M-u" 'x)
(bind-key* "C-c C-M-v" 'x)
(bind-key* "C-c C-M-w" 'x)
(bind-key* "C-c C-M-x" 'x)
(bind-key* "C-c C-M-y" 'x)
(bind-key* "C-c C-M-z" 'x)
(bind-key* "C-c C-M-[" 'x)
(bind-key* "C-c C-M-]" 'x)
(bind-key* "C-c C-M-\\" 'x)
(bind-key* "C-c C-M-;" 'x)
(bind-key* "C-c C-M-'" 'x)
(bind-key* "C-c C-M-," 'x)
(bind-key* "C-c C-M-." 'x)
(bind-key* "C-c C-M-/" 'x)

(bind-key* "C-c C-M-A" 'x)
(bind-key* "C-c C-M-B" 'x)
(bind-key* "C-c C-M-C" 'x)
(bind-key* "C-c C-M-D" 'x)
(bind-key* "C-c C-M-E" 'x)
(bind-key* "C-c C-M-F" 'x)
(bind-key* "C-c C-M-G" 'x)
(bind-key* "C-c C-M-H" 'x)
(bind-key* "C-c C-M-I" 'x)
(bind-key* "C-c C-M-J" 'x)
(bind-key* "C-c C-M-K" 'x)
(bind-key* "C-c C-M-L" 'x)
(bind-key* "C-c C-M-M" 'x)
(bind-key* "C-c C-M-N" 'x)
(bind-key* "C-c C-M-O" 'x)
(bind-key* "C-c C-M-P" 'x)
(bind-key* "C-c C-M-Q" 'x)
(bind-key* "C-c C-M-R" 'x)
(bind-key* "C-c C-M-S" 'x)
(bind-key* "C-c C-M-T" 'x)
(bind-key* "C-c C-M-U" 'x)
(bind-key* "C-c C-M-V" 'x)
(bind-key* "C-c C-M-W" 'x)
(bind-key* "C-c C-M-X" 'x)
(bind-key* "C-c C-M-Y" 'x)
(bind-key* "C-c C-M-Z" 'x)
(bind-key* "C-c C-M-{" 'x)
(bind-key* "C-c C-M-}" 'x)
(bind-key* "C-c C-M-|" 'x)
(bind-key* "C-c C-M-:" 'x)
(bind-key* "C-c C-M-\"" 'x)
(bind-key* "C-c C-M-<" 'x)
(bind-key* "C-c C-M->" 'x)
(bind-key* "C-c C-M-?" 'x)
;; End Letters And Symbols With C-c Prefix

;;-----------------------------------------------------------------;;
;;-------------------------END UNBOUND KEYS------------------------;;
;;-----------------------------------------------------------------;;

;;-----------------------------------------------------------------;;
;;-------------------------BOUND KEYS------------------------------;;
;;-----------------------------------------------------------------;;

;; Turns on CUA mode.
(cua-mode t)

;; File-Handling Commands.
(bind-key* "C-e" 'find-file)
(bind-key* "C-s" 'save-buffer)
(bind-key* "M-s" 'write-file)
(bind-key* "C-x C-c" 'save-buffers-kill-emacs)
(bind-key* "C-x C-s" 'save-some-buffers)

;; Cursor Movement Commands.
(bind-key* "M-l" 'forward-char)
(bind-key* "M-j" 'backward-char)
(bind-key* "M-i" 'previous-line)
(bind-key* "M-k" 'next-line)
(bind-key* "M-u" 'beginning-of-line)
(bind-key* "M-o" 'end-of-line)
(bind-key* (kbd "<C-i>") 'scroll-down)
(bind-key* (kbd "<C-I>") 'scroll-down)
(bind-key* "C-k" 'scroll-up)
(bind-key* "C-u" 'beginning-of-buffer)
(bind-key* "C-o" 'end-of-buffer)
(bind-key* "M-;" 'recenter)
(bind-key* "C-t" 'universal-argument)

;; Deleting, Yanking, Region, and Clipboard Commands.
(bind-key* "C-x C-x" 'select-current-line) ;; TODO LATER: Macro to unhighlight line if I move cursor.
(bind-key* "C-a" 'mark-whole-buffer)
(bind-key* "M-SPC" 'cua-exchange-point-and-mark) ;; TODO LATER: Possibly macro to move mark to end-of-line after copy.

;; Stopping and Undoing Commands.
(bind-key* "C-g" 'keyboard-escape-quit) ;; TODO LATER: Possibly imoprove functionality to work in mini-buffer.

;; Search And Replace Commands.
(bind-key* "C-f" 'isearch-forward)
(bind-key "C-l" 'isearch-repeat-forward isearch-mode-map)
(bind-key "C-j" 'isearch-repeat-backward isearch-mode-map)
(bind-key* "M-f" 'query-replace)

;; TODO LATER: Macro to switch/swap/open up and format certain amount of buffers for coding.
;; Buffer Commands.
(bind-key* (kbd "<C-tab>") 'buffer-menu)

;; Windows And Frames.
(bind-key* "C-n" 'split-window-horizontally)
(bind-key* (kbd "<C-m>") 'split-window-vertically)
(bind-key* (kbd "<C-M>") 'split-window-vertically)
(bind-key* "C-x j" 'delete-window)
(bind-key* "C-x l" 'delete-other-windows)
(bind-key* "C-+" 'enlarge-window)
(bind-key* "C-_" 'shrink-window)
(bind-key* "C-=" 'enlarge-window-horizontally)
(bind-key* "C--" 'shrink-window-horizontally)
(bind-key* "C-M-j" 'windmove-left)
(bind-key* "C-M-l" 'windmove-right)
(bind-key* "C-M-i" 'windmove-up)
(bind-key* "C-M-k" 'windmove-down)

;; TODO LATER: Finish these binds, once I start getting the hang of it.
;; Shell Mode Commands.
(bind-key* "<f1>" 'shell)
;;(bind-key "C-l" 'shell-foward-command)
;;(bind-key "C-j" 'shell-backward-command)
;;(bind-key* "M-c" 'comint-interrupt-subjob)
;;(bind-key* "M-z" 'comint-stop-subjob)

;; Compilation Mode Commands.
;;(bind-key* "M-i" 'compilation-previous-error)
;;(bind-key* "M-k" 'compilation-next-error)
;;(bind-key* "M-n" 'compilation-goto-error)

;; Company Commands.
(bind-key "C-l" 'company-select-next)
(bind-key "C-j" 'company-select-previous)
(with-eval-after-load 'company
  (bind-key "<tab>" 'company-complete-selection company-active-map))

;;-----------------------------------------------------------------;;
;;-------------------------END BOUND KEYS--------------------------;;
;;-----------------------------------------------------------------;;

;;-----------------------------------------------------------------;;
;;-----------------------------------------------------------------;;
;;-----------------------------------------------------------------;;
;;-------------------------END KEYBINDINGS-------------------------;;
;;-----------------------------------------------------------------;;
;;-----------------------------------------------------------------;;
;;-----------------------------------------------------------------;;

Can you elaborate on what sort of approach you're hoping for?  If you don't actually want to "wipe every global keybind" (a.k.a. "totally obliterate the global keymap" -- which you have a simple solution for already), then I'm unsure what you're asking.

What I'm asking is: how do I create a fully customized keymap, so that I can use that instead of the default global one? (updated the question).

Not clear at all what you are asking. If you want to redefine global-map then just do that: (setq global-map (make-sparse-keymap)) (define-key global-map...)...

@Drew Maybe I'm not understanding what a keymap is fully?
I'll try to clarify what I'm trying to say (I also added what's in my .emacs file):

I can't stand the default global keybinds.
I want to obliterate the global keymap.
After which I want to make a new keymap.
In this new keymap I want to fully customize the binds to my liking.
I want to then use said keymap for my global keymap.

If that makes sense.

@John, perhaps what you're missing is that with (use-global-map (make-sparse-keymap)) you have created a new global keymap. Having done that, you can simply start defining global keys as normal.

As side notes: (1) Binding a key to the command nil is how you unbind a key from a keymap.  (2) A command named ignore exists, and you might prefer that to the likes of your x defun (notwithstanding your call to message).

This really smacks of being an XY question. As you can see from comments and an answer, no one can imagine wanting, let alone needing to do this. That doesn't imply it cannot be useful, but since you give no motivation for doing it, it does suggest that you are heading in a mistaken direction. Try specifying what it is that you are really trying to do (think why).

You've already got the answer: delete the existing keymap, create a new one, then define key bindings in it.
(use-global-map nil) will delete the global keymap, which nukes everything. (make-sparse-keymap) creates a brand new keymap with no keys defined in it. (use-global-map (make-sparse-keymap)) saves you a step by doing both in one go.
Now all you have to do is start defining keys just like you're already doing.
Of course, I can't really recommend doing this. All of the buffers I have open at the moment have between 1000 and 2000 keybindings. (You can use C-h b to show all available keybindings in the keymap used by the current buffer) While I don't know every single one of those by heart, it would take a long time to come up with a keybinding scheme of my own which covers the ones I do know.
Edit:
You asked about the ordinary self-inserting keys in the comments, so here's what they look like in the output of C-x b (slightly edited for clarity):
Global Bindings:
key               binding
---               -------

SPC .. ~          self-insert-command
\200 .. \17777577 self-insert-command
\200 .. \377      self-insert-command

You'll want to recreate these bindings in your new keymap by looping through all of these characters and binding them to the self-insert-command function.

Great answer. Thanks you.
But if I might add: when using C-h b doesn't show me the the binds for inserting the individual characters: "a", "b", "c", "d", etc. Where can I find those bindings?


text:
How to hop the cursor over parenthesis, brackets, single-quotes, and double-quotes
One of the features I miss in Visual Studio is the ability to hop over closing parenthesis, brackets, single-quotes and double-quotes with tab
Does anyone know of a script to do such a thing?

Pseudo Code:

If character to the right of cursor == ')' or '}' or '\'' or '"'
    Move cursor over one space.
Else
    indent-line/autocomplete/etc.

This answer depends on the bind-key.el file in Wiegley's use-package.
Probably a cleaner way to do this, but this should work for your purposes. You say you want the cursor to "hop" over the delimiters, but also say the cursor should move over one space. I assumed you meant 2 spaces. Remove the first (forward-char 1).
(defun special-tab ()
 "Wrapper for tab key invocation.

  If point is just before a close delimiter, skip forward until
  there is no closed delimiter in front of point. Otherwise, invoke
  normal tab command for current mode.

  Must be bound to <tab> using bind-key* macro from bind-key package.

  Note, this function will not be called if `override-global-mode' is
  turned off."
  (interactive)
  (defun next-char-delims (delims)
    (let ((char (and (not (equal (point) (point-max)))
                     (string (char-after (point))))))
      (when char (member char delims))))
  (let ((open '("'" "\"" ")" "]")))
    (if (next-char-delims open)
        (progn (forward-char 1)
               (while (next-char-delims open)
                 (forward-char 1)))
      (call-interactively (key-binding (kbd "TAB"))))))

(if (macrop 'bind-key*)
    (bind-key* (kbd "<tab>") 'special-tab)
  (user-error "Must have bind-key from use-package.el to use special-tab function."))

Comments are not for extended discussion; this conversation has been moved to chat.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
Change post-self-insert-hook only in one mode
I have written a functionality that inserts the word end at end of blocks in a lua major mode. How i do it is to check if a space character has been typed, if yes is the word before the space for example function, if yes print the end. Now adding my funcionality to post-self-insert-hook will change its hooks-list in all modes and buffers. How can i specify it to happen only in lua-mode?
Here is my code in my init.el:
(add-hook 'lua-mode-hook 'mein-lua-mode-hook)
(defun put-end ()
  "print end of blocks"
  (interactive)
  (backward-char)
  (when (member (thing-at-point 'word) '("function"))
    (progn
      (save-excursion (insert "  " "end"))
      (forward-char))))
(defun spacep ()
  (if (and (derived-mode-p 'lua-mode)(member (char-before) '(13 32)))
      (put-end)))
(defun mein-lua-mode-hook ()
  "Tastaturanbindungen fuer das Lua-Mode"
  ;;; some other things come here
  (add-hook 'post-self-insert-hook 'spacep))

You can use add-function, it provides a way to affect buffer locally. Check out its docstring with [C-h f add-function]. This could be an option.

That's what the local argument to add-hook is for.
I.e. use
(add-hook 'post-self-insert-hook #'spacep nil 'local)

To have it affect only one mode, have the function test the current mode and do nothing if it is not (derived-mode-p THE-MODE).  In your case, e.g.:
(defun spacep ()
  (when (and (derived-mode-p 'lua-mode)
             (member (char-before) '(13 32)))
    (put-end)))

great! Now i am wondering why it only reacts on space (char-code 32) but not with return (13). Do you have any idea?

Put your cursor after the character that you think is ^M (13) and hit C-u C-x =. I think you'll see that it's not 13. It's likely a newline char (10, not 13).

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Disabling/ignoring GCC/Clang error in Flycheck
There is already a question on this but it's unanswered.
I'm writing a C++ header file that requires libxml, as seen below
#include <libxml2/libxml/xpath.h>

However Flycheck sees this as an error and consequently ignores any other potential error in the file.
In include /usr/include/libxml2/libxml/xpath.h (c/c++-gcc)

How do I disable this error in Flycheck or at least configure it to recognize the rest of the errors in the file?

Here's my code:
#ifndef PATH_T_HPP
#define PATH_T_HPP

#include <string>
#include <libxml2/libxml/xpath.h>

namespace tw_lmm
{

  class path_t
  {
  public:
    /* Constructors */
    explicit path_t(const xmlKey*); // path only
    explicit path_t(const xmlKey*, const xmlKey*); // path, name
    explicit path_t(const xmkKey*, const xmkKey*, const xmkKey*); // path, name, extension

    explicit path_t(const path_t&);

    inline path_t operator=(const std::string&); // path only

    /* Destructors */
    virtual ~path_t();

    /* Getters */
    const inline std::string& path() const;
    const inline std::string& name() const;

  protected:
    std::string __path, __name, __extension;

  };

  const inline std::string& path_t::path() const
  {
    return __path;
  }

}

#endif

Note I misspelt xmlKey by writing xmkKey, Flycheck doesn't seem to recognise this.

According to Sebastian Wiesner (lunaryorn) in Flycheck issue #662,

Flycheck does not have its own way to ignore warnings, but relies on syntax checker to be able to ignore warnings on their own.

I was able to add "/usr/include/libxml2" to variable flycheck-gcc-include-path using
M-x customize-variable RET flycheck-gcc-include-path

an insert a new entry.


text:
When using C-x C-f turn off the suggestions
When i do C-x C-f to create a new file in the directory A, if emacs finds another file in another directory (say B) with exact same name, in the mini-buffer it changes the path to the other existing file (forcing me to open the old file instead of letting me create my new file). How can i disable this annoying thing?
Update
It is because of the ido-vertical mode which i have in my init.el:
;;; ido vertical
(require 'ido-vertical-mode)
(ido-mode 1)
(ido-vertical-mode 1)
(setq ido-vertical-define-keys 'C-n-and-C-p-only)

This is not the standard Emacs behavior. Please provide a step-by-step recipe to reproduce it, preferably starting from emacs -Q (no init file). If you don't know what causes it then bisect your init file to find out. The question so far is unclear, and so risks being closed.

Folks are trying to guess what you mean - Ivy? Ido? Please clarify the question or delete it. Thx.

There's a way to turn on ido just for switching buffers, like this:
https://github.com/DoMiNeLa10/.emacs.d/blob/cef9e5571572195dce1497a7c2ecc4adb5589eb9/config/my-customization.el#L50

Asuming that C-x C-f is bound to ido-find-file you drop back to the non-Ido version by typing C-x C-f again or just C-f.  This will allow you to create the file you want without Ido interfence.

This isn't the default behavior of Emacs, so it's likely that you're using a package that modifies it. I'm going to guess that you're using ido-mode. I occasionally get annoyed by this same aspect of ido-mode, but I don't think there's really a fix for it. If the search is taking long enough, you can hit C-g to cancel it, but if it's already finished the search that will cancel the ido-find-file command entirely. Another work around is to hit C-f again before it searches, this will drop you back to the default Emacs find-file.
Another thing I've started doing is using projectile-mode. This has a command to open another file in the same project (projectile-find-file, bound to C-c p f by default) which enumerates all of the files in the project before asking you to select one. You still get ido-mode's matching behavior, but since it has all the files in the project already it'll do less searching of unrelated projects. Of course, that requires that your files be in a "project" as Projectile defines it. On the other hand it treats any version-control repository as a project, which is very convenient.
And of course you have the option of disabling ido-mode entirely; just comment it out in your init file.

He could also be using ivy, in which case he can use the test he has input, without matching another existing entry, by using Control-Alt-j.

If it's ido-mode then maybe setting ido-auto-merge-work-directories-length to -1 would help? I have that setting in my init file with the comment don't jump to some other directory when I mistype a filename.

@npostavs - i'm stuck with the same problem and it's help

Just type C-x C-f two times in a row.  This will call the non Ido version of find-file.

You can enable ido-mode only for buffer switching commands, here's the relevant part of the docstring for that function:

However, if ARG arg equals ‘files’, remap only commands for files, or
  if it equals ‘buffers’, remap only commands for buffer switching.

You can pass the symbol buffers to ido-mode to enable it only for buffer switching like this:
(ido-mode 'buffers)

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Having problems starting EXWM
I am running Debian 9.3. I created an .xinitrc file and a symlink, .xsession. File permission was changed to 774.
#!/usr/bin/env bash
#
# This is a sample file for the ~/.xinitrc file.
#
# Set fallback cursor
xsetroot -cursor_name left_ptr

# If Emacs is started in server mode, `emacsclient` is a convenient way         to edit
# files in place (used by e.g. `git commit`)
export VISUAL=emacsclient
export EDITOR="$VISUAL"

# Disable access control
xhost +SI:localuser:$USER

## Over-rides
#
xset b off &
#numlockx off                    # Turn off numlock

# Set keyboard repeat rate
xset r rate 180 40

nm-applet
exec dbus-launch --exit-with-session emacs

My init.el has the following:
(require 'exwm)
(require 'exwm-config)

(setq exwm-workspace-number 4)

(require 'exwm-randr)
(setq exwm-randr-workspace-output-plist '(0 "VGA1"))
(add-hook 'exwm-randr-screen-change-hook
      (lambda ()
        (start-process-shell-command
         "xrandr" nil "xrandr --output VGA1 --left-of LVDS1 --auto")))
(exwm-randr-enable)

[...]

;; Global keybindings can be defined with `exwm-input-global-keys'.
;; Here are a few examples:
(setq exwm-input-global-keys
  `(
    ;; Bind "s-r" to exit char-mode and fullscreen mode.
    ([?\s-r] . exwm-reset)
    ;; Bind "s-w" to switch workspace interactively.
    ([?\s-w] . exwm-workspace-switch)
    ;; Bind "s-0" to "s-9" to switch to a workspace by its index.
    ,@(mapcar (lambda (i)
                `(,(kbd (format "s-%d" i)) .
                  (lambda ()
                    (interactive)
                    (exwm-workspace-switch-create ,i))))
              (number-sequence 0 9))
    ;; Bind "s-&" to launch applications ('M-&' also works if the output
    ;; buffer does not bother you).
    ([?\s-&] . (lambda (command)
                 (interactive (list (read-shell-command "$ ")))
                 (start-process-shell-command command nil command)))
    ;; Bind "s-<f2>" to "slock", a simpl0e X display locker.
    ([s-f2] . (lambda ()
                (interactive)
                (start-process "" nil "/usr/bin/slock")))))

;; To add a key binding only available in line-mode, simply define it in
;; `exwm-mode-map'.  The following example shortens 'C-c q' to 'C-q'.
(define-key exwm-mode-map [?\C-q] #'exwm-input-send-next-key)

(setq exwm-input-simulation-keys
  '(
    ;; movement
    ([?\C-b] . [left])
    ))

;; Do not forget to enable EXWM. It will start by itself when things are
;; ready.  You can put it _anywhere_ in your configuration.
(exwm-enable)

When I ran xinit -- vt01 in a virtual console, I received the following error:
(EE)
Fatal server error:
(EE) Server is already active for display 0
If this server is no longer running, remove /tmp/.X0-lock and start again.
[...]
XIO: fatal IO error 11 (Resource temporarily unavailable) on X server ":0" after 7 requests (7 known processed) with 0 events remaining.
I'm not sure how to resolve this, and would appreciate suggestions. Thanks for your time.
EDIT: jue's answer did the trick. I am now encountering a different problem--I've attempted a multi-monitor setup, but do not know how to open emacs in more than one monitor. I cannot seem to bind anything using exwm-input-global-keys with the Super key; funny enough, I am able to setq exwm-input-simulation keys properly. Does anyone know how to have emacs frames open in both monitors in the same workspace?

You should put your edit in a new question otherwise no one will read it. I can't help you there, because I'm using the fantastic and unbeatable  fvwm2 window manager. :)

I d not know your system setup or system knowledge, but this error message means on your system is an X-server running already and X11 cannot use that display (number 0) again.
So either you stop that X-server before launching xinit. Or you use another display for this new server.
If you just booted you Linux box with that .xinitrc file, then chances are good, your exwm is already running.
You could try following command: xinit xterm -- :1 vt08 to start a new X-server with just an xterm on another display (number 1).
If that works, quit this new x-server and try:
xinit emacs -- :1 vt08 or xinit -- :1 vt08.

I'm now encountering two unrelated problems, which I amended the OP to describe. I don't know how to open more than one emacs frame in a given workspace (ideally i would have one in each monitor), and I'm having trouble binding exwm-input-global-keys. Would you happen to have any suggestions?


text:
Having trouble using EXWM with multiple monitors, and with exwm-input-global-keys
I'm not sure how to open more than one Emacs frame in a given workspace; ideally I would have one frame in each of my two monitors. Presently, my issue is that I'm stuck with only one frame in each workspace, and all lie in the same monitor. Here are the important parts of my config:
(require 'exwm)
(require 'exwm-config)

(setq exwm-workspace-number 4)

(require 'exwm-randr)
(setq exwm-randr-workspace-output-plist '(0 "VGA1"))
(add-hook 'exwm-randr-screen-change-hook
  (lambda ()
    (start-process-shell-command
     "xrandr" nil "xrandr --output VGA1 --left-of LVDS1 --auto")))
(exwm-randr-enable)

[...]

;; Global keybindings can be defined with `exwm-input-global-keys'.
;; Here are a few examples:
(setq exwm-input-global-keys
 `(
  ;; Bind "s-r" to exit char-mode and fullscreen mode.
    ([?\s-r] . exwm-reset)
  ;; Bind "s-w" to switch workspace interactively.
    ([?\s-w] . exwm-workspace-switch)
  ;; Bind "s-0" to "s-9" to switch to a workspace by its index.
    ,@(mapcar (lambda (i)
            `(,(kbd (format "s-%d" i)) .
              (lambda ()
                (interactive)
                (exwm-workspace-switch-create ,i))))
          (number-sequence 0 9))
;; Bind "s-&" to launch applications ('M-&' also works if the output
;; buffer does not bother you).
([?\s-&] . (lambda (command)
             (interactive (list (read-shell-command "$ ")))
             (start-process-shell-command command nil command)))
;; Bind "s-<f2>" to "slock", a simpl0e X display locker.
([s-f2] . (lambda ()
            (interactive)
            (start-process "" nil "/usr/bin/slock")))))

;; To add a key binding only available in line-mode, simply define it in
;; `exwm-mode-map'.  The following example shortens 'C-c q' to 'C-q'.
(define-key exwm-mode-map [?\C-q] #'exwm-input-send-next-key)

(setq exwm-input-simulation-keys
 '(
;; movement
([?\C-b] . [left])
))

;; Do not forget to enable EXWM. It will start by itself when things are
;; ready.  You can put it _anywhere_ in your configuration.
(exwm-enable)

Another issue is that the exwm-input-global-keys I've set don't seem to work; if I try s-r, then the minibuffer simply tells me "s-r is undefined". I'd appreciate any suggestions. EDIT: I think I figured out the global-key thing. Still stuck on the monitor issue though.

Answered my own question. In case anyone might encounter this issue in the future, here's how I fixed it:
(require 'exwm-randr)
(setq exwm-randr-workspace-output-plist
  '(0 "HDMI-2" 1 "eDP-1"))
(add-hook 'exwm-randr-screen-change-hook
      (lambda ()
        (start-process-shell-command
         "xrandr" nil "xrandr --output HDMI-2 --output eDP-1 --auto")))
(exwm-randr-enable)


text:
Emacs can not see mode.el in site-lisp
I installed Smalltalk from source which comes with its own mode. The files smalltalk-mode.el and smalltalk-mode.elc are placed in /usr/local/share/emacs/site-lisp/ and this path is in my load-path but Emacs can not recognize .st files as Smalltalk mode. I also tried (require 'smalltalk-mode) in my init.el, but didn't help. Why is this happening?

smalltalk-mode is probably just not set up to be the default mode for .st files. Try opening one and then doing M-x smalltalk-mode to see if you installed it properly in the first place.

@DoMiNeLa10 M-x smalltalk-mode activated the mode, i have now colors and Smalltalk activated

Is there not a commentary section in smalltalk-mode.el with installation instructions?  If not, you might raise an issue upstream to have such documentation added.

smalltalk-mode requires configuration to be the default mode for .st files. In order to have it there, you need to add this to your init file:
(add-to-list 'auto-mode-alist '("\\.st\\'" . smalltalk-mode))


text:
Python RuntimeError freezes the whole Emacs!
This happens to me almost every time after i have broken an infinite loop (RuntimeError: maximum recursion depth exceeded while getting the str of an object) in the Inferior Python process with C-c C-c. The whole emacs will get unresponsive, the only way will be killall emacs from terminal!
Maybe i can provide more information if it would be helpful.

It could be that the Python process is printing a lot of data before hitting that error, so Emacs is spending all its time reading?

Please provide a minimal setup to reproduce the error/problem.

It's not entirely clear what you're trying to do.  Please provide more details.

@Dan I was thinking of what information could i give about the spacial case, until the same thing happened in NO infinit loop and a very normal situation: i typed something in the Inferior Python, and hit Enter and Emacs freezed! Now i am lost!

Start emacs without your init file (emacs -Q).  Create a minimal setup with the Python-related packages.  Do you still get the same error?  Show us what you did to get to that problem.


text:
C-S-a doesn't select text to the line beginning
The Key combination Ctrl + Shift + a doesn't work in my GUI-Emacs to select a region from the position of pointer to the line start. Doing C-h k and the above key combination shows no documentation.

Do you see this when you start Emacs with emacs -Q? If so, use M-x report-emacs-bug, providing a step-by-step recipe to reproduce it. If not, bisect your init file to find the culprit. (I don't see what you report with emacs -Q.)

Do you have shift-select-mode deactivated? On Emacs-26 I see a documentation for C-h k C-S-a.


text:
Is it possible to transparently kill & yank (copy & paste) org mode text with footnotes?
When copying text with numbered footnote markers from one org-mode file to another, I have been manually copying and pasting the corresponding footnotes (sometimes renumbering them in the process).  This is difficult and error-prone.  Is there a way to have Org automatically copy and renumber the associated footnotes along with the main body text?
It seems like org-mode used to support inline footnotes (like LaTeX) which would be easier to copy and paste than numbered footnotes -- see the discussion archived at https://lists.gnu.org/archive/html/emacs-orgmode/2009-01/msg00004.html . But I don't think that feature exists in the current version.
If nothing like this exists, I might be motivated to add it myself, but I wanted to check first whether there is an easier way.

The manual says that there are inline footnotes,as well as named footnotes, in addition to numbered footnotes:

Org mode extends the number-based syntax to named footnotes and
  optional inline definition.  Here are the valid references:
‘[fn:name]’
       A named footnote reference, where ‘name’ is a unique label word,
       or, for simplicity of automatic creation, a number.
‘[fn::This is the inline definition of this footnote]’
       A LaTeX-like anonymous footnote where the definition is given
       directly at the reference point.
‘[fn:name:a definition]’
       An inline definition of a footnote, which also specifies a name for
       the note.  Since Org allows multiple references to the same note,
       you can then use ‘[fn:name]’ to create additional references.

Duh! I don't know how I missed this, but obviously I did. I still don't really want to use inline footnotes when editing, but it seems like I could get the behavior I want by advising the kill & yank commands to transform numbered footnotes into inline footnotes when copying/killing, then run org-footnote-normalize upon pasting/yanking.


text:
Emacs is using the wrong SHELL
I'm using emacs 26.1 and spacemacs (emacs-plus from homebrew and spacemacs is from the develop branch). I've configured my local shell to use ZSH from homebrew as well (installed to /usr/local/bin/zsh).
When I start emacs, (getenv SHELL) shows /bin/bash.
The first expression in dotspacemacs/user-init is:
(when (memq window-system '(mac ns x))
  (setenv "SHELL" "/usr/local/bin/zsh")
  (exec-path-from-shell-initialize))

What's the appropriate way to get emacs/spacemacs to pick up the local environment?

This appears to be related to the following bug https://github.com/syl20bnr/spacemacs/issues/10906


text:
Installing with package-install-file
I am trying to install the gauche-mode. Running the M-x package-install-file and giving the /path/to/gacuhe-mode/ directory gives the Read error: is a directory, /path/to/gacuhe-mode/. How can i install it with this command otherwise? I am using emacs 24

Installing a package from a directory (as opposed to a .el or .tar file) through package-install-file is only supported from Emacs 25.1; see the NEWS entry.
You might be better off adding the directory to your load-path and requiring it:
(add-to-list 'load-path "/path/to/gauche-mode")
(require 'gauche-mode)

a package that is not in elpa /melpa. can be installed manually.
You need to direct to the .el files rather than to the directory.
See the following ergonomic-emacs post.

place the mode's folder in the ~/.emacs.d path.
M-x load-file then give the path : ~/PATH/TO/FILE/gauche-mode.el
follow the rest of the instruction for paredit and other functionalities in the readme on gauch-github


text:
Set focus to minibuffer window
Some commands use Emacs' minibuffer to prompt for input.
I occasionally do something which moves the focus to another window and away from the minibuffer.  In these cases I cycle windows with C-x o until I regain focus on the echo area or point and click with the mouse.
What's the Emacs command to immediately focus the minibuffer or prompt?
Writing the Elisp to automate this action should be trivial but I'd rather use a built-in command or function if one's available.

On selecting window, there is nothing special about minibuffer's window. If you are not satisfied with C-x o or the mouse, you should consider tweaking your window-selecting workflow, such as bind a short key or try ace-window.

Thanks, I used ace-window for a while and it was great! I'm using windmove with good results. I'll return to ace eventually but now I need a vanilla configuration which can be shared across many different hosts.

I prefer to select a window in a particular direction -- that way, I don't have to "cycle" through too many windows.  That being said, here is a repost from Emacs wiki -- "The following command returns the focus to the minibuffer, no matter which window is currently selected.":   https://www.emacswiki.org/emacs/MiniBuffer#minibuffer
(defun switch-to-minibuffer ()
  "Switch to minibuffer window."
  (interactive)
  (if (active-minibuffer-window)
      (select-window (active-minibuffer-window))
    (error "Minibuffer is not active")))

(global-set-key "\C-co" 'switch-to-minibuffer) ;; Bind to `C-c o'

Well now that spoiled all the fun! I thought of using minibuffer-prompt but I suppose it won't make much difference since I'll bind it to a key.

Actually, it selects the window, but it doesn't necessarily put the input focus there. If the focus has switched to another frame where that minibuffer is not present (e.g. no minibuffer window, because another frame has that frame's minibuffer window) then it won't be focused. IOW, you may need to use select-frame-set-input-focus.

I wrote my own DWIM other-window-or-prompt https://gist.github.com/metaturso/0ce41b515fc32718b5c0ea3cf75d8269. Feel free to add comments to the gist. Honestly I prefer my own version over Emacs Wiki's.


text:
I cant get into the agenda buffer
How do I get into the agenda buffer?
I tried C-c a, but it doesn't work; nothing happens.

are you trying the key binding while in org buffer, otherwise add (global-set-key "\C-ca" 'org-agenda) to your .emacs

SOLUTION
According to the org manual you need to define C-c a globally.
In your .emacs or init.el file add the following line:
(global-set-key "\C-ca" 'org-agenda)

This should trigger the agenda buffer; I hope this helps someone.
REFERENCES
https://orgmode.org/manual/Activation.html#Activation

This is part of the (documented) setup.

NickD - you are right.


text:
GNUS doesn't show all Mails
I am using gnus for reading my gmails. But almost always by checking the INBOX of my gnus and comparing to my actual gmail account, i have new (or old) mails which are not shown in gnus. Does anyone have an idea what could be the problem?

Are you sure it's not the ordering? I've not used Gnus in a while, but I remember having problems with GMail specifically because of how message ordering worked. In the end, I couldn't get Gnus to order the emails properly, but, I think pressing GG would run GMail search and would find the email I was looking for.

See  https://github.com/redguardtoo/mastering-emacs-in-one-year-guide/blob/master/gnus-guide-en.org#usage
Quoted:
"But I strongly suggest using C-u RET in order to see all the mails instead of unread mails. After C-u RET, you will be asked how many mails to display. If you never delete or move the mail in inbox, the number you provided is usually the exact number of mails to be displayed. If you do delete or move mails in inbox but Gnus is still using the cached data of inbox, you need provide a bigger number instead. Another solution is to delete ~/.newsrc.eld or ~/.newsrc-dribble and restart Gnus."

Emacs gnus automatically removes emails marked as read, even if read by another email client. It does not remove them however, but only hides them. They can be viewed by entering /o  which insert all old articles, you will need to set the scope either select the default value given or insert your own scope.
It is also possible to permanently disable hiding read emails. I don't do it myself but here's a link: https://stackoverflow.com/questions/15703346/show-all-messages-in-gnus-with-display-all


text:
Emacs/LaTeX displays _char as a subscript in the editor
Emacs seems to be doing some WYSIWYG with _, as if it were in math mode (in the picture, _ is followed by subscript 'o', inside the include statement. It shouldn't. I'm using Emacs/Tex out of the box, no special configuration.
GNU Emacs 24.5.1
$ pdflatex --version
pdfTeX 3.14159265-2.6-1.40.19 (TeX Live 2018)
kpathsea version 6.3.0

Minimal text example for reconstruction:
\documentclass{article}
\usepackage{pdfpages}
\begin{document}
  Underscore-o should not be set as subscript in the next line:
  \includepdf[pages={1}]{home/er/Documents/records/law/fr/om-ren/20170117_o}

  But it should be set as subscript in math environments like $A_o$.
\end{document}

I can reproduce the effect with emacs -Q GNU Emacs 25.1.50.2. One possible solution would be to switch to AUCTeX. Therewith the argument of underscore is only set as subscript if it occurs in math environments. But I agree that AUCTeX is quite heavy. It brings a lot of features which you probably do not want.

The better alternative to latex-mode from tex-mode.el is LaTeX-mode from AUCTeX.
If AUCTeX is not provided by your Linux distribution you find it via package-list-packages after proper setup of package.el.
If you want to stick to latex-modefrom tex-mode.el and if you do not excessively use math in your documents you can toggle off tex-fontify-script via the customization interface. You get to the customization interface by M-x customize-option RET tex-fontify-script RET.

Thanks. AUCTeX displays underscored correctly. I'm posting a new question for setting up the viewer.

@Erwann If Xviewer is the name of the executable then Command should be Xviewer %o and Viewer Executable should be Xviewer.

Sorry, I'm having this problem again: $\omega_1$ is displayed in the editor with 1 as underscript (WYSIWYG). I'm under AUCTeX 12.2 and I did M-x LaTeX-mode.

This is an old problem, with an answer here - just use \textunderscore keyword. Works both in LaTeX and .org files. The underscore character is reserved in LaTeX.
In Emacs:

The resulting .pdf:


text:
Setting up Emacs/AUCTeX viewer
I have installed AUCTeX, it compiled a test file OK, but I can't view the output.
I get " Cannot get Evince viewer ...". Xviewer, should be the analogue in my distro, I think (I have not way to check through TeXworks as it uses an integrated viewer), as that is what I use to view pdf files.
I tried M-x customize-variable  TeX-view-program-list  following the instruction of a related post.
Then under INS, I put as 'name' Xreader. What should I put in the other fields?
$ cat /etc/*-release
DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=18.3
DISTRIB_CODENAME=sylvia
DISTRIB_DESCRIPTION="Linux Mint 18.3 Sylvia"

If xreader is the name of the executable then Command should be xreader %o and Viewer Executable should be xreader.

I did that, and then I was ask to set TeX-view-program-selection to xreader, and put Xreader under View. It worked.


text:
Disable `indent-relative`
What's the right way to disable Emacs' default indent-relative behaviour and make sure that TAB always indents by a single level (be it a tab or whitespace character)?
There doesn't seem to much information about this in Emacs, but I get the impression that perhaps tab-stop-list is part of the solution if I remap indent-relative to tab-to-tab-stop.

indent-relative is a function that is defined to add sufficient whitespace to align the current line relative to the previous line. If what you really want is tab-to-tab-stop, you should use that instead, rather than redefining indent-relative. In many modes, M-i is bound to tab-to-tab-stop, and you can always bind it to something more convenient (including possibly whatever indent-relative is bound to in the mode).

You're right, I realised my mistake with tab-to-tab-stop later. Thanks for clarifying. For the time being I only bound TAB to indent-for-tab-command. Fancy adding an answer or shall I answer my own question based on your inputs?

If you want to use tab-to-tab-stop, just do so! tab-to-tab-stop and indent-relative are different functions, designed to do different things. Different modes will bind one or the other (or something else) to TAB, according to what the mode writer thought would be most convenient. If you prefer to use something other than the default, just rebind the key to use your preferred function.
Redefining the function, particularly with built-in functions, is likely to cause unexpected problems later on.


text:
emacs prompting for github password
I've recently switched from spacemacs to radian and have suddenly run into magit prompting for my github password whenever I view the status of a repository (the repository is configured to use SSH). However, I am still able to update the repo's status in magit, as well as stage, commit, and push changes.
When I perform the same actions on the command line, I am not prompted for a password and it seems as if git is picking up the configuration correctly.
Emacs has the correct SSH_AGENT_PID and SSH_AGENT_SOCK present in getenv.
Backtrace after setting M-x toggle-debug-on-quit is available at https://gist.github.com/peschkaj/c0c102f8a5d383f603e1319ba9e7395c
Environment is:

Emacs 26.1
macOS 10.13.6
magit 2.13.0
Using radian as the basis of emacs configuration

Is your remote repo using an ssh url, or an https one? What do you mean by "view the status of a repository"? Does that mean fetch, or literally just refresh the status buffer?

The repo is using ssh, and by view status I mean just refresh the status buffer.

I'm surprised you get a prompt just for the status buffer. Maybe this is a ghub thing? Could you M-x toggle-debug-on-quit, hit C-g at the prompt, and post the resulting backtrace?

@npostavs I've updated the question with the backtrace and magit version number.

Okay, the prompting is from magit-gh-pulls, not magit itself. I don't know much about it, but https://github.com/sigma/magit-gh-pulls/issues/111 and/or https://github.com/sigma/magit-gh-pulls/issues/121 seem related.

That's the solution, thank you! If you'd like to write it up and get the internet points, feel free. Otherwise I can post the solution myself later on today.

Go ahead and post it yourself; I can see that the problems described there look similar, but it's not really clear to me what the solution is.

The solution to this was to supply a github user and oauth-token in the git config
git config --global --add github.user <user>
git config --global --add github.oauth-token <token>

Once both the oauth token and username are in place, and emacs has been restarted, I'm no longer prompted for my username and password.


text:
Using Tabs as indentation with Cython emacs
Under my home directory I have a .emacs file which has the following lines -
(add-to-list 'load-path "~/.emacs.d/")
(require 'cython-mode)

and under the .emacs.d directory I have this file - cython-mode.el which I downloaded from here - Cython-mode.el and I have been using emacs with Cython for over a week now but I cannot seem to do a tab. When I hit tab it does not indent at all. Where am I going wrong ?
Sample example -
cdef extern from "Skip_list.cpp":
pass

The pass word should come under extern but it does not. I am not able to figure out why.
OS - Ubuntu 18.04 LTS, Cython 0.24 , Emacs version - 25.2
UPDATE
When I type M-x cython-mode the word "pass" does get indented properly but I get this message at the bottom of emacs. Why is this not done automatically and does this mean I have to do it manually every single time ?
Can't guess python-indent-offset ,using defaults : 4
I also did a
 find . -name "python.el"

and
 find . -name "python-mode.el"

as user root on my Ubuntu and both these finds gave me null results.

You can use M-xlocate-library to tell you exactly where
Emacs is getting a particular library from. In your case it's possible
that you only have the compiled versions, which would all be filenames
ending in .elc

@rpluim - Excellent point. There is indeed a python.elc. How do you suggest I fix my problem ?

I don't think there's a problem to fix, unless you're unhappy with python-mode's default of 4 space indenting. If you're referring to having to type M-xcython-mode, then you should investigate the documentation of the variable auto-mode-alist

@rpluim I read about it but I am not sure how it will help ensure that my Cython code is indented properly

You said that indentation happens as intended after you do M-xcython-mode, which indicates your buffer is not being put in cython-mode automatically. auto-mode-alist is a way of indicating which modes gets used based on the name of the file you're editing.

@rpluim can you help ? On my Ubuntu 18.04 machine Emacs mode for cython is simply unusable. It does not recognize any indentation.


text:
How to change the language of the menu on GUI version
how to change language of the menu? I go to Options > multilingual envi... > set language ...; but nothing happends.

Down-voted just so that "Community" will not auto-bump this question again (which was posted by a non-user, who is consequently unlikely to be contributing to this any further).

I go to Options > multilingual envi... > set language ...

It makes sense to some extent.  It will make Emacs use the language you set up whenever possible.

For example, if you set your language-environment to "Hebrew", then Emacs will show you TUTORIAL.he instead of TUTORIAL (after you type C-h t).
But this is just “whenever possible”.  Since Emacs doesn't have a translation for GUI text, you won't get what you want.
Note that GNU Emacs is free/libre software, so if you need the translation, you can edit its source code and build an Emacs which fits your needs perfectly!

(Though that's really complicated.)

If I've guessed correctly, you're hoping that Emacs' own user interface is translated into different languages, which is unfortunately not the case (or at least not to my knowledge).
The menu option you selected calls set-language-environment which has the following purpose:

Set up multilingual environment for using LANGUAGE-NAME.
  This sets the coding system priority and the default input method
  and sometimes other things.  LANGUAGE-NAME should be a string
  which is the name of a language environment.  For example, "Latin-1"
  specifies the character set for the major languages of Western Europe.

For more information, see C-hig (emacs)Language Environments RET specifically, and its parent node (emacs)International regarding support for international character sets in general.

Thanks for clarify the purpose of the option set-language-environment. It's a pity that emacs don't has a gui translate.


text:
Atom Dark Theme Not Applied Completely
I run emacs from my xfce4 (version 0.8.7.4) terminal on my Linux machine. When I applied the atom-one-dark-theme, I noticed that below the information bar it did not apply that colouring of the theme there. See screenshot below:

As you can see there is a white border at the bottom. Is this an issue with my terminal or is it an issue with the theme? I noticed in these screenshots that there should be no gaps in the colouring.

That just looks like padding your terminal adds to me. I'm assuming it's there because you're using a maximized window, and terminals have to resize by characters rather than pixels. You can clearly see your minibuffer below the mode line, that's the bottom line of the terminal. It looks like your theme is applied correctly. The only way I can think of to prevent this from happening is to run graphical emacs and set it to resize by pixels.

Yeah you are right. I switched to the graphical version of emacs and I don't get the problem.

The theme is applied right. The white lines you see between the borders of your window and actual content are there because terminals resize in character sized increments rather than pixels, and you're in a maximized window. The only way to get rid of them is to use graphical Emacs and enable pixelwise resizing, which you can do by adding following to your init file:
(setq frame-resize-pixelwise t)


text:
Kill inferior python in python.el mode
At the moment I am killing the Python interpreter with C-d each time I want to quit Python interpreter.
What is the name of the function to kill the Python interpreter in Python mode (the one which comes with Emacs) so that I can bind it to a key command?

Welcome to Emacs Stack Exchange! If I've answered your question, you can accept it by clicking the checkmark next to it and it will give you +2 to your rep! Cheers!

If nothing works for you, you can kill the python interpreter by simply typing inside the command quit().

Looks like you want comint-stop-subjob but it looks like it's already bound to C-c C-z for you.
From the docs:

C-c C-z

Stop the shell or its current subjob if any (comint-stop-subjob). This command also kills any shell input pending in the shell buffer
    and not yet sent.

Thanks for your reply! C-c C-z doesn't kill the python shell, but simply changes to the buffer having the shell in it. The right command for me was C-c C-\\, thanks for the link enyway.

I believe the command you're looking for is (comint-send-eof).
You can bind it with something like:
(global-set-key (kbd "<f5>") 'comint-send-eof)

It is bound, by default, to C-c C-d.


text:
How to place Author and Date under title?
When exporting to html I get the following in the footer:

Date: 10/6/18
Author: Alan U. Kennington
Created: 2018-10-06 Sat 14:58
Validate

But when when I export it to LaTex the author and date are under the title as they should be. How do I fix this for html? Also, is it possible to remove the "Created" and "Validate"?

When exporting to html I get the following in the footer:

That's HTML postamble, see (info "(org) HTML preamble and postamble").

is it possible to remove the "Created" and "Validate"?

Yes, use #+OPTIONS: html-postamble:nil or (setq org-html-postamble nil).

How to place Author and Date under title?

One solution is to use HTML preamble, for example,
(setq org-html-preamble-format
      '(("en"
         "
%t

%d BY %a
")))

and to avoid showing two titles, you also need to use #+OPTIONS: title:nil to discard the default title.
Here is a simple org-mode file
#+TITLE: A simple org-mode file
#+DATE: <2018-10-07 Sun>
#+AUTHOR: someone
#+OPTIONS: title:nil html-postamble:nil html-style:nil html-scripts:nil html-doctype:html5
#+HTML_DOCTYPE: html5

blah blah blah

after setting org-html-preamble-format as above, the HTML export will be
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>A simple org-mode file</title>
    <meta name="generator" content="Org mode">
    <meta name="author" content="someone">

A simple org-mode file

2018-10-07 Sun 00:00 BY someone

        blah blah blah


text:
Change location of latex options (\bibliography{}) in exported .tex file
I just spend hours trying to figure out why bibtex citations don't work. Turns out it's because \bibliography{testbib} needs to come after begin{document}.
This is my test.org:
#+LATEX_HEADER: \usepackage{natbib}
#+LATEX_HEADER: \bibliographystyle{plainnat}

* Test
This is a test. \citep{Nobody06}

#+LATEX_HEADER: \bibliography{testbib}

This is the generated test.tex (only the relevant parts):
% Created 2018-11-01 Thu 13:28
% Intended LaTeX compiler: pdflatex
\documentclass[11pt]{article}
[ ... ]
\usepackage{natbib}
\bibliographystyle{plainnat}
\bibliography{testbib}
[ ... ]
\section{Test}
\label{sec:orgfb2727b}
This is a test. \citep{Nobody06}
\end{document}

Manually changing the file to this:
% Created 2018-11-01 Thu 13:28
% Intended LaTeX compiler: pdflatex
\documentclass[11pt]{article}
[ ... ]
\usepackage{natbib}
\bibliographystyle{plainnat}
[ ... ]
\section{Test}
\label{sec:orgfb2727b}
This is a test. \citep{Nobody06}
\bibliography{testbib}
\end{document}

Fixes the issue so that I can run the pdflatex and bibtex commands to generate the references in the final pdf file.
Is there some way I can force the line \bibliography{testbib} to be inserted in the right spot from within Emacs? I.e. so that I can just run C-c C-e l p to export a pdf without having to manually run pdflatex and bibtex?

Why don't you just put the \bibliography{} line at the end of your org-file where you want it? I usually do that, and put the bibliographystyle line right above it.
If you are trying to get org-mode to automatically compile your pdf with bibtex, you may need to configure the org-latex-pdf-process variable. See
https://github.com/jkitchin/org-ref/blob/master/org-ref.org#latex-export
for some examples of how to do that.

It had to be something so obvious of course...
Removing the #+LATEX_HEADER: and changing the Latex Run Command to pdflatex solved the problem. Thanks a lot!


text:
Quick Startup in Org-Mode?
There are two ways I start a new org-mode file:
1) I open Emacs and then by Ctr-x Ctr-f I type in the address of the location of where I want my file to be in.
2) I right click the place I want my file to be in and create a new Text Document. I name the document and modify the end by replacing .txt with .org
I find the second way faster but still not as fast as opening Notepad which I do just by typing in Note in the search bar (I am using Windows 10). Is there a way to open a new org-mode file as fast as opening Notepad?

To avoid renaming the file in the second way you can tell emacs to open txt files in org-mode. Also it might be worth looking at the package deft. See for example http://pragmaticemacs.com/emacs/make-quick-notes-with-deft/

Deft looks good, I'll check it out.

I set my initial *scratch* to be org-mode.
(setq initial-major-mode 'org-mode)

Of course, *scratch* buffers start with that little message.  You can remove that with this:
(setq initial-scratch-message "")

But what if you want a new *scratch* buffer?
(defun create-scratch-buffer nil
  "create a scratch buffer"
  (interactive)
  (switch-to-buffer (get-buffer-create "*scratch*"))
  (org-mode))

If you want to change the default mode for all text files to org-mode, you could use the text-mode-hook.
   (add-hook 'text-mode-hook 'org-mode)

It looks like to set a default mode for a file using find-file you'll need to do something a little more involved.  If you include org-mode on the find-file-hook, then all buffers are changed.  That's not what you want.  You want new files without extensions created using C-x C-f to be org-mode.  It looks like that requires modifying the find-file-not-found-functions variable.  I haven't used that before and my quick attempts aren't producing the desired results. Hopefully that gets you in the right direction!

Lots of useful functions to explore in norang website, I think that's were I found these bh/* set of functions for org-mode.
Add an interactive function that creates a temp org file where you choose:
(defun bh/make-org-scratch ()
  (interactive)
  (find-file "/tmp/publish/scratch.org")
  (gnus-make-directory "/tmp/publish"))

Then add a key binding such as:
(global-set-key (kbd "<f9> o") 'bh/make-org-scratch)

Now with F9 o you start a scratch org file that can be later saved using ctrl - xctrl -w

You may want to profile it M-x profiler-start before opening the new org file and M-x profiler-report after. If you're using anything like org-bullets that requires you to M-x all-the-icons-install-fonts then make sure you have set (setq inhibit-compacting-font-caches t) (see github issue).
For me it looks like the following for CPU samples:
Function                                                  CPU samples    %
- command-execute                                                  70  94%
 - call-interactively                                              70  94%
  - funcall-interactively                                          70  94%
   - counsel-find-file                                             69  93%
    - ivy-read                                                     69  93%
     - ivy-call                                                    63  85%
      - counsel-find-file-action                                   63  85%
       - find-file                                                 63  85%
        - find-file-noselect                                       63  85%
         - find-file-noselect-1                                    63  85%
          - after-find-file                                        62  83%
           - normal-mode                                           62  83%
            - set-auto-mode                                        62  83%
             - set-auto-mode-0                                     62  83%
              - org-mode                                           62  83%
               + org-load-modules-maybe                            62  83%
          + normal-backup-enable-predicate                          1   1%
       read-from-minibuffer                                         5   6%
   + profiler-report                                                1   1%
+ ...                                                               3   4%
+ timer-event-handler                                               1   1%

I'm getting a slight delay when initially loading a org file (even a new one) because it is loading org modules for the first time. Anytime I load an org file after that it's instant. If you run emacs as a daemon, you may consider preloading org-mode so that you don't have to wait on the first opening of a file.


text:
How to expand truncated information displayed in the echo area?
I am reading the Elisp Reference Manual. I have noticed that some informations are truncated (ellipsis: suspension points) while they are displayed in the echo area. How to view (know) their full value?
For instance, look at the example given to introduce the function buffer-local-variables, Variables, Buffer-Local Variables, Creating Buffer-Local.
(make-local-variable 'foobar)
(makunbound 'foobar)
(make-local-variable 'bind-me)
(setq bind-me 69)
(setq lcl (buffer-local-variables))
    ;; First, built-in variables local in all buffers:
⇒ ((mark-active . nil)
    (buffer-undo-list . nil)
    (mode-name . "Fundamental")
    ...
    ;; Next, non-built-in buffer-local variables.
    ;; This one is buffer-local and void:
    foobar
    ;; This one is buffer-local and nonvoid:
    (bind-me . 69))

The function buffer-local-variables returns a list describing the local variables defined in the current buffer. Unfortunately, the echo area does not display all the variables.
((buffer-display-time 23545 18944 425229 321000) (buffer-display-count . 2)\
 (buffer -invisiblity-spec . t) (buffer-file-truename) (point-before-scroll)\
 (buffer-auto-save-file-format . t) (buffer-file-format) (enable-multibyte\
  -characters . t) (mark-active . t) (bidi-paragraph-direction . left-to-right)\
 (local-abbrev-table . [## 0 0 0 0 0 0 0 0 0 0 0 ...])\
 (mode-name . "Lisp Interaction") ...)

The local variables foobar and bind-me are not displayed in the echo area although they are members of the list.
(assoc 'bind-me lcl)
⇒ (bind-me . 69)

How can I view the full `package-alist` value (without the truncation characters "...")?
What is the meaning of the ellipsis at the end of some output?

These variables may be relevant:  eval-expression-print-level and eval-expression-print-length:  https://www.gnu.org/software/emacs/manual/html_node/emacs/Lisp-Eval.html
See also the variables:  print-level and print-length:  https://www.gnu.org/software/emacs/manual/html_node/elisp/Output-Variables.html
The *Messages* buffer may contain more information than the minibuffer provided that the appropriate print-length is set.

Unfortunately, even when the value of those four variables is set to nil the messages buffer and the echo area still truncate some elements. Here's an example:
Result: ((entries . #<hash-table equal 15093/18699 0x457c9a47>) (strings) (preamble) (comments) (local-vars) (dialect) (buffer . #<buffer  2:old.bib>) (cur-entry . "OpenPhilanthropy2014CenterBudgetPolicy") (marked-entries) (filter) (sortinfo) (filename . "/Users/pablostafforini/Dropbox/bibliography/old.bi...") (main) (keys) (modtime 25470 28718 565638 721000) (modified) (backup . t))

Do you happen to know the name of the variable(s) that control this behavior?

@Pablo -- You may wish to consider posting a new question with a minimal working example demonstrating the problem, so that forum participants can see whether the variables mentioned hereinabove are at issue, or whether something else is at play in your particular use-case.

Makes sense—thanks. I'll post a question shortly.

I forgot to post the question, but I have now figured out the variables controlling this behavior: edebug-print-level and edebug-print-length. Hopefully this will be useful to others.

The messages sent to the echo-area (message) in emacs reference manual also show in the messages buffer. see emacs-wiki:
also look:
 Inspect message output
How to copy minibuffer contents?


text:
How to define a "composite type" with the "group" constructor?
I am trying to define a composite type using the "group" compositor (see Elisp Manual, section "Composite Types"). Previously, I managed to define a composite type with the "list" constructor.
The Elisp manual tells that these constructors ("group" and "list") are similar. I get a weird result in the "Customize interface" and an error message displayed in the echo area.
Operate on all settings in this buffer:
[ Revert... ] [ Apply ] [ Apply and Save ]

Hide

Sample code
(defcustom group '(1 2 3)
    "here, give a description of the user option."
    :type '(group integer integer integer))

I noticed the message "custom-variable-value-create: Bad format" in the "Messages" buffer.
The manual should be clarified. Someone had the same issue one decade ago: "No doc for `group' in custom :type".
.

I think :type' group' is bugged. I just submitted bug #33566 for this. (BTW, that someone was me, but it's not really the same bug, I think.)


text:
How to make yasnippet fall back to self-insertion when it shouldn't expand
I've decided to try out yasnippet recently, and while it seems to work for me, I have an issue with how it handles comments. I've set my trigger key to SPC, which causes unnecessary snippet expansion in comments (and strings).
It seems that yasnippet has a predefined condition to avoid expansion in such cases in yas-not-string-or-comment-condition, but it causes the trigger key to do nothing rather than falling back to its original behavior, namely self-insert-command. After checking whether setting yas-buffer-local-condition to yas-not-string-or-comment-condition solves the problem for me, I attempted to wrap the function that's bound to trigger keys (yas-expand-from-trigger-key) with advice that falls back to running self-insert-command, but that fails since I don't have access to the key that was pressed.
Has anyone ran into this issue (I wasn't able to find any questions about this here, or in github issues for yasnippet)?

UPDATE:
This is the recommended way, but unfortunately it can't work in my Emacs,
I don't know why, but you could try it:
(define-key yas-minor-mode-map (kbd "SPC") yas-maybe-expand)

Edit after a few months later: this issue has been fixed, see this issue if you're insterested in.

After digging into the source code a bit, I find that below settings could help:
(setq yas-buffer-local-condition yas-not-string-or-comment-condition)
(define-key yas-minor-mode-map (kbd "SPC") 'yas-expand)  ; assume you use this
(setq yas-fallback-behavior 'call-other-command)         ; default is 'return-nil

But it says yas-fallback-behavior is obsolete, and yas-maybe-expand should
be used instead, which I haven't figured out how to yet :(
P.S. There is a github issue about this.

Thanks, it seems to work. Here's the related commit for my config file: https://github.com/DoMiNeLa10/.emacs.d/commit/891dcf5afdc51cad73842013e494968dec1c2cd1. I'll give you the bounty and accept the question once I'm able to.

So yas-maybe-expand also doesn't work for you? Sounds like a bug then.


text:
Byte-compilation and "uninterned" function names
Not quite a duplicate: this appears to be very similar to the situation described in an existing question. But my question is not "why does it happen", but rather "is there any way to keep using uninterned symbols".
Let's say certain macro generates an expansion that is an invocation of a private, runtime-generated function. This function has an "uninterned" name (or, rather, interned in a non-default obarray). When evaluated directly, this works fine.
However, byte-compiled code using said macro and, in effect, the function, won't work, because after write-to-.elc-and-read-back function name symbol becomes truly uninterned, i.e. is not identical to what I have in my internal obarray.
Is there any way to keep function names out of the default obarray, yet still have them work when invoked from .elc files? (I did make some investigations of Emacs source code and haven't found any, but still ask in case I've missed something obvious.)

I would think that your macro expansion needs to take care of the necessary interning to your non-default obarray, but the question would be a lot clearer if you showed some code.

What @phils said - please show some code. The question is currently not too clear, and so it risks being deleted. In general, the more specific/concrete the question, the clearer it is, and the better a candidate it is for emacs.SE.

I believe the answer is "no": writing a symbol which is not interned in the main obarray leads inevitably (if you use the normal print&read code) to an external representation that lost its connection to your obarray, I'm afraid.
Of course, you can try and workaround this problem by printing code like
(defalias (intern "foo" such-and-such-obarray)
          ...)

i.e. don't print the symbol but instead print code which will compute the symbol when evaluated.  How to do that (and whether it's practical) will depend on the details of what you do.

Interesting idea, but unfortunately requires post-processing .elc, which I don't want to require. It also leaves the problem of calling that function unresolved. I'll leave the question open for a while, maybe someone comes up with another trick. But I suspect "no" is correct.

@doublep: I don't think it necessarily requires post-processing the .elc.  As for function calls, you can generate (funcall (intern "foo" such-and-such-obarray) ...).

Calling with such a construct will incur performance penalties on each function invocation, even if it is only one hashtable lookup. Also, I can indeed use defalias the way you proposed, but at least defun really does expect a symbol as name, not e.g. (intern ...) form.

@doublep: Indeed.  You can pre-compute the lookup and store it in a variable, but if you want to do it globally, that var probably needs to be interned, so you're back to square 1.


text:
org-export latex pdf output does not render svg
I tried out this section of code from this repo
#+LATEX_HEADER_EXTRA: \usepackage{svg}

...

#+PROPERTY: header-args :eval never-export :file-ext svg

...

#+NAME: sequence12422
#+BEGIN_SRC plantuml :file-ext png
  ' this is a comment
  Alice -> Bob: Authentication Request
  Bob --> Alice: Authentication Response
  John --> Alice: another Authentication Request
  Alice --> John: another Authentication Response
#+END_SRC

#+RESULTS: sequence12422
[[file:sequence12422.png]]

#+NAME: svg-seq
   #+BEGIN_SRC plantuml
     ' this is a comment
     Alice -> Bob: Authentication Request
     Bob --> Alice: Authentication Response
     John --> Alice: another Authentication Request
     Alice --> John: another Authentication Response
   #+END_SRC

   #+RESULTS: svg-seq
   [[file:svg-seq.svg]]

the png image gets rendered but the svg does not. My org-version is 9.1.9 on macOS mojave. What is the proper way to render svg images on pdf with org export? Am I missing a package or something?
EDIT: In the exported tex file, the exists no command that includes the svg image. However, I can see the \includegraphics{...} for my png image.

I posted an issue on the author's github repo.
You need to:

install inkscape (macOS: brew install caskformula/caskformula/inkscape --HEAD --branch-0.92)
set org-latex-pdf-process with the -shell-escape switch.

     (setq org-latex-pdf-process
       (let
           ((cmd (concat "pdflatex -shell-escape -interaction nonstopmode"
                 " --synctex=1"
                 " -output-directory %o %f")))
         (list cmd
           "cd %o; if test -r %b.idx; then makeindex %b.idx; fi"
           "cd %o; bibtex %b"
           cmd
           cmd)))

make sure the svg image is in the same directory as the file that includes it

Check the conversation in the repo for more details.


text:
how to enable pdflatex --shell-escape switch in org-export dispatcher interface
I would like to add a switch when invoking the org-export dispatcher interface for latex-pdf exports. I'm trying to render an SVG image but the *Org PDF LaTeX Output* buffer errors out because of a missing commandline switch --shell-escape during pdflatex compilation. The result is a PDF that does not render my SVG image. So, how can I add this switch to my pdflatex compilation when exporting from Org Mode?
Package svg Warning: You didn't enable `shell escape' (or `write18')
(svg)                so it wasn't possible to launch the Inkscape export
(svg)                for `svg-sequence1.svg' on input line 107.

! Package svg Error: File `svg-sequence1_svg-tex.pdf' is missing.

See the svg package documentation for explanation.
Type  H <return>  for immediate help.
 ...

l.107 ...udesvg[width=.9\linewidth]{svg-sequence1}

! Package svg Error: File `svg-sequence1_svg-tex.pdf_tex' is missing.

See the svg package documentation for explanation.
Type  H <return>  for immediate help.

Something like this in your init file should do the trick.
(setq org-latex-pdf-process
      '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
    "bibtex %b"
    "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
    "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))

thanks. is there a way I could change the variable on a per buffer basis?

Probably. See https://www.gnu.org/software/emacs/manual/html_node/emacs/File-Variables.html

Very helpful. Thanks again.


text:
how to hook tern and web mode on certain files
I would like for tern to work only on React related files and Tern to only activate when working on React files with Web Mode turned on. Currently, I have tern generally set up with Web Mode, but the issue is that when I edit, let's say, a php file, Tern activates even though it does not need to. So, I would like for Tern to work in the context of Web Mode when I edit a React file only and NOT when I edit other Web Mode related files. Is this possible? Below is my setup, please assume Company is set up as well.
web mode setup
(use-package web-mode
    :defer 2
    :after (add-node-modules-path)
    :ensure t
    :mode ("\\.html?\\'"
           "/themes/.*\\.php?\\'"
           "/\\(components\\|containers\\|src\\)/.*\\.js[x]?\\'"
           "\\.\\(handlebars\\|hbs\\)\\'")
    :config (progn
              (setq
               web-mode-markup-indent-offset 2
               web-mode-css-indent-offset 2
               web-mode-code-indent-offset 2
               web-mode-enable-auto-closing t
               web-mode-enable-auto-opening t
               web-mode-enable-auto-pairing t
               web-mode-enable-auto-indentation t
               web-mode-enable-auto-quoting t
               web-mode-enable-current-column-highlight t
               web-mode-enable-current-element-highlight t
               web-mode-content-types-alist
               '(("jsx" . "/\\(components\\|containers\\|src\\)/.*\\.js[x]?\\'")))))

tern setup
(use-package tern
    :ensure t
    :ensure-system-package (tern . "npm i -g tern")
    :config
    (add-hook 'js2-mode-hook 'tern-mode)
    (add-hook 'web-mode-hook 'tern-mode))

(use-package company-tern
    :requires tern
    :ensure t
    :config
    (add-to-list 'company-backends 'company-tern))

I had the same problem and what helped me was this config proposal from the Readme of the prettier-emacs mode:
https://github.com/prettier/prettier-emacs#usage-with-web-mode
You can declare a function "enable-minor-mode" in your .emacs-file:
(defun enable-minor-mode (my-pair)
  "Enable minor mode if filename match the regexp.  MY-PAIR is a cons cell (regexp . minor-mode)."
  (if (buffer-file-name)
      (if (string-match (car my-pair) buffer-file-name)
      (funcall (cdr my-pair)))))

Then you can hook up any minor-mode that you want to to files that match a certain regexp:
(add-hook 'web-mode-hook #'(lambda ()
                            (enable-minor-mode
                             '("\\.jsx?\\'" . any-minor-mode))))

So in your case (with company and tern) I guess all the code you would have to insert would be something like this:
(defun enable-minor-mode (my-pair)
  "Enable minor mode if filename match the regexp."
  (if (buffer-file-name)
      (if (string-match (car my-pair) buffer-file-name)
      (funcall (cdr my-pair)))
    ))

(require 'company)
(require 'company-tern)
(add-to-list 'company-backends 'company-tern)

(add-hook 'web-mode-hook #'(lambda ()
                            (enable-minor-mode
                             '("\\.jsx?\\'" . tern-mode)
                 )))
(add-hook 'web-mode-hook #'(lambda ()
                            (enable-minor-mode
                             '("\\.jsx?\\'" . company-mode)
                 )))

I hope this helps!


text:
org-capture template error: Template is not a valid Org entry or tree
I am running org version: 9.1.9 and have issues setting up a template for org-capture. I have read over the documentation but cannot figure out why my template throws this error when I call it: org-capture: Capture template ‘pt’: Template is not a valid Org entry or tree
current setup for org mode
(custom-set-variables
 '(org-agenda-files (quote ("life.org" "work.org")))
 '(org-capture-templates
   (quote
    (("p" "Private templates")
     ("pt" "TODO entry" entry
      (file+headline "life.org" "Capture")
      "templates/tmpl-todo.org" :empty-lines-before 1))))
 '(org-directory "~/Sync/org/")
 '(org-refile-allow-creating-parent-nodes (quote confirm))
 '(org-refile-targets (quote ((org-agenda-files :level . 1))))
 '(org-refile-use-outline-path (quote file))
 '(safe-local-variable-values
   (quote
    ((eval add-hook
       (quote after-save-hook)
       (lambda nil
         (org-babel-tangle))
       nil t)))))

file in templates/: tmpl-todo.org
* TODO %^{Description}
  %?
  :LOGBOOK:
  - Added: %U
  :END:

thanks.

I think it should be (file "templates/tmpl-todo.org") in the last line of the template so the whole thing reads:
'(org-capture-templates
   (quote
     (("p" "Private templates")
      ("pt" "TODO entry" entry
        (file+headline "life.org" "Capture")
        (file "templates/tmpl-todo.org") :empty-lines-before 1))))

For more information, do describe-variable on org-capture-templates.


text:
Org Export Latex: Defining Custom Classes for a Title Page From #+TITLE, etc keywords
I stumbled upon this archived email: https://lists.gnu.org/archive/html/emacs-orgmode/2011-02/msg01281.html and a suggestion is to create a custom title page that picks up the title, author, and date from the org file. There is a code block in the post that contains the syntax:
 address@hidden
   \newpage
   \null
   \begin{center}%
   \let \footnote \thanks
     {\usebox{\FIRM}}%
     \vskip 3em%
     {\LARGE address@hidden \par}%
     \vskip 1.5em%
     {\large
       \lineskip .5em%
       \begin{tabular}[t]{c}%
        address@hidden
       \end{tabular}\par}%
     \vskip 1em%
     {\large address@hidden
   \end{center}%
   \par
   \vskip 1.5em}

, but the post does not specify a way to add this to the org-latex-classes, on top of that, the post is really old and not up to date with the org-version I use (9.1.9). There are several posts in here that ask how to add custom classes to latex but I'm trying to do both add a custom title page that reads from the org metadata latex headers. Given that I have this written in my init.el:
;; Org Mode Custom Classes for Latex

(with-eval-after-load 'ox-latex
  (add-to-list 'org-latex-classes
               '("article"
                 "\\documentclass{article}"
                  " address@hidden
                     \newpage
                     \null
                     \begin{center}%
                     \let \footnote \thanks
                       {\usebox{\FIRM}}%
                        \vskip 3em%
                        {\LARGE address@hidden \par}%
                        \vskip 1.5em%
                        {\large
                         \lineskip .5em%
                           \begin{tabular}[t]{c}%
                             address@hidden
                              \end{tabular}\par}%
                            \vskip 1em%
                          {\large address@hidden
                           \end{center}%
                            \par
                             \vskip 1.5em}"
                 ("\\chapter{%s}" . "\\chapter*{%s}")
                 ("\\section{%s}" . "\\section*{%s}")
                 ("\\subsection{%s}" . "\\subsection*{%s}")
                 ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))))

and that I am new to org-mode. How can I accomplish this by editing an existing org file that contains this:
#+TITLE: testing out org mode export latex
#+AUTHOR: me
#+EMAIL: me@meme.com
#+LANGUAGE: es
#+LATEX_CLASS: article
#+LATEX_CLASS_OPTIONS: [12pt,titlepage]
#+LATEX_HEADER: \usepackage{baskervald}
#+LATEX_HEADER: \usepackage[T1]{fontenc}
#+LATEX_HEADER: \usepackage{setspace}
#+LATEX_HEADER: \usepackage[AUTO]{babel}
#+LATEX_HEADER: \usepackage[hyperref,x11names]{xcolor}
#+LATEX_HEADER: \usepackage[colorlinks=true,linkcolor=SteelBlue4,urlcolor=Firebrick4]{hyperref}
#+EXPORT_FILE_NAME: export_with_custom_title
#+OPTIONS: f:t toc:nil |:t
#+STARTUP: showall

#+BEGIN_ABSTRACT
lorem ipsum lorem ipsum ....
#+END_ABSTRACT
#+BEGIN_LATEX latex
\thispagestyle{empty}
\newpage
\doublespacing
#+END_LATEX
#+TOC: headlines 2
#+BEGIN_LATEX latex
\singlespacing
\thispagestyle{empty}
\newpage
\setcounter{page}{1}
#+END_LATEX

* First heading
** second
*** and so on
paragraphs

So, how do I add a custom page title that modifies my title but retains the structure I have in my current org file? So, I am thinking that what I am trying to do is modify the custom article class so that it modifies only the title section by using #+TITLE:..., #+EMAIL:.. and #+AUTHOR:.. but keeps the rest of the edits.

This is probably off-topic for this site: it is more a question of latex than org mode. OTOH, it's not off topic for the org mode mailing list and I know that Tom Dye (who provided the snippet) is active on that list. I would suggest you ask your question there. See https://orgmode.org/community.html for information about the ML.

I agree. This is very specific to Org Mode. However, I have narrowed down to editing custom-variables org-latex-hyperref-template and org-latex-title-command. i'll open another question just about org-latex-title-command

The answer involves writing a latex class (or at least modifying an existing latex class) file that contains the snippet for the cover page, then modifying org-latex-classes to add your new class to it. The latter is easy, the former not so much and it has nothing to do with emacs. That's why I said it's more a latex question. I still maintain that it's off-topic for this site and that you should ask the question on the org-mode mailing list, not because it is org-mode specific, but because it is somewhat related to org-mode. It would not be off-topic there but it is off-topic here.

Yeah. I meant Latex, not Org Mode. No big deal.