commit | author | age
|
5cb5f7
|
1 |
#!/bin/sh |
C |
2 |
|
|
3 |
|
|
4 |
## Copyright (C) 2012 ~ 2018 Thierry Volpiatto <thierry.volpiatto@gmail.com> |
|
5 |
## |
|
6 |
## This program is free software; you can redistribute it and/or modify |
|
7 |
## it under the terms of the GNU General Public License as published by |
|
8 |
## the Free Software Foundation, either version 3 of the License, or |
|
9 |
## (at your option) any later version. |
|
10 |
## |
|
11 |
## This program is distributed in the hope that it will be useful, |
|
12 |
## but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
## GNU General Public License for more details. |
|
15 |
## |
|
16 |
## You should have received a copy of the GNU General Public License |
|
17 |
## along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
18 |
|
|
19 |
## Commentary: |
|
20 |
|
|
21 |
# Preconfigured `emacs -Q' with a basic Helm configuration. |
|
22 |
# Run it from this directory or symlink it somewhere in your PATH. |
|
23 |
|
|
24 |
# If TEMP env var exists, use it, otherwise declare it. |
|
25 |
test -z "$TEMP" && TEMP="/tmp" |
|
26 |
|
|
27 |
CONF_FILE="$TEMP/helm-cfg.el" |
|
28 |
EMACS=emacs |
|
29 |
|
|
30 |
case $1 in |
|
31 |
-P) |
|
32 |
shift 1 |
|
33 |
EMACS=$1 |
|
34 |
shift 1 |
|
35 |
;; |
|
36 |
-h) |
|
37 |
echo "Usage: ${0##*/} [-P} Emacs path [-h} help [--] EMACS ARGS" |
|
38 |
exit 1 |
|
39 |
;; |
|
40 |
esac |
|
41 |
|
|
42 |
LOAD_PATH=$($EMACS -q -batch --eval "(prin1 load-path)") |
|
43 |
|
|
44 |
cd "${0%/*}" || exit 1 |
|
45 |
|
|
46 |
# Check if autoload file exists. |
|
47 |
# It may be in a different directory if emacs-helm.sh is a symlink. |
|
48 |
TRUENAME=$(find . -samefile "$0" -printf "%l") |
|
49 |
if [ ! -z "$TRUENAME" ]; then |
|
50 |
AUTO_FILE="${TRUENAME%/*}/helm-autoloads.el" |
|
51 |
else |
|
52 |
AUTO_FILE="helm-autoloads.el" |
|
53 |
fi |
|
54 |
if [ ! -e "$AUTO_FILE" ]; then |
|
55 |
echo No autoloads found, please run make first to generate autoload file |
|
56 |
exit 1 |
|
57 |
fi |
|
58 |
|
|
59 |
|
|
60 |
cat > $CONF_FILE <<EOF |
|
61 |
(setq initial-scratch-message (concat initial-scratch-message |
|
62 |
";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\\n\ |
|
63 |
;; This Emacs is Powered by \`HELM' using\\n\ |
|
64 |
;; emacs program \"$EMACS\".\\n\ |
|
65 |
;; This is a minimal \`helm' configuration to discover \`helm' or debug it.\\n\ |
|
66 |
;; You can retrieve this minimal configuration in \"$CONF_FILE\".\\n\ |
|
67 |
;; Some original Emacs commands are replaced by their \`helm' counterparts:\\n\\n\ |
|
68 |
;; - \`find-file'(C-x C-f) =>\`helm-find-files'\\n\ |
|
69 |
;; - \`occur'(M-s o) =>\`helm-occur'\\n\ |
|
70 |
;; - \`list-buffers'(C-x C-b) =>\`helm-buffers-list'\\n\ |
|
71 |
;; - \`completion-at-point'(M-tab) =>\`helm-lisp-completion-at-point'[1]\\n\ |
|
72 |
;; - \`dabbrev-expand'(M-/) =>\`helm-dabbrev'\\n\ |
|
73 |
;; - \`execute-extended-command'(M-x) =>\`helm-M-x'\\n\\n |
|
74 |
;; Some other Emacs commands are \"helmized\" by \`helm-mode'.\\n\ |
|
75 |
;; [1] Coming with emacs-24.4, \`completion-at-point' is \"helmized\" by \`helm-mode'\\n\ |
|
76 |
;; which provides Helm completion in many places like \`shell-mode'.\\n\ |
|
77 |
;; Find context help for most Helm commands with \`C-h m'.\\n\ |
|
78 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\\n\\n")) |
|
79 |
|
|
80 |
(setq load-path (quote $LOAD_PATH)) |
|
81 |
(require 'package) |
|
82 |
;; User may be using a non standard \`package-user-dir'. |
|
83 |
;; Modify \`package-directory-list' instead of \`package-user-dir' |
|
84 |
;; in case the user starts Helm from a non-ELPA installation. |
|
85 |
(unless (file-equal-p package-user-dir "~/.emacs.d/elpa") |
|
86 |
(add-to-list 'package-directory-list (directory-file-name |
|
87 |
(file-name-directory |
|
88 |
(directory-file-name default-directory))))) |
|
89 |
|
|
90 |
(setq package-load-list '((helm-core t) (helm t) (async t) (popup t))) |
|
91 |
(package-initialize) |
|
92 |
(add-to-list 'load-path (file-name-directory (file-truename "$0"))) |
|
93 |
(setq default-frame-alist '((vertical-scroll-bars . nil) |
|
94 |
(tool-bar-lines . 0) |
|
95 |
(menu-bar-lines . 0) |
|
96 |
(fullscreen . nil))) |
|
97 |
(blink-cursor-mode -1) |
|
98 |
(require 'helm-config) |
|
99 |
(helm-mode 1) |
|
100 |
(define-key global-map [remap find-file] 'helm-find-files) |
|
101 |
(define-key global-map [remap occur] 'helm-occur) |
|
102 |
(define-key global-map [remap list-buffers] 'helm-buffers-list) |
|
103 |
(define-key global-map [remap dabbrev-expand] 'helm-dabbrev) |
|
104 |
(define-key global-map [remap execute-extended-command] 'helm-M-x) |
|
105 |
(unless (boundp 'completion-in-region-function) |
|
106 |
(define-key lisp-interaction-mode-map [remap completion-at-point] 'helm-lisp-completion-at-point) |
|
107 |
(define-key emacs-lisp-mode-map [remap completion-at-point] 'helm-lisp-completion-at-point)) |
|
108 |
(add-hook 'kill-emacs-hook #'(lambda () (and (file-exists-p "$CONF_FILE") (delete-file "$CONF_FILE")))) |
|
109 |
EOF |
|
110 |
|
|
111 |
$EMACS -Q -l "$CONF_FILE" "$@" |