summaryrefslogtreecommitdiff
path: root/settings
diff options
context:
space:
mode:
authorbenj <benj@rse8.com>2018-03-16 12:39:17 -0700
committerbenj <benj@rse8.com>2018-03-16 12:39:17 -0700
commit67b696a4d68d98fff8158edf9c11b5d5d24d3fa7 (patch)
tree8512e9b385ed17883fd8ee8842549bb0d3d7ec31 /settings
parent5dd18d1598b22000b60a329c6b1cc18896c5ced6 (diff)
parentc38ef385a9af288cf2d2ff0f306b6b2176fcf47d (diff)
downloademacs-67b696a4d68d98fff8158edf9c11b5d5d24d3fa7.tar
emacs-67b696a4d68d98fff8158edf9c11b5d5d24d3fa7.tar.gz
emacs-67b696a4d68d98fff8158edf9c11b5d5d24d3fa7.tar.bz2
emacs-67b696a4d68d98fff8158edf9c11b5d5d24d3fa7.tar.lz
emacs-67b696a4d68d98fff8158edf9c11b5d5d24d3fa7.tar.xz
emacs-67b696a4d68d98fff8158edf9c11b5d5d24d3fa7.tar.zst
emacs-67b696a4d68d98fff8158edf9c11b5d5d24d3fa7.zip
Merge remote-tracking branch 'refs/remotes/origin/master'
Diffstat (limited to '')
-rw-r--r--settings/sane-defaults.el1
-rw-r--r--settings/setup-auto-insert-mode.el30
-rw-r--r--settings/setup-keychain-environment.el75
-rw-r--r--settings/setup-yasnippet.el8
4 files changed, 108 insertions, 6 deletions
diff --git a/settings/sane-defaults.el b/settings/sane-defaults.el
index fa4ca8e..ef7e213 100644
--- a/settings/sane-defaults.el
+++ b/settings/sane-defaults.el
@@ -12,7 +12,6 @@
;; define browsers
(define-key global-map (kbd "C-x w") 'browse-url-emacs)
-(define-key global-map (kbd "C-x w") 'browse-url-emacs)
(define-key global-map (kbd "C-x M-w") 'browse-url-chromium)
;; Also auto refresh dired, but be quiet about it
diff --git a/settings/setup-auto-insert-mode.el b/settings/setup-auto-insert-mode.el
new file mode 100644
index 0000000..81284db
--- /dev/null
+++ b/settings/setup-auto-insert-mode.el
@@ -0,0 +1,30 @@
+(require 'autoinsert)
+
+(defun custom/expand-yasnippet ()
+ "Replace with real stuff"
+ (yas-expand-snippet (buffer-string) (point-min) (point-max)))
+
+(custom-set-variables
+ '(auto-insert-directory (locate-user-emacs-file "auto-insert")))
+
+;; Activate globally
+(auto-insert-mode)
+(setq auto-insert-query nil)
+
+;; Some global auto-insert variables
+(setq user-full-name "Benj Bellon"
+ user-email "benjaminbellon@gmail.com")
+
+;; C
+(define-auto-insert "\\.c\\'" ["template.c" custom/expand-yasnippet])
+(define-auto-insert "\\.h\\'" ["template.h" custom/expand-yasnippet])
+
+;; C++
+(define-auto-insert "\\.cc\\'" ["template.cc" custom/expand-yasnippet])
+(define-auto-insert "\\.hh\\'" ["template.cc" custom/expand-yasnippet])
+
+;; Python
+(define-auto-insert "\\.py\\'" ["template.py" custom/expand-yasnippet])
+
+
+(provide 'setup-auto-insert-mode)
diff --git a/settings/setup-keychain-environment.el b/settings/setup-keychain-environment.el
new file mode 100644
index 0000000..6d6c294
--- /dev/null
+++ b/settings/setup-keychain-environment.el
@@ -0,0 +1,75 @@
+;;; keychain-environment.el --- load keychain environment variables
+
+;; Copyright (C) 2011-2016 Jonas Bernoulli
+;; Copyright (C) 2008-2011 Paul Tipper
+
+;; Author: Paul Tipper <bluefoo at googlemail dot com>
+;; Maintainer: Jonas Bernoulli <jonas@bernoul.li>
+;; Created: 20081218
+;; Homepage: https://github.com/tarsius/keychain-environment
+;; Keywords: gnupg, pgp, ssh
+
+;; This file is not part of GNU Emacs.
+
+;; This file is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; This file is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; For a full copy of the GNU General Public License
+;; see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Keychain is a script that manages ssh-agent and gpg-agent. It is
+;; typically run from the shell's initialization file. It allows your
+;; shells and cron jobs to share a single ssh-agent and/or gpg-agent.
+
+;; When keychain is run, it checks for running agent, otherwise it
+;; starts them. It saves the agents' environment variables to files
+;; inside ~/.keychain/, so that subsequent shells can source these
+;; files.
+
+;; When Emacs is started under X11 and not directly from a terminal
+;; these variables are not set. This library looks for these files
+;; created by keychain and then sets Emacs' environment variables
+;; accordingly. It does not actually run keychain, so you still
+;; have to run that from a login shell first.
+
+;; To use run the function `keychain-refresh-environment' in your
+;; init file. If keychain has not been run yet when you start Emacs
+;; you can also later call that function interactively.
+
+;; Also see: http://www.funtoo.org/wiki/Keychain
+
+;;; Code:
+
+;;;###autoload
+(defun keychain-refresh-environment ()
+ "Set ssh-agent and gpg-agent environment variables.
+Set the environment variables `SSH_AUTH_SOCK', `SSH_AGENT_PID'
+and `GPG_AGENT' in Emacs' `process-environment' according to
+information retrieved from files created by the keychain script."
+ (interactive)
+ (let* ((ssh (shell-command-to-string "keychain -q --noask --agents ssh --eval"))
+ (gpg (shell-command-to-string "keychain -q --noask --agents gpg --eval")))
+ (list (and ssh
+ (string-match "SSH_AUTH_SOCK[=\s]\\([^\s;\n]*\\)" ssh)
+ (setenv "SSH_AUTH_SOCK" (match-string 1 ssh)))
+ (and ssh
+ (string-match "SSH_AGENT_PID[=\s]\\([0-9]*\\)?" ssh)
+ (setenv "SSH_AGENT_PID" (match-string 1 ssh)))
+ (and gpg
+ (string-match "GPG_AGENT_INFO[=\s]\\([^\s;\n]*\\)" gpg)
+ (setenv "GPG_AGENT_INFO" (match-string 1 gpg))))))
+
+(provide 'setup-keychain-environment)
+;; Local Variables:
+;; indent-tabs-mode: nil
+;; End:
+;;; setup-keychain-environment.el ends here
diff --git a/settings/setup-yasnippet.el b/settings/setup-yasnippet.el
index 4145574..5441327 100644
--- a/settings/setup-yasnippet.el
+++ b/settings/setup-yasnippet.el
@@ -1,13 +1,11 @@
(require 'yasnippet)
(setq yas-snippet-dirs '("~/.emacs.d/snippets"))
-(yas-global-mode 1)
-
-(define-key yas-minor-mode-map [(tab)] nil)
-(define-key yas-minor-mode-map (kbd "TAB") nil)
+(yas-global-mode 1)
;; Jump to end of snippet definition
-(define-key yas-keymap (kbd "<return>") 'yas-exit-all-snippets)
+(define-key yas-keymap (kbd "<return>") 'yas-next-field)
+(define-key yas-keymap (kbd "C-x RET TAB") 'yas-exit-all-snippets)
(add-hook 'term-mode-hook (lambda()
(setq yas-dont-activate t)))