Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Many changes, updates, fixes

  • Loading branch information...
commit 7b9e9d0457ed41d74ec372697704d87bac0ff53d 1 parent dcb95d3
John Wiegley authored
231 emacs.el
@@ -7,135 +7,26 @@
7 7
8 8 (setq message-log-max 16384)
9 9
10   -;;;_ , Create use-package macro, to simplify customizations
  10 +(require 'use-package)
11 11
12   -(eval-when-compile
13   - (require 'cl))
14   -
15   -(require 'bind-key)
16   -(require 'diminish)
17   -
18   -(defvar use-package-verbose (not at-command-line))
  12 +;;;_ , Utility macros and functions
19 13
20 14 (defmacro hook-into-modes (func modes)
21 15 `(dolist (mode-hook ,modes)
22 16 (add-hook mode-hook ,func)))
23 17
24   -(defmacro with-elapsed-timer (text &rest forms)
25   - `(let ((now ,(if use-package-verbose
26   - '(current-time))))
27   - ,(if use-package-verbose
28   - `(message "%s..." ,text))
29   - ,@forms
30   - ,(when use-package-verbose
31   - `(let ((elapsed
32   - (float-time (time-subtract (current-time) now))))
33   - (if (> elapsed 0.01)
34   - (message "%s...done (%.3fs)" ,text elapsed)
35   - (message "%s...done" ,text))))))
36   -
37   -(put 'with-elapsed-timer 'lisp-indent-function 1)
38   -
39   -(defmacro use-package (name &rest args)
40   - (let* ((commands (plist-get args :commands))
41   - (init-body (plist-get args :init))
42   - (config-body (plist-get args :config))
43   - (diminish-var (plist-get args :diminish))
44   - (defines (plist-get args :defines))
45   - (keybindings (plist-get args :bind))
46   - (predicate (plist-get args :if))
47   - (defines-eval (if (null defines)
48   - nil
49   - (if (listp defines)
50   - (mapcar (lambda (var) `(defvar ,var)) defines)
51   - `((defvar ,defines)))))
52   - (requires (plist-get args :requires))
53   - (requires-test (if (null requires)
54   - t
55   - (if (listp requires)
56   - `(not (member nil (mapcar #'featurep
57   - (quote ,requires))))
58   - `(featurep (quote ,requires)))))
59   - (name-string (if (stringp name) name
60   - (symbol-name name))))
61   -
62   - (if diminish-var
63   - (setq config-body
64   - `(progn
65   - ,config-body
66   - (ignore-errors
67   - ,@(if (listp diminish-var)
68   - (mapcar (lambda (var) `(diminish (quote ,var)))
69   - diminish-var)
70   - `((diminish (quote ,diminish-var))))))))
71   -
72   - (when keybindings
73   - (if (and commands (symbolp commands))
74   - (setq commands (list commands)))
75   - (setq init-body
76   - `(progn
77   - ,init-body
78   - ,@(mapcar #'(lambda (binding)
79   - (push (cdr binding) commands)
80   - `(bind-key ,(car binding)
81   - (quote ,(cdr binding))))
82   - (if (and (consp keybindings)
83   - (stringp (car keybindings)))
84   - (list keybindings)
85   - keybindings)))))
86   -
87   - (unless (plist-get args :disabled)
88   - (if (or commands (plist-get args :defer))
89   - (let (form)
90   - (unless (listp commands)
91   - (setq commands (list commands)))
92   - (dolist (command commands)
93   - (add-to-list
94   - 'form `(autoload (function ,command)
95   - ,name-string nil t)))
96   - `(progn
97   - (eval-when-compile
98   - ,@defines-eval
99   - ,(if (stringp name)
100   - `(load ,name t)
101   - `(require ',name nil t)))
102   - (when ,(or predicate t)
103   - (let ((now ,(if use-package-verbose
104   - '(current-time))))
105   - ,@form
106   - ,init-body
107   - ,(unless (null config-body)
108   - `(eval-after-load ,name-string
109   - '(when ,requires-test
110   - (with-elapsed-timer
111   - ,(format "Configuring package %s"
112   - name-string)
113   - ,config-body)))))
114   - t)))
115   - `(progn
116   - (eval-when-compile
117   - ,@defines-eval
118   - ,(if (stringp name)
119   - `(load ,name t)
120   - `(require ',name nil t)))
121   - (when (and ,(or predicate t)
122   - ,requires-test
123   - ,(if (stringp name)
124   - `(load ,name t)
125   - `(require ',name nil t)))
126   - (with-elapsed-timer ,(format "Loading package %s"
127   - name-string)
128   - ,init-body
129   - ,config-body)
130   - t))))))
131   -
132   -(put 'use-package 'lisp-indent-function 1)
133   -
134   -;;;_ , Utility macros and functions
135   -
136 18 (defun quickping (host)
137 19 (= 0 (call-process "/sbin/ping" nil nil nil "-c1" "-W50" "-q" host)))
138 20
  21 +(defun system-idle-time ()
  22 + (with-temp-buffer
  23 + (call-process "ioreg" nil (current-buffer) nil
  24 + "-c" "IOHIDSystem" "-d" "4" "-S")
  25 + (goto-char (point-min))
  26 + (and (re-search-forward "\"HIDIdleTime\" = \\([0-9]+\\)" nil t)
  27 + (/ (float (string-to-number (match-string 1)))
  28 + 1000000000.0))))
  29 +
139 30 ;;;_ , Read system environment
140 31
141 32 (let ((plist (expand-file-name "~/.MacOSX/environment.plist")))
@@ -693,6 +584,7 @@
693 584 :init
694 585 (if (file-exists-p abbrev-file-name)
695 586 (quietly-read-abbrev-file))
  587 +
696 588 :config
697 589 (add-hook 'expand-load-hook
698 590 (lambda ()
@@ -1091,6 +983,13 @@
1091 983 (add-to-list 'auto-mode-alist '("CMakeLists\\.txt\\'" . cmake-mode))
1092 984 (add-to-list 'auto-mode-alist '("\\.cmake\\'" . cmake-mode))))
1093 985
  986 +;;;_ , color-moccur
  987 +
  988 +(use-package color-moccur
  989 + :bind ("M-s o" . moccur)
  990 + :config
  991 + (use-package moccur-edit))
  992 +
1094 993 ;;;_ , crosshairs
1095 994
1096 995 (use-package crosshairs
@@ -1381,6 +1280,18 @@
1381 1280 (use-package erc-highlight-nicknames)
1382 1281 (use-package erc-patch)
1383 1282
  1283 + (defadvice erc-autoaway-set-away (around erc-autoaway-on-real-idle activate)
  1284 + (let ((currently-idle (floor (system-idle-time))))
  1285 + (if (>= currently-idle erc-autoaway-idle-seconds)
  1286 + (progn
  1287 + (message "System was idle for %d seconds, setting AWAY flag...")
  1288 + ad-do-it)
  1289 + (let ((erc-autoaway-idle-seconds
  1290 + (+ 10 (- erc-autoaway-idle-seconds currently-idle))))
  1291 + (message "System was idle for only %d seconds, waiting %d more..."
  1292 + erc-autoaway-idle-seconds)
  1293 + (erc-autoaway-reestablish-idletimer)))))
  1294 +
1384 1295 (use-package wtf
1385 1296 :commands wtf-is
1386 1297 :init
@@ -1489,7 +1400,6 @@
1489 1400 ;;;_ , grep
1490 1401
1491 1402 (use-package grep
1492   - :defer t
1493 1403 :bind (("M-s d" . find-grep-dired)
1494 1404 ("M-s f" . find-grep)
1495 1405 ("M-s g" . grep))
@@ -1659,15 +1569,13 @@
1659 1569
1660 1570 :config
1661 1571 (progn
  1572 + (helm-match-plugin-mode t)
  1573 +
1662 1574 (use-package helm-descbinds
1663 1575 :commands helm-descbinds
1664 1576 :init
1665 1577 (fset 'describe-bindings 'helm-descbinds))
1666 1578
1667   - (use-package helm-match-plugin
1668   - :init
1669   - (helm-match-plugin-mode t))
1670   -
1671 1579 (defvar helm-c-source-git-files
1672 1580 '((name . "Files under Git version control")
1673 1581 (init . helm-c-source-git-files-init)
@@ -1701,7 +1609,6 @@
1701 1609 ;;;_ , icicles
1702 1610
1703 1611 (use-package icicles
1704   - :disabled t
1705 1612 :if (not running-alternate-emacs)
1706 1613 :init
1707 1614 (progn
@@ -1710,28 +1617,11 @@
1710 1617
1711 1618 (add-hook 'icicle-mode-hook 'icicles-initialize)
1712 1619
1713   - ;; This mode is slow to load, and slow to start. Best to keep it off
1714   - ;; until the last possible moment.
1715 1620 (icy-mode 1))
1716 1621
1717 1622 :config
1718 1623 (progn
1719   - (use-package fuzzy-match)
1720   -
1721   - (use-package color-moccur
1722   - :init
1723   - (bind-key "M-s o" 'moccur)
1724   -
1725   - :config
1726   - (use-package moccur-edit))
1727   -
1728   - (defadvice lusty-file-explorer (around lusty-file-explorer-without-icy
1729   - activate)
1730   - (let ((icy-was-on icicle-mode))
1731   - (if icy-was-on (icy-mode 0))
1732   - (unwind-protect
1733   - ad-do-it
1734   - (if icy-was-on (icy-mode 1)))))))
  1624 + (use-package fuzzy-match)))
1735 1625
1736 1626 ;;;_ , ido
1737 1627
@@ -1748,7 +1638,37 @@
1748 1638 (progn
1749 1639 (use-package ido-hacks
1750 1640 :init
1751   - (ido-hacks-mode 1))
  1641 + (progn
  1642 + (ido-hacks-mode 1)
  1643 +
  1644 + (defmacro ido-hacks-create-wrapper (command)
  1645 + `(defun ,(intern (concat "ido-hacks-"
  1646 + (symbol-name (eval command))))
  1647 + ()
  1648 + (interactive)
  1649 + (flet ((completing-read (&rest args)
  1650 + (apply #'ido-hacks-completing-read args)))
  1651 + (call-interactively ,command))))
  1652 +
  1653 + (ido-hacks-create-wrapper 'ido-hacks-execute-extended-command)
  1654 + (ido-hacks-create-wrapper 'describe-function)
  1655 + (ido-hacks-create-wrapper 'describe-variable)
  1656 + (ido-hacks-create-wrapper 'find-function)
  1657 + (ido-hacks-create-wrapper 'find-variable)
  1658 + (ido-hacks-create-wrapper 'find-library)
  1659 + (ido-hacks-create-wrapper 'customize-option)
  1660 + (ido-hacks-create-wrapper 'customize-group)
  1661 +
  1662 + (bind-key "M-x" 'ido-hacks-ido-hacks-execute-extended-command)
  1663 + (bind-key "C-h f" 'ido-hacks-describe-function)
  1664 + (bind-key "C-h v" 'ido-hacks-describe-variable)
  1665 +
  1666 + (bind-key "C-h e f" 'ido-hacks-find-function)
  1667 + (bind-key "C-h e v" 'ido-hacks-find-variable)
  1668 + (bind-key "C-h e l" 'ido-hacks-find-library)
  1669 +
  1670 + (bind-key "C-c o" 'ido-hacks-customize-option)
  1671 + (bind-key "C-c O" 'ido-hacks-customize-group)))
1752 1672
1753 1673 (defun ido-smart-select-text ()
1754 1674 "Select the current completed item. Do NOT descend into directories."
@@ -2062,10 +1982,21 @@
2062 1982 (use-package lusty-explorer
2063 1983 :bind ("C-x C-f" . lusty-file-explorer)
2064 1984 :config
2065   - (add-hook 'lusty-setup-hook
2066   - (lambda ()
2067   - (bind-key "<space>" 'lusty-select-match lusty-mode-map)
2068   - (bind-key "C-d" 'exit-minibuffer lusty-mode-map))))
  1985 + (progn
  1986 + (add-hook 'lusty-setup-hook
  1987 + (lambda ()
  1988 + (bind-key "<space>" 'lusty-select-match lusty-mode-map)
  1989 + (bind-key "C-d" 'exit-minibuffer lusty-mode-map)))
  1990 +
  1991 + (if (featurep 'icicles)
  1992 + (defadvice lusty-file-explorer (around lusty-file-explorer-without-icy
  1993 + activate)
  1994 + (flet ((message (&rest ignore)))
  1995 + (let ((icy-was-on icicle-mode))
  1996 + (if icy-was-on (icy-mode 0))
  1997 + (unwind-protect
  1998 + ad-do-it
  1999 + (if icy-was-on (icy-mode 1)))))))))
2069 2000
2070 2001 ;;;_ , magit
2071 2002
@@ -2836,8 +2767,6 @@ $0"))))
2836 2767 (progn
2837 2768 (require 'inf-ruby)
2838 2769
2839   - (use-package ruby-tools)
2840   -
2841 2770 (use-package yari
2842 2771 :init
2843 2772 (progn
2  lisp/bind-key
... ... @@ -1 +1 @@
1   -Subproject commit 53fd80b7bc80a9f41f127d6359ccc03bc976a369
  1 +Subproject commit 7425611b361dd7fb2243d668fc2d51047190df48
3  settings.el
@@ -90,6 +90,7 @@
90 90 '(erc-auto-query (quote window-noselect))
91 91 '(erc-autoaway-message "I'm away (after %i seconds of idle-time)")
92 92 '(erc-autojoin-channels-alist (quote (("oftc.net" "#llvm") ("localhost" "&bitlbee") ("freenode.net" "#emacs" "#boost" "#ledger") ("irc.oftc.net" "#llvm") ("irc.schmorp.de" "#schmorpforge"))))
  93 + '(erc-autoaway-mode t)
93 94 '(erc-autojoin-mode t)
94 95 '(erc-fools (quote ("JordiGH")))
95 96 '(erc-generate-log-file-name-function (quote erc-generate-log-file-name-short))
@@ -99,7 +100,7 @@
99 100 '(erc-keywords (quote ("wiegley" "ledger" "eshell")))
100 101 '(erc-log-channels-directory "~/Messages/ERC")
101 102 '(erc-log-write-after-send t)
102   - '(erc-modules (quote (autojoin button completion dcc fill identd irccontrols list log match menu move-to-prompt netsplit networks noncommands readonly replace ring scrolltobottom services smiley stamp spelling track highlight-nicknames)))
  103 + '(erc-modules (quote (autoaway autojoin button completion dcc fill identd irccontrols list log match menu move-to-prompt netsplit networks noncommands readonly replace ring scrolltobottom services smiley stamp spelling track highlight-nicknames)))
103 104 '(erc-nick "johnw")
104 105 '(erc-port 6667)
105 106 '(erc-prompt-for-nickserv-password nil)
2  site-lisp/ido-hacks
... ... @@ -1 +1 @@
1   -Subproject commit 5b7885350b57d2a115c47c5196c6bad138d8cbe7
  1 +Subproject commit b92b3116b9a24cead674298f96e0d446248f4875
13 site-lisp/smart-compile.el
@@ -115,12 +115,13 @@ It calls `compile' or other compile function, which is defined in
115 115
116 116 (if (not name)
117 117 (let ((compile-history
118   - (append compile-history
119   - (delete nil
120   - (mapcar #'(lambda (elem)
121   - (let ((val (cdr elem)))
122   - (and (stringp val) val)))
123   - smart-compile-alist)))))
  118 + (delete-dups
  119 + (append compile-history
  120 + (delete nil
  121 + (mapcar #'(lambda (elem)
  122 + (let ((val (cdr elem)))
  123 + (and (stringp val) val)))
  124 + smart-compile-alist))))))
124 125 (call-interactively #'compile))
125 126 ;; (message (number-to-string arg))
126 127

0 comments on commit 7b9e9d0

Please sign in to comment.
Something went wrong with that request. Please try again.