├── .cfg-post.d ├── emacs └── org-protocol ├── .emacs ├── .emacs.d ├── batch │ └── as-org-agenda-export.el ├── custom │ ├── as-custom-26.1.el │ ├── as-custom-26.2.el │ ├── as-custom-26.3.el │ ├── as-custom-27.1.el │ ├── as-custom-27.2.el │ ├── as-custom-28.1.el │ ├── as-custom-28.2.el │ ├── as-custom-29.1.el │ ├── as-custom-29.3.el │ ├── as-custom-29.4.el │ └── as-custom-30.1.el ├── debug-init.el ├── init.d │ ├── README │ ├── TODO │ ├── as-autotext.el │ ├── as-blockchain.el │ ├── as-blog.el │ ├── as-bookmarks.el │ ├── as-buffers.el │ ├── as-c.el │ ├── as-comms.el │ ├── as-compilation.el │ ├── as-completion.el │ ├── as-config-langs.el │ ├── as-custom-edit.el │ ├── as-demos.el │ ├── as-desktop.el │ ├── as-diagramming.el │ ├── as-doc-langs.el │ ├── as-edebug.el │ ├── as-editing.el │ ├── as-emacs.el │ ├── as-emojis.el │ ├── as-files.el │ ├── as-finance.el │ ├── as-fonts.el │ ├── as-fun.el │ ├── as-functions.el │ ├── as-git.el │ ├── as-gitbook.el │ ├── as-golang.el │ ├── as-graphql.el │ ├── as-gtd.el │ ├── as-help.el │ ├── as-hideshow.el │ ├── as-javascript.el │ ├── as-jump.el │ ├── as-key-bindings.el │ ├── as-key-chord.el │ ├── as-kmacros.el │ ├── as-linear-prog.el │ ├── as-linting.el │ ├── as-lisp.el │ ├── as-load-custom.el │ ├── as-load-paths.el │ ├── as-lsp.el │ ├── as-lua.el │ ├── as-magit.el │ ├── as-mail.el │ ├── as-mairix.el │ ├── as-midnight.el │ ├── as-mmm-mode.el │ ├── as-mode-lighters.el │ ├── as-mouse.el │ ├── as-multiple-cursors.el │ ├── as-mutt.el │ ├── as-notmuch.el │ ├── as-ocaml.el │ ├── as-org-agenda.el │ ├── as-org-capture.el │ ├── as-org-effort.el │ ├── as-org-integrations.el │ ├── as-org-jump.el │ ├── as-org-keyword-switching.el │ ├── as-org-links.el │ ├── as-org-mode-early.el │ ├── as-org-mode.el │ ├── as-org-new-subheading.el │ ├── as-outlining.el │ ├── as-package-loading.el │ ├── as-parens.el │ ├── as-perl.el │ ├── as-phi-search.el │ ├── as-php.el │ ├── as-point-motion.el │ ├── as-pre-init-d.el │ ├── as-profiling.el │ ├── as-progress.el │ ├── as-projects.el │ ├── as-python.el │ ├── as-require.el │ ├── as-ruby.el │ ├── as-scilla.el │ ├── as-sclang.el │ ├── as-search.el │ ├── as-selection.el │ ├── as-server.el │ ├── as-sh-mode-exts.el │ ├── as-shell.el │ ├── as-smart-mode-line.el │ ├── as-source-paths.el.dis │ ├── as-ssh.el │ ├── as-tech-langs.el │ ├── as-templating.el │ ├── as-terminals.el │ ├── as-themes.el │ ├── as-toggles.el │ ├── as-treemacs.el │ ├── as-treesit.el │ ├── as-ui.el │ ├── as-undo-tree.el │ ├── as-vars.el │ ├── as-vcs.el │ ├── as-web.el │ ├── as-which-key.el │ └── as-windows.el ├── lib │ ├── .gitignore │ ├── as-bounce-buffer.el │ ├── as-cperl.el │ ├── as-destroy-buffer.el │ ├── as-display-buffer-names.el │ ├── as-file-functions.el │ ├── as-find-file-matching-regexp-hook.el │ ├── as-line-ops.el │ ├── as-list-utils.el │ ├── as-make-backup-file-name.el │ ├── as-org-agenda-lib.el │ ├── as-org-stats.el │ ├── as-quelpa.el │ ├── as-rename-current-buffer.el │ ├── as-word-motion.el │ ├── bn-end-of-line-but-one.el │ ├── bn-kill-stuff.el │ ├── bn-secondary-region.el │ ├── fill-common-prefix-region.el │ ├── find-file-in-dir.el │ ├── find-location-in-file.el │ ├── flowed-text.el │ ├── org-action-verbs.el │ ├── org-jump-olp.el │ ├── org-meeting-actions.el │ ├── org-refile-narrowed.el │ ├── set-any-var.el │ └── with-packages.el ├── snippets │ ├── perl-mode │ │ ├── ar │ │ ├── arg │ │ ├── carp │ │ ├── cd │ │ ├── cl │ │ ├── class │ │ ├── cmeth │ │ ├── cmethx │ │ ├── constr │ │ ├── db │ │ ├── debug │ │ ├── debugf │ │ ├── dump │ │ ├── find │ │ ├── for │ │ ├── foreach │ │ ├── getopts │ │ ├── h1 │ │ ├── h2 │ │ ├── hb │ │ ├── la │ │ ├── main │ │ ├── md │ │ ├── me │ │ ├── meth │ │ ├── methx │ │ ├── new │ │ ├── od │ │ ├── open │ │ ├── opendir │ │ ├── openfrom │ │ ├── opento │ │ ├── opentox │ │ ├── openw │ │ ├── openwh │ │ ├── over │ │ ├── p │ │ ├── pf │ │ ├── pkg │ │ ├── psub │ │ ├── self │ │ ├── sf │ │ ├── sub │ │ ├── test │ │ ├── usage │ │ └── while │ └── sh-mode │ │ ├── .yas-make-groups │ │ ├── argument processing │ │ ├── getopts │ │ └── usage │ │ ├── file tests │ │ ├── de │ │ ├── fe │ │ ├── fr │ │ └── fx │ │ ├── flow control │ │ ├── else │ │ ├── elseif │ │ ├── for │ │ ├── if │ │ ├── ifdie │ │ └── while │ │ ├── func │ │ ├── hb │ │ ├── hbb │ │ ├── logging │ │ ├── abort │ │ ├── clog │ │ ├── die │ │ ├── dlog │ │ ├── err │ │ ├── log │ │ └── warn │ │ ├── numeric comparisons │ │ ├── neq │ │ ├── nge │ │ ├── ngex │ │ ├── ngt │ │ ├── ngtx │ │ ├── nle │ │ ├── nlex │ │ ├── nlt │ │ ├── nltx │ │ └── nne │ │ ├── permissions │ │ ├── nroot │ │ └── root │ │ ├── processes │ │ ├── gunzip │ │ ├── qr │ │ └── sr │ │ ├── script context │ │ ├── here │ │ └── me │ │ ├── string tests │ │ ├── se │ │ ├── sex │ │ ├── sn │ │ ├── sne │ │ ├── snex │ │ └── sz │ │ ├── tmp │ │ ├── tmpd │ │ └── variables │ │ ├── passthru │ │ ├── v │ │ └── vx ├── test │ ├── debug-init.el │ ├── key-chord-which-key.el │ ├── package-autoloads.el │ └── which-key.el └── themes │ ├── pastels-on-dark-aspiers-theme.el │ └── sunlight-theme.el ├── .kde └── share │ └── kde4 │ └── services │ └── org.protocol ├── .local └── share │ └── applications │ └── quick-emacs.desktop ├── .netrc.d └── .dir-locals.el ├── .shared_env.d └── person-adam.spiers │ └── emacs ├── .sig ├── Oxford │ ├── Quake │ ├── job │ ├── job_with_disclaimer │ └── normal ├── RAM │ ├── RTFM │ ├── adam@spiers.net-large │ └── simple └── perl │ ├── Oxford_e-mail │ ├── japh_5.004_only │ ├── japh_indirect │ └── japh_method_chain ├── .stow-local-ignore ├── .zsh └── functions │ └── _emk ├── README.md ├── TODO.org ├── bin ├── e ├── ediff ├── edirs ├── ef ├── efg ├── emacs-window-id ├── emk ├── fe ├── feed-X11 ├── focus-emacs-frame ├── key-seq-to-xdotool ├── key-seq-to-xmacro ├── msf-to-yasnippet ├── new-emacs ├── org-annotation-helper ├── qe ├── quick-emacs ├── switch-emacs-eval ├── switch-feed-emacs ├── todo └── update-mairix-link └── lib ├── emacs ├── .gitignore ├── Makefile ├── minor-modes │ └── msf-abbrev │ │ ├── mode-abbrevs │ │ ├── .emacs-dirvars │ │ ├── emacs-lisp-mode │ │ │ ├── defadvicex │ │ │ ├── defunx │ │ │ ├── funcx │ │ │ ├── hlskx │ │ │ ├── printx │ │ │ └── whilex │ │ ├── global │ │ │ ├── flatx │ │ │ ├── hpx │ │ │ ├── lmodex │ │ │ ├── nvex │ │ │ ├── nvsx │ │ │ ├── nvx │ │ │ ├── snailx │ │ │ ├── tigpx │ │ │ ├── waddrx │ │ │ ├── wex │ │ │ └── wsnailx │ │ ├── perl-mode │ │ │ ├── argx │ │ │ ├── arx │ │ │ ├── carpx │ │ │ ├── cdx │ │ │ ├── classx │ │ │ ├── clx │ │ │ ├── cmethx │ │ │ ├── cmethxx │ │ │ ├── constrx │ │ │ ├── dbx │ │ │ ├── debugfx │ │ │ ├── debugx │ │ │ ├── dumpx │ │ │ ├── findx │ │ │ ├── for │ │ │ ├── foreach │ │ │ ├── foreachx │ │ │ ├── forx │ │ │ ├── getoptsx │ │ │ ├── h1x │ │ │ ├── h2x │ │ │ ├── hbx │ │ │ ├── if │ │ │ ├── ifx │ │ │ ├── lax │ │ │ ├── mainx │ │ │ ├── mdx │ │ │ ├── methx │ │ │ ├── methxx │ │ │ ├── mex │ │ │ ├── newx │ │ │ ├── odx │ │ │ ├── opendirx │ │ │ ├── openfromx │ │ │ ├── opentox │ │ │ ├── opentoxx │ │ │ ├── openwhx │ │ │ ├── openwx │ │ │ ├── openx │ │ │ ├── overx │ │ │ ├── pfx │ │ │ ├── pkgx │ │ │ ├── psubx │ │ │ ├── px │ │ │ ├── selfx │ │ │ ├── sfx │ │ │ ├── subx │ │ │ ├── testx │ │ │ ├── usagex │ │ │ ├── while │ │ │ └── whilex │ │ ├── python-mode │ │ │ ├── acceptx │ │ │ ├── argsx │ │ │ ├── assertx │ │ │ ├── boolandx │ │ │ ├── buttonx │ │ │ ├── classx │ │ │ ├── cnx │ │ │ ├── commandthreadx │ │ │ ├── commandx.el │ │ │ ├── commentx │ │ │ ├── cx │ │ │ ├── elseifx │ │ │ ├── elsex │ │ │ ├── errx │ │ │ ├── excx │ │ │ ├── exitx │ │ │ ├── fclosex │ │ │ ├── fileexistsx │ │ │ ├── filesizex │ │ │ ├── filex │ │ │ ├── flusherrx │ │ │ ├── flushoutx │ │ │ ├── fnx │ │ │ ├── fopenx │ │ │ ├── forx │ │ │ ├── fwritex │ │ │ ├── getenvx │ │ │ ├── getoptx │ │ │ ├── groupx │ │ │ ├── gtkconnectx │ │ │ ├── gtkscrollx │ │ │ ├── gtkthreadx │ │ │ ├── hashx │ │ │ ├── hbx │ │ │ ├── hostnamex │ │ │ ├── ifx │ │ │ ├── importx │ │ │ ├── initx │ │ │ ├── listx │ │ │ ├── mainx │ │ │ ├── mapx │ │ │ ├── matchrefx │ │ │ ├── matchx │ │ │ ├── mex │ │ │ ├── mutexx │ │ │ ├── nx │ │ │ ├── packx │ │ │ ├── pdbx │ │ │ ├── printx │ │ │ ├── profilex │ │ │ ├── psycox │ │ │ ├── putenvx │ │ │ ├── randomx │ │ │ ├── setenvx │ │ │ ├── shiftx │ │ │ ├── sleepx │ │ │ ├── sortx │ │ │ ├── strx │ │ │ ├── subx │ │ │ ├── tcpserversocketx │ │ │ ├── tcpsocketx │ │ │ ├── tempdirx │ │ │ ├── tempfilex │ │ │ ├── threadclassx │ │ │ ├── trace2x │ │ │ ├── tracex │ │ │ ├── tryx │ │ │ ├── udpsocketx │ │ │ ├── unamex │ │ │ ├── unpackx │ │ │ ├── usagex │ │ │ ├── whichx │ │ │ └── whilex │ │ ├── ruby-mode.el │ │ ├── ruby-mode │ │ │ ├── acx │ │ │ ├── arx │ │ │ ├── awx │ │ │ ├── clx │ │ │ ├── defx │ │ │ ├── edr │ │ │ ├── hbx │ │ │ ├── ifx │ │ │ ├── initx │ │ │ ├── mex │ │ │ ├── ubrx │ │ │ └── usagex │ │ └── sh-mode │ │ │ ├── abortx │ │ │ ├── bunzipx │ │ │ ├── clogx │ │ │ ├── dex │ │ │ ├── diex │ │ │ ├── dlogx │ │ │ ├── echonnx │ │ │ ├── elseifx │ │ │ ├── elsex │ │ │ ├── errx │ │ │ ├── fex │ │ │ ├── filesizex │ │ │ ├── forx │ │ │ ├── frx │ │ │ ├── funcx │ │ │ ├── fxx │ │ │ ├── getoptsx │ │ │ ├── gunzipx │ │ │ ├── hbbx │ │ │ ├── hbx │ │ │ ├── herex │ │ │ ├── ifdiex │ │ │ ├── ifx │ │ │ ├── instx │ │ │ ├── logx │ │ │ ├── mex │ │ │ ├── neqx │ │ │ ├── ngex │ │ │ ├── ngexx │ │ │ ├── ngtx │ │ │ ├── ngtxx │ │ │ ├── nlex │ │ │ ├── nlexx │ │ │ ├── nltx │ │ │ ├── nltxx │ │ │ ├── nnex │ │ │ ├── nrootx │ │ │ ├── passthrux │ │ │ ├── qrx │ │ │ ├── requireutilx │ │ │ ├── rootx │ │ │ ├── sex │ │ │ ├── sexx │ │ │ ├── snex │ │ │ ├── snexx │ │ │ ├── snx │ │ │ ├── srx │ │ │ ├── szx │ │ │ ├── tmpdx │ │ │ ├── tmpx │ │ │ ├── usagex │ │ │ ├── vx │ │ │ ├── vxx │ │ │ ├── warnx │ │ │ └── whilex │ │ └── msf-abbrev.el ├── shortcuts │ ├── org-agenda-daily-review.el │ ├── org-agenda-today.el │ ├── org-agenda-weekly-review.el │ ├── org-capture-personal-TODO-from-mairix.el │ ├── org-capture-personal-diary-from-mairix.el │ └── org-jump-personal-diary.el └── utils │ ├── as-elisp.el │ ├── mjm-align.el │ ├── org-clock-sound-quiet.wav │ └── org-clock-sound.wav └── xmacro ├── org-agenda ├── org-agenda-daily-review ├── org-capture ├── org-capture-personal-TODO-from-mail ├── org-capture-personal-diary-from-mail ├── org-jump-personal-diary ├── org-jump-personal-note ├── org-jump-personal-todo └── org-jump-to-clock /.cfg-post.d/emacs: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd 4 | 5 | for shortcut in \ 6 | .eid .as-bindings.el .as-gtd.el .as-custom .msf-abbrevs 7 | do 8 | if [ -L $shortcut ]; then 9 | rm $shortcut 10 | fi 11 | done 12 | 13 | # Put this last as it's most likely to fail. 14 | emk 15 | -------------------------------------------------------------------------------- /.cfg-post.d/org-protocol: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | GCONFTOOL=gconftool-2 4 | 5 | if ! which $GCONFTOOL >/dev/null 2>&1; then 6 | echo "WARNING: can't find $GCONFTOOL; url-handlers will not be set" >&2 7 | else 8 | $GCONFTOOL -s /desktop/gnome/url-handlers/org-protocol/command \ 9 | -t string 'quick-emacs --bg-if-poss %s' 10 | $GCONFTOOL -s /desktop/gnome/url-handlers/org-protocol/enabled -t bool yes 11 | fi 12 | 13 | # Ensure ~/.local/share/applications/mimeapps.list has an appropriate 14 | # entry for handling org-protocol:// links. 15 | xdg-mime default quick-emacs.desktop x-scheme-handler/org-protocol 16 | 17 | # This should succeed even without running the above, but it's worth checking 18 | # anyway. 19 | if ! xdg-mime query default x-scheme-handler/org-protocol | grep -q emacs; then 20 | echo "WARNING: xdg-mime failed to install handler for org-protocol:// !" >&2 21 | fi 22 | 23 | # This isn't needed; it's for system-wide .desktop files 24 | #sudo update-desktop-database 25 | -------------------------------------------------------------------------------- /.emacs: -------------------------------------------------------------------------------- 1 | ;; -*- Mode: Emacs-Lisp -*- 2 | ;; 3 | ;; GNU emacs startup file 4 | ;; Adam Spiers 5 | ;; 6 | 7 | ;; Stop Red Hat trampling over my nice config :-( 8 | (setq inhibit-default-init t) 9 | 10 | ;; Duplicated in as-pre-init-d to allow standalone byte-compilation 11 | (defvar edotdir 12 | (or (getenv "ZDOTDIR") "~") 13 | "Home directory to be used to retrieve emacs init files.") 14 | 15 | (setq user-emacs-directory (expand-file-name ".emacs.d" edotdir)) 16 | 17 | (defvar as-init-d-suffix ".emacs.d/init.d") 18 | (message "Using emacs config from %s" edotdir) 19 | (load (concat edotdir "/" as-init-d-suffix "/as-pre-init-d")) 20 | 21 | (require 'cl) ;; for remove-if-not 22 | (defun as-find-hooks (hook-name) 23 | "Uses $ZDOT_FIND_HOOKS to return a list of hooks for `hook-name'." 24 | (let* ((lines (split-string 25 | (shell-command-to-string (concat ". $ZDOT_FIND_HOOKS " hook-name)) 26 | "\n" 27 | 'omit-nulls)) 28 | (files (remove-if-not (lambda (file) (string-match "\\.el\\'" file)) lines))) 29 | (mapcar 30 | ;; trim .el from end to allow `load' to use byte-compiled form 31 | (lambda (file) 32 | (if (string-match "\\.el\\'" file) 33 | (replace-match "" nil t file) 34 | file)) 35 | files))) 36 | 37 | ;; Call (package-initialize) exactly when we want (actually never, because 38 | ;; we're using straight.el now). 39 | (setq package-enable-at-startup nil) 40 | 41 | (defun as-load-hooks (hook-name) 42 | "Load hooks found by `as-find-hooks'." 43 | (dolist (hook-file (as-find-hooks hook-name)) 44 | (as-load-hook hook-file))) 45 | 46 | (defun as-load-hook (hook-file) 47 | "Load the given hook file." 48 | (let ((feature (intern (file-name-nondirectory hook-file)))) 49 | (as-progress "loading %s... " (abbreviate-file-name hook-file)) 50 | (let ((loaded (require feature hook-file))) 51 | (as-progress 52 | (if loaded "loading %s... done" "ERROR: failed to load %s") 53 | (abbreviate-file-name hook-file))) 54 | ;; Canary for forward-word weirdness 55 | ;; https://gist.github.com/aspiers/775ce717bd06d43d7adb 56 | ;; 57 | ;; (with-current-buffer (find-file "~/.emacs") 58 | ;; (goto-char (point-min)) 59 | ;; (forward-word)) 60 | )) 61 | 62 | (unless (or (getenv "EMACS_BATCH") (getenv "DEBUG_EMACS_INIT")) 63 | (as-load-hooks as-init-d-suffix)) 64 | 65 | (as-progress "end of ~/.emacs") 66 | -------------------------------------------------------------------------------- /.emacs.d/batch/as-org-agenda-export.el: -------------------------------------------------------------------------------- 1 | (add-to-list 'load-path 2 | (concat (getenv "HOME") 3 | "/.emacs.d/straight/repos/org/lisp")) 4 | 5 | (require 'org) 6 | (require 'ox-icalendar) 7 | 8 | (load (concat (getenv "HOME") "/.as-custom.el")) 9 | 10 | (let ((org-agenda-files argv) 11 | (org-icalendar-store-UID nil) 12 | (org-export-with-broken-links t)) 13 | (org-icalendar-export-agenda-files) 14 | ;; (org-icalendar-combine-agenda-files) 15 | ;; (org-icalendar-export-to-ics) 16 | ) 17 | -------------------------------------------------------------------------------- /.emacs.d/debug-init.el: -------------------------------------------------------------------------------- 1 | ;; For isolating issues with my config. 2 | ;; Use via: 3 | ;; 4 | ;; emacs -q -l ~/.emacs.d/debug-init.el ~/test.org 5 | ;; 6 | ;; or similar 7 | 8 | (setenv "DEBUG_EMACS_INIT" "t") 9 | (load "~/.emacs") 10 | 11 | ;; Pick one of the .emacs.d/init.d modules to debug, e.g. 12 | (as-load-hook "as-org-mode") 13 | 14 | ;; Or just put some config here to test: 15 | -------------------------------------------------------------------------------- /.emacs.d/init.d/README: -------------------------------------------------------------------------------- 1 | All init files have an `as-' prefix. This clarifies that they are 2 | opinionated, designed only for my usage, and typically not instantly 3 | reusable. It also makes it safer to put this directory on 4 | `load-path', which will aid mapping of dependencies between these 5 | files. 6 | -------------------------------------------------------------------------------- /.emacs.d/init.d/TODO: -------------------------------------------------------------------------------- 1 | - Get rid of as-misc.el and as-functions.el 2 | - Start using same-window-regexps? 3 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-blockchain.el: -------------------------------------------------------------------------------- 1 | ;; Lefteris FTW! https://github.com/ethereum/emacs-solidity/ 2 | (use-package solidity-mode 3 | :custom 4 | (solidity-comment-style 'slash)) 5 | 6 | (use-package solidity-flycheck 7 | :custom 8 | (solidity-flycheck-solc-checker-active t) 9 | (solidity-flycheck-solium-checker-active t) 10 | ;; (setq solidity-flycheck-chaining-error-level ...) 11 | ) 12 | 13 | (with-packages (solidity-mode solidity-flycheck) 14 | :config 15 | (add-hook 'solidity-mode-hook 'flycheck-mode)) 16 | 17 | (use-package company-solidity) 18 | 19 | (defvar as-prettier-solidity-dir-locals-variables 20 | '((solidity-mode . ((eval . (prettier-mode t))))) 21 | "Variables for use with `dir-locals-set-class-variables' to 22 | enable prettier.el for Solidity files.") 23 | 24 | ;; Remember that setting this class may override other classes, 25 | ;; so .dir-locals.el might be a better option. 26 | (dir-locals-set-class-variables 'prettier-solidity 27 | as-prettier-solidity-dir-locals-variables) 28 | 29 | ;; Unmaintained: https://github.com/kootenpv/flymake-solidity/tree/master 30 | ;; (use-package flymake-solidity) 31 | 32 | (provide 'as-blockchain) 33 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-blog.el: -------------------------------------------------------------------------------- 1 | (use-package org2blog 2 | :after (org) 3 | :mode ("\\.o2b\\'" . org-mode) 4 | :config 5 | (add-hook 'org-mode-hook 6 | (lambda () 7 | (and (buffer-file-name) 8 | (string-match "\\.o2b$" (buffer-file-name)) 9 | (org2blog/wp-mode)))) 10 | :bind (("C-c w l" . org2blog/wp-login) 11 | ("C-c w n" . org2blog/wp-new-entry))) 12 | 13 | (provide 'as-blog) 14 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-bookmarks.el: -------------------------------------------------------------------------------- 1 | (require 'as-key-chord) 2 | 3 | (use-package bookmark 4 | :chords (("ZB" . bookmark-jump))) 5 | 6 | (provide 'as-bookmarks) 7 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-buffers.el: -------------------------------------------------------------------------------- 1 | ;; Anything to do with buffer management and switching 2 | 3 | ;; Set C-x C-b to buffer-menu rather than list-buffers so that the 4 | ;; point automatically gets put in the buffer menu. 5 | (bind-key "C-x C-b" 'buffer-menu) 6 | 7 | ;; (use-package bs 8 | ;; :bind ("C-x C-b" . bs-show)) 9 | 10 | (defun as-revert-buffer-without-confirmation () 11 | (interactive) 12 | (revert-buffer t t)) 13 | 14 | (require 'as-mode-lighters) 15 | 16 | (use-feature autorevert :diminish 'auto-revert-mode) 17 | 18 | (use-package frog-jump-buffer 19 | :bind ("C-!" . frog-jump-buffer)) 20 | 21 | (use-feature as-destroy-buffer 22 | :bind ("C-x K" . as-destroy-buffer)) 23 | (bind-key "C-c r" 'as-revert-buffer-without-confirmation) 24 | (bind-key "C-c b" 'bury-buffer) 25 | (bind-key "C-;" 'switch-to-prev-buffer) 26 | (bind-key "C-:" 'switch-to-next-buffer) 27 | (bind-key "C-c B" 'as-bounce-buffer) 28 | (bind-key "C-x I" 'insert-buffer) 29 | (bind-key "" 'as-bounce-buffer) 30 | (bind-key "C-c C-S-r" 'as-rename-current-buffer) 31 | 32 | (use-feature as-display-buffer-names 33 | :bind (("C-c n" . as-display-buffer-filename) 34 | ("C-c N" . as-display-buffer-name))) 35 | 36 | (use-package switch-window 37 | :bind ("C-x o" . switch-window)) 38 | 39 | (use-package minimap 40 | :commands minimap-mode) 41 | 42 | ;; (use-package sublimity 43 | ;; :config 44 | ;; (sublimity-mode 1) 45 | ;; (require 'sublimity-map) 46 | ;; (sublimity-map-set-delay 0.1) 47 | ;; (sublimity-map-show)) 48 | 49 | (provide 'as-buffers) 50 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-c.el: -------------------------------------------------------------------------------- 1 | (add-hook 'c-mode-hook 'as-font-lock-mode-if-window-system) 2 | 3 | (provide 'as-c) 4 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-comms.el: -------------------------------------------------------------------------------- 1 | ;; Interaction / communication with other people. 2 | ;; See as-mail.el for mail-specific setup. 3 | 4 | (defun as-setup-mode-for-discussion () 5 | "Sets up a text mode in the way Adam likes for discussion with 6 | other people." 7 | 8 | ;; Nicer version of fill-paragraph 9 | (local-set-key [(control meta q)] 'fill-common-prefix-region) 10 | 11 | ;; Treat single quoted ("> > ") lines the same as multiple 12 | ;; w.r.t. filling. 13 | (setq adaptive-fill-first-line-regexp adaptive-fill-regexp) 14 | 15 | (setq comment-start "> ")) 16 | 17 | (bind-key "C-$" 'ispell-complete-word) 18 | (bind-key "C-M-$" 'ispell-buffer) 19 | 20 | ;; Telegram client for emacs! 21 | ;; https://zevlg.github.io/telega.el/ 22 | ;; (use-package telega) 23 | 24 | (defun as-noop () 25 | "Do nothing." 26 | (interactive)) 27 | 28 | ;; Protect a key binding for push-to-talk 29 | (bind-key "s-'" 'as-noop) 30 | (bind-key "" 'as-noop) 31 | 32 | (provide 'as-comms) 33 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-compilation.el: -------------------------------------------------------------------------------- 1 | (use-package ansi-color 2 | :config 3 | (defun my-colorize-compilation-buffer () 4 | (when (eq major-mode 'compilation-mode) 5 | (ansi-color-apply-on-region compilation-filter-start (point-max)))) 6 | :hook (compilation-filter . my-colorize-compilation-buffer)) 7 | 8 | (provide 'as-compilation) 9 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-completion.el: -------------------------------------------------------------------------------- 1 | ;; See also as-templating 2 | 3 | (bind-key "M-" 'hippie-expand) 4 | 5 | (require 'as-mode-lighters) 6 | 7 | (use-package company 8 | :diminish company-mode 9 | :config 10 | 11 | ;; fci-mode breaks company :-( 12 | ;; https://github.com/alpaker/Fill-Column-Indicator/issues/54 13 | (defvar-local company-fci-mode-on-p nil) 14 | 15 | (defun company-turn-off-fci (&rest ignore) 16 | "Safely turn off Fill Column Indicator. 17 | If `fci-mode' is enabled disable it and store its state in special variable. 18 | Argument IGNORE is not used" 19 | (when (boundp 'fci-mode) 20 | (setq company-fci-mode-on-p fci-mode) 21 | (when fci-mode (fci-mode -1)))) 22 | 23 | (defun company-maybe-turn-on-fci (&rest ignore) 24 | "Turn on Fill Column Indicator if it was enabled. 25 | If `fci-mode' was enabled turn it on. 26 | Argument IGNORE is not used." 27 | (when company-fci-mode-on-p (fci-mode 1))) 28 | 29 | :hook ((company-completion-started . company-turn-off-fci) 30 | (company-completion-finished . company-maybe-turn-on-fci) 31 | (company-completion-cancelled . company-maybe-turn-on-fci) 32 | (prog-mode . company-mode))) 33 | 34 | ;; (use-package auto-complete-css) 35 | ;; (use-package auto-complete-emacs-lisp) 36 | ;; (use-package auto-complete-ruby) 37 | ;; (use-package auto-complete-yasnippet) 38 | 39 | (provide 'as-completion) 40 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-config-langs.el: -------------------------------------------------------------------------------- 1 | ;; Configuration languages 2 | ;; 3 | ;; See also as-tech-langs.el and as-doc-langs.el 4 | 5 | (use-package rpm-spec-mode 6 | :mode ("\\.spec$" . rpm-spec-mode)) 7 | 8 | (use-package apache-mode 9 | :mode ("\\.htaccess$\\|\\(httpd\\|srm\\|access\\)\\.conf$" . apache-mode)) 10 | 11 | (use-package xrdb-mode 12 | :mode ("\\.Xdefaults$" . xrdb-mode) 13 | :mode ("\\.Xenvironment$" . xrdb-mode) 14 | :mode ("\\.Xresources$" . xrdb-mode) 15 | :mode (".*\\.ad$" . xrdb-mode) 16 | :mode (".*\\.x?rdb$" . xrdb-mode) 17 | :config 18 | (add-hook 'xrdb-mode-hook (lambda () (setq comment-start "! ")))) 19 | 20 | (provide 'as-config-langs) 21 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-custom-edit.el: -------------------------------------------------------------------------------- 1 | (bind-key "C-c G" 'customize-group) 2 | (bind-key "C-c A" 'customize-apropos) 3 | 4 | (defun as-expand-sexp () 5 | "Expand a sexp so that each word is on a separate line." 6 | (save-excursion 7 | (save-restriction 8 | (narrow-to-region (point) 9 | (save-excursion 10 | (forward-sexp) 11 | (point))) 12 | (while (re-search-forward "\\([^[:space:]\n]\\) +\\([^[:space:]\n]\\)" nil t) 13 | (replace-match "\\1\n\\2") 14 | (forward-char -1)))) 15 | (indent-pp-sexp)) 16 | 17 | (defun as-expand-psp () 18 | "In `custom-file', expand package-selected-packages so that 19 | each package is on a separate line in order to minimise merge 20 | conflicts." 21 | (with-current-buffer 22 | (find-buffer-visiting custom-file) 23 | (save-excursion 24 | (goto-char (point-min)) 25 | (cond ((re-search-forward "'(package-selected-packages" nil 'noerror) 26 | (or (re-search-forward "(quote") 27 | (error 28 | "Couldn't find \"(quote\" after package-selected-packages in %s" 29 | custom-file)) 30 | (or (re-search-forward "(") 31 | (error 32 | "Couldn't find starting paren after package-selected-packages in %s" 33 | custom-file)) 34 | (forward-char -1) 35 | (as-expand-sexp)) 36 | (t 37 | ;; (warn "package-selected-packages not found in %s" custom-file) 38 | ))))) 39 | 40 | (defun as-custom-save-hook () 41 | "Hook to tweak Adam's custom-file before saving it." 42 | (when (eq (current-buffer) (find-buffer-visiting custom-file)) 43 | (as-expand-psp))) 44 | 45 | (add-hook 'before-save-hook 'as-custom-save-hook) 46 | 47 | (provide 'as-custom-edit) 48 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-demos.el: -------------------------------------------------------------------------------- 1 | (use-package keycast 2 | :commands (keycast-mode-line-mode 3 | keycast-header-line-mode 4 | keycast-log-mode)) 5 | 6 | (provide 'as-demos) 7 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-desktop.el: -------------------------------------------------------------------------------- 1 | (autoload 'desktop-save "desktop" "Saves desktop session state." t) 2 | 3 | (provide 'as-desktop) 4 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-diagramming.el: -------------------------------------------------------------------------------- 1 | (use-package plantuml-mode 2 | :mode ("\\.puml\\'" . plantuml-mode) 3 | :custom 4 | (plantuml-default-exec-mode 'jar) 5 | (plantuml-jar-path "/usr/share/java/plantuml.jar") 6 | (plantuml-indent-level 4)) 7 | 8 | (use-package flycheck-plantuml) 9 | 10 | (with-packages (org plantuml-mode) 11 | :custom 12 | (org-plantuml-jar-path plantuml-jar-path) 13 | 14 | :config 15 | (add-to-list 'org-src-lang-modes '("plantuml" . plantuml)) 16 | (org-babel-do-load-languages 'org-babel-load-languages 17 | '((plantuml . t)))) 18 | 19 | (provide 'as-diagramming) 20 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-edebug.el: -------------------------------------------------------------------------------- 1 | ;; Define edebug-view-point, which is like edebug-bounce-point but without 2 | ;; the bouncing. 3 | 4 | (defun edebug-bounce-point (arg) 5 | "Bounce the point in the outside current buffer. 6 | If prefix argument ARG is supplied, sit for that many seconds 7 | before returning. The default is one second." 8 | (interactive "p") 9 | (if (not edebug-active) 10 | (error "Edebug is not active")) 11 | (save-excursion 12 | ;; If the buffer's currently displayed, avoid set-window-configuration. 13 | (save-window-excursion 14 | (edebug-view-point-1) 15 | (message "Current buffer: %s Point: %s Mark: %s" 16 | (current-buffer) (point) 17 | (if (marker-buffer (edebug-mark-marker)) 18 | (marker-position (edebug-mark-marker)) "")) 19 | (sit-for arg) 20 | (edebug-pop-to-buffer edebug-buffer (car edebug-window-data))))) 21 | 22 | (defun edebug-view-point () 23 | "View the point in the outside current buffer. 24 | 25 | If you want the outside current buffer to remain visible while 26 | stepping through the code, use `edebug-toggle-save-windows` to 27 | disable window saving. 28 | 29 | Use `edebug-where` to return." 30 | (interactive) 31 | (if (not edebug-active) 32 | (error "Edebug is not active")) 33 | (edebug-view-point-1) 34 | 35 | ;; Failed attempt to make outside buffer "sticky" even when window saving 36 | ;; is enabled: 37 | ;; 38 | ;; (setq edebug-inside-windows 39 | ;; (edebug-current-windows edebug-save-windows)) 40 | ;; (edebug-set-windows edebug-outside-windows) 41 | (message "Current buffer: %s Point: %s Mark: %s Return with %s" 42 | (current-buffer) (point) 43 | (if (marker-buffer (edebug-mark-marker)) 44 | (marker-position (edebug-mark-marker)) "") 45 | (substitute-command-keys "\\\\[edebug-where]"))) 46 | 47 | (defun edebug-view-point-1 () 48 | "View the point in the outside current buffer." 49 | (edebug-pop-to-buffer edebug-outside-buffer) 50 | (goto-char edebug-outside-point)) 51 | 52 | ;; edebug-view-point is already bound to both "v" and "P" which seems 53 | ;; excessive. "P" is a natural mnemonic for the non-bouncing version of "p". 54 | (use-package edebug 55 | :defer t 56 | :config 57 | (define-key edebug-mode-map "P" 'edebug-view-point)) 58 | 59 | (provide 'as-edebug) 60 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-emacs.el: -------------------------------------------------------------------------------- 1 | ;; Stuff relating to generic use of emacs in any context 2 | 3 | (bind-key "C-h a" 'apropos) 4 | 5 | (use-feature set-any-var 6 | :commands set-any-variable 7 | :bind 8 | ("C-c v" . set-any-variable) 9 | ("C-c E" . set-env-variable) 10 | :config 11 | (add-hook 'set-any-variable-minibuffer-setup-hook 12 | #'lispy-mode)) 13 | 14 | (bind-key "C-c V" 'customize-variable) 15 | 16 | (bind-key "C-M-" 'repeat-complex-command) 17 | (bind-key "C-c ." 'repeat) 18 | 19 | (bind-key "C-c F" 'font-lock-fontify-buffer) 20 | 21 | (require 'find-file-in-dir) 22 | (define-find-file-in-dir-function as-find-emacs-init-d 23 | "~/.emacs.d/init.d" "Find emacs init.d file: ") 24 | 25 | ;; See as-jump.el / as-package-loading.el for explanation of usage 26 | (use-feature as-jump 27 | :after which-key 28 | :config 29 | (bind-keys :map as-jump-map 30 | ("e" ".emacs.d/init.d/" . as-find-emacs-init-d))) 31 | 32 | (bind-key "C-h B" 'describe-personal-keybindings) 33 | 34 | ;; I don't visit the FAQ very often; find-function way more useful. 35 | (bind-key "C-h C-f" 'find-function) 36 | (bind-key "C-h C-S-f" 'view-emacs-FAQ) 37 | 38 | ;; Similar pattern for variables 39 | (bind-key "C-h C-v" 'find-variable) 40 | 41 | (bind-key "C-h C-k" 'find-function-on-key) 42 | 43 | (defun as-kbd-to-string () 44 | "Prompt to enter a key sequence, and display the string 45 | required to bind that sequence via `bind-key', `global-set-key' 46 | etc." 47 | (interactive) 48 | (message (key-description 49 | (read-key-sequence "Enter key sequence or chord: ")))) 50 | 51 | (bind-key "C-h C-c" 'as-kbd-to-string) 52 | 53 | (provide 'as-emacs) 54 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-emojis.el: -------------------------------------------------------------------------------- 1 | (require 'as-key-chord) 2 | 3 | (key-chord-define-global "ZE" 'null) 4 | (define-key key-translation-map (kbd " ZE") (kbd "C-x 8 e")) 5 | (define-key key-translation-map (kbd " EZ") (kbd "C-x 8 e")) 6 | 7 | (provide 'as-emojis) 8 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-finance.el: -------------------------------------------------------------------------------- 1 | (with-packages org 2 | :config 3 | (require 'ob-hledger)) 4 | 5 | (provide 'as-finance) 6 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-fonts.el: -------------------------------------------------------------------------------- 1 | ;; This seems to fix invisible UTF org-bullets 2 | (use-package unicode-fonts 3 | :if (<= emacs-major-version 27) 4 | :config (unicode-fonts-setup)) 5 | 6 | ;; See also https://emacsredux.com/blog/2023/03/16/setting-the-default-font-for-emacs/ 7 | (set-face-attribute 'default nil :height 140) 8 | ;; This seems to do the same 9 | ;; (set-frame-font "14" nil t) 10 | ;; (set-frame-font "Source Code Pro 14" nil t) 11 | 12 | (provide 'as-fonts) 13 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-fun.el: -------------------------------------------------------------------------------- 1 | ;; (use-package keywiz) 2 | 3 | (provide 'as-fun) 4 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-functions.el: -------------------------------------------------------------------------------- 1 | (load-library "as-loaddefs") 2 | (require 'as-require) 3 | 4 | (as-progress "functions...") 5 | 6 | ;;{{{ Appearance 7 | 8 | ;;{{{ as-font-lock-mode-if-window-system 9 | 10 | (defun as-font-lock-mode-if-window-system 11 | () 12 | "Turns on font-lock mode if X windows is active." 13 | (interactive) 14 | (if window-system (font-lock-mode))) 15 | 16 | ;;}}} 17 | 18 | ;;}}} 19 | ;;{{{ elisp helper functions 20 | 21 | (autoload 'function-arg-types "as-elisp") 22 | (autoload 'function-arity "as-elisp") 23 | 24 | ;;}}} 25 | ;;{{{ ll => load-library 26 | 27 | (defun ll (library) 28 | "Shortcut to `load-library'." 29 | (interactive "sLoad library: ") 30 | (load-library library)) 31 | 32 | ;;}}} 33 | ;;{{{ Enable disabled functions 34 | 35 | (put 'eval-expression 'disabled nil) 36 | (put 'downcase-region 'disabled nil) 37 | (put 'upcase-region 'disabled nil) 38 | (put 'set-goal-column 'disabled nil) 39 | (put 'scroll-left 'disabled nil) 40 | 41 | ;;}}} 42 | 43 | (as-progress "functions...done") 44 | 45 | (provide 'as-functions) 46 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-git.el: -------------------------------------------------------------------------------- 1 | (use-package browse-at-remote 2 | :bind ("C-c g o" . browse-at-remote)) 3 | 4 | (with-packages (projectile) 5 | :config 6 | (defun as-edit-git-assembly () 7 | "Edit .git/assembly file within current git project." 8 | (interactive) 9 | (if (projectile-project-p) 10 | (if (eq (projectile-project-vcs) 'git) 11 | (find-file (projectile-expand-root ".git/assembly")) 12 | (error "Not in a git project")) 13 | (error "Not in a project"))) 14 | 15 | :bind ("C-c g y" . as-edit-git-assembly)) 16 | 17 | (use-package git-gutter-fringe 18 | :config 19 | (global-git-gutter-mode t)) 20 | 21 | (use-package hydra 22 | :config 23 | ;; https://github.com/abo-abo/hydra/wiki/Version-Control 24 | (defhydra hydra-git-gutter (:body-pre (git-gutter-mode 1) 25 | :hint nil) 26 | " 27 | Git gutter: 28 | _n_: next hunk _s_: st^a^ge hunk _q_uit 29 | _p_: previous hunk _v_: re_v_ert hunk _Q_uit and deactivate git-gutter 30 | ^ ^ _SPC_: po^p^up hunk 31 | _f_: first hunk 32 | _l_: last hunk _R_: set start revision 33 | " 34 | ("n" git-gutter:next-hunk) 35 | ("p" git-gutter:previous-hunk) 36 | ("f" (progn (goto-char (point-min)) 37 | (git-gutter:next-hunk 1))) 38 | ("l" (progn (goto-char (point-min)) 39 | (git-gutter:previous-hunk 1))) 40 | ("s" git-gutter:stage-hunk) 41 | ("v" git-gutter:revert-hunk) 42 | ("SPC" git-gutter:popup-hunk) 43 | ("R" git-gutter:set-start-revision) 44 | ("q" nil :color blue) 45 | ("Q" (progn (git-gutter-mode -1) 46 | ;; git-gutter-fringe doesn't seem to 47 | ;; clear the markup right away 48 | (sit-for 0.1) 49 | (git-gutter:clear)) 50 | :color blue)) 51 | 52 | :bind ("M-G M-g" . hydra-git-gutter/body)) 53 | 54 | 55 | (provide 'as-git) 56 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-gitbook.el: -------------------------------------------------------------------------------- 1 | (fset 'gitbook-expandable-to-headers 2 | (kmacro-lambda-form [?\C-s ?< ?d ?e ?t ?a ?i ?l ?s return ?\C-a ?\C-k ?\C-k ?\M-d ?# ?# ?# ?\C-d ? ?\C-s ?< ?/ ?s ?u ?m ?m ?a ?r ?y return ?\M-b left left ?\C-k ? ?< ?a ? ?h ?r ?e ?f ?= ?\" ?# ?\C-u ?\C-x ?q ?\C- ?\C-r ?# right return right ?\M-w ?\C-e ?\" ? ?i ?d ?= ?\C-y ?\C-/ ?\" ?\C-y ?\" ?> ? ?< ?/ ?a ?> ?\C-s ?< ?/ ?d ?e ?t ?a ?i ?l return ?\C-a ?\C-k ?\C-k up] 0 "%d")) 3 | 4 | (provide 'as-gitbook) 5 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-golang.el: -------------------------------------------------------------------------------- 1 | (use-package go-mode) 2 | 3 | (with-packages (go-mode lsp-mode) 4 | :hook (go-mode . lsp-deferred) 5 | :config 6 | (lsp-register-custom-settings 7 | '(("gopls.completeUnimported" t t) 8 | ("gopls.staticcheck" t t)))) 9 | 10 | ;; https://github.com/golang/tools/blob/master/gopls/doc/emacs.md 11 | ;; suggests: 12 | ;; 13 | ;; (defun lsp-go-install-save-hooks () 14 | ;; (add-hook 'before-save-hook #'lsp-format-buffer t t) 15 | ;; (add-hook 'before-save-hook #'lsp-organize-imports t t)) 16 | ;; (add-hook 'go-mode-hook #'lsp-go-install-save-hooks) 17 | 18 | (use-package go-gopath) 19 | 20 | (provide 'as-golang) 21 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-graphql.el: -------------------------------------------------------------------------------- 1 | (use-package graphql) 2 | (use-package ob-graphql) 3 | 4 | (provide 'as-graphql) 5 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-gtd.el: -------------------------------------------------------------------------------- 1 | ;; Things to help me with Getting Things Done. 2 | ;; http://orgmode.org/worg/org-gtd-etc.php 3 | ;; 4 | ;; See also as-org-jump 5 | 6 | (defvar as-personal-todo "~/org/TODO.org") 7 | 8 | (with-packages org 9 | :init 10 | ;;(require 'org-agenda) 11 | 12 | :bind (:map org-agenda-mode-map 13 | ("i" . 'org-agenda-clock-in) 14 | ("o" . 'org-agenda-clock-out)) 15 | 16 | :config 17 | (require 'as-org-agenda) 18 | (require 'as-org-stats) 19 | (require 'org-meeting-actions)) 20 | 21 | (use-package org-pomodoro 22 | :after (org) 23 | :bind (:map org-mode-map 24 | ("C-c C-x C-S-i" . 'org-pomodoro) 25 | :map org-agenda-mode-map 26 | ("P" . 'org-pomodoro)) 27 | :custom 28 | ;; Test sounds with: 29 | ;; (org-pomodoro-play-sound :start) 30 | ;; (org-pomodoro-play-sound :pomodoro) ;; pomodoro finished 31 | ;; (org-pomodoro-play-sound :overtime) 32 | ;; (org-pomodoro-play-sound :killed) 33 | ;; (org-pomodoro-play-sound :short-break) 34 | ;; (org-pomodoro-play-sound :long-break) 35 | ;; (org-pomodoro-play-sound :tick) 36 | (org-pomodoro-audio-player "mplayer") 37 | (org-pomodoro-finished-sound-args "-volume 40") 38 | (org-pomodoro-overtime-sound "/usr/share/sounds/workrave/default/daily-limit.wav") 39 | (org-pomodoro-short-break-sound "/usr/share/sounds/workrave/default/micro-break-started.wav") 40 | (org-pomodoro-finished-sound "/usr/share/sounds/workrave/default/rest-break-started.wav") 41 | (org-pomodoro-long-break-sound "/usr/share/sounds/workrave/default/rest-break-started.wav") 42 | (org-pomodoro-killed-sound "/usr/share/sounds/workrave/default/break-ignored.wav")) 43 | 44 | ;; Unmaintained fork of org-habit; unfortunately breaks org-agenda: 45 | ;; https://github.com/myshevchuk/org-habit-plus/issues/4 46 | ;; 47 | ;; (use-package org-habit-plus 48 | ;; :straight (:host github :repo "myshevchuk/org-habit-plus") 49 | ;; :after (org)) 50 | 51 | ;; Currently suffers from truncated entry bug: 52 | ;; https://github.com/Elilif/org-heatmap/issues/9 53 | (use-package org-heatmap 54 | :straight (:host github :repo "Elilif/org-heatmap") 55 | :after (org) 56 | :config 57 | (org-heatmap-mode)) 58 | 59 | ;; (use-package beeminder) 60 | 61 | (provide 'as-gtd) 62 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-help.el: -------------------------------------------------------------------------------- 1 | (bind-key "C-h C-i" 'info-display-manual) 2 | 3 | (provide 'as-help) 4 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-hideshow.el: -------------------------------------------------------------------------------- 1 | (use-package hideshow) 2 | (use-package hideshow-org) 3 | 4 | (provide 'as-hideshow) 5 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-key-bindings.el: -------------------------------------------------------------------------------- 1 | ;; In general since emacs 25, C-h k should show the keymap. 2 | ;; But there are corner cases where it doesn't work, in which 3 | ;; case this can be used. 4 | ;; 5 | ;; From https://emacs.stackexchange.com/a/654/2018 6 | 7 | (defun key-binding-at-point (key) 8 | (mapcar (lambda (keymap) (when (keymapp keymap) 9 | (lookup-key keymap key))) 10 | (list 11 | ;; More likely 12 | (get-text-property (point) 'keymap) 13 | (mapcar (lambda (overlay) 14 | (overlay-get overlay 'keymap)) 15 | (overlays-at (point))) 16 | ;; Less likely 17 | (get-text-property (point) 'local-map) 18 | (mapcar (lambda (overlay) 19 | (overlay-get overlay 'local-map)) 20 | (overlays-at (point)))))) 21 | 22 | (defun locate-key-binding (key) 23 | "Determine in which keymap KEY is defined." 24 | (interactive "kPress key: ") 25 | (let ((ret 26 | (list 27 | (key-binding-at-point key) 28 | (minor-mode-key-binding key) 29 | (local-key-binding key) 30 | (global-key-binding key)))) 31 | (when (called-interactively-p 'any) 32 | (message "At Point: %s\nMinor-mode: %s\nLocal: %s\nGlobal: %s" 33 | (or (nth 0 ret) "") 34 | (or (mapconcat (lambda (x) (format "%s: %s" (car x) (cdr x))) 35 | (nth 1 ret) "\n ") 36 | "") 37 | (or (nth 2 ret) "") 38 | (or (nth 3 ret) ""))) 39 | ret)) 40 | 41 | ;; Overrides describe-coding-system which I never use 42 | (global-set-key (kbd "C-h C") 'locate-key-binding) 43 | 44 | (provide 'as-key-bindings) 45 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-key-chord.el: -------------------------------------------------------------------------------- 1 | ;; http://emacsrocks.com/e07.html 2 | 3 | (use-package key-chord 4 | :commands (key-chord-mode key-chord-define-global)) 5 | 6 | (use-package use-package-chords 7 | ;; Ensure that this is available for other (use-package ... :chords ...) 8 | ;; directives: 9 | :demand t 10 | 11 | :config (key-chord-mode 1)) 12 | 13 | (provide 'as-key-chord) 14 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-kmacros.el: -------------------------------------------------------------------------------- 1 | ;; Only an ancient jb-misc-macros (which kmacro-decision requires) is 2 | ;; available via marmalade, and it's missing a dependency on anaphora. 3 | ;; 4 | ;; (use-package kmacro-decision 5 | ;; :require jb-misc-macros) 6 | 7 | (provide 'as-kmacros) 8 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-linear-prog.el: -------------------------------------------------------------------------------- 1 | (use-package gmpl-mode) 2 | 3 | (provide 'as-linear-prog) 4 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-linting.el: -------------------------------------------------------------------------------- 1 | (use-package prettier 2 | :diminish " pr" 3 | :straight (prettier :type git :flavor melpa 4 | :files (:defaults "dist/*") 5 | :branch "master" :host github 6 | :repo "jscheid/prettier.el") 7 | :config 8 | (dir-locals-set-class-variables 'prettier 9 | '((nil . ((eval . (prettier-mode t))))))) 10 | 11 | (provide 'as-linting) 12 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-load-custom.el: -------------------------------------------------------------------------------- 1 | ;; Need to load this before org-mode packages: 2 | ;; 3 | ;; * org-disputed-keys and org-replace-disputed-keys won't work 4 | ;; unless set before org.el is loaded for the first time 5 | 6 | (require 'as-vars) 7 | (require 'as-make-backup-file-name nil 'noerror) ;; need as-make-backup-file-name 8 | 9 | (setq custom-file (format "%s/as-custom-%s.el" 10 | as-custom-dir emacs-version-number)) 11 | 12 | ;; FIXME: this seems misplaced 13 | (unless (fboundp 'as-make-backup-file-name) 14 | (if (eq 'as-make-backup-file-name make-backup-file-name-function) 15 | (setq make-backup-file-name-function nil))) 16 | 17 | (as-progress "loading %s ..." custom-file) 18 | ;; This load is required, according to the info pages: 19 | (load custom-file) 20 | (as-progress "loaded %s" custom-file) 21 | 22 | (provide 'as-load-custom) 23 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-load-paths.el: -------------------------------------------------------------------------------- 1 | ;; At this point emacs doesn't know where to find as-progress. 2 | (eval-and-compile 3 | (if (not (getenv "EMACS_BATCH")) 4 | (message "> Loading as-load-paths ..."))) 5 | 6 | ;; ~/.emacs.d/init.d was already added to load-path by as-pre-init-d.el 7 | (require 'as-vars) 8 | 9 | ;; save original load-path - e.g. useful for finding site-lisp directory 10 | (setq orig-load-path load-path) 11 | 12 | (add-to-list 'load-path as-init-d) 13 | (add-to-list 'load-path as-lib-dir) 14 | 15 | (add-to-list 'load-path as-version-pre-lib-dir) 16 | (add-to-list 'load-path (concat as-version-post-lib-dir "/loaddefs") 'append-at-end) 17 | (add-to-list 'load-path as-version-post-lib-dir 'append-at-end) 18 | 19 | (require 'as-progress) 20 | 21 | (provide 'as-load-paths) 22 | 23 | (eval-and-compile 24 | (if (not (getenv "EMACS_BATCH")) 25 | (message "> Loading as-load-paths ... done"))) 26 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-lua.el: -------------------------------------------------------------------------------- 1 | (use-package lua-mode 2 | :mode ("\\.lua\\'" . lua-mode)) 3 | 4 | (use-package company-lua) 5 | 6 | (provide 'as-lua) 7 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-mail.el: -------------------------------------------------------------------------------- 1 | ;; See as-comms.el for setup related to general communication 2 | 3 | ;; messages-are-flowing is currently useless outside gnus: 4 | ;; https://github.com/legoscia/messages-are-flowing/issues/2#issuecomment-333989987 5 | ;; 6 | ;; But even if it was, it's really annoying to continually reprompt 7 | ;; https://github.com/legoscia/messages-are-flowing/issues/6 8 | ;; (use-package messages-are-flowing 9 | ;; :config 10 | ;; (add-hook 'message-mode-hook 11 | ;; 'messages-are-flowing-use-and-mark-hard-newlines)) 12 | 13 | 14 | (use-feature flowed-text 15 | :bind ("M-s M-m" . format-as-flowed-text)) 16 | 17 | ;; This is for mutt config files, not for writing mail 18 | (use-package mutt-mode) 19 | 20 | (use-feature mail-mode 21 | :mode "/\\(neo\\)?mutt-\\|itsalltext.*mail\\.google" 22 | 23 | :config 24 | (require 'sendmail) 25 | 26 | :hook (mail-mode . (lambda () 27 | (turn-on-auto-fill) 28 | (as-setup-mode-for-discussion) 29 | (as-set-local-server-edit-keys)))) 30 | 31 | (provide 'as-mail) 32 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-midnight.el: -------------------------------------------------------------------------------- 1 | ;; automatically kill unused buffers 2 | 3 | (use-package midnight 4 | :if (not (as-quick-startup))) 5 | 6 | (provide 'as-midnight) 7 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-mmm-mode.el: -------------------------------------------------------------------------------- 1 | (use-package mmm-mode 2 | :commands mmm-mode) 3 | 4 | (provide 'as-mmm-mode) 5 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-mode-lighters.el: -------------------------------------------------------------------------------- 1 | (use-package diminish :demand) 2 | 3 | (provide 'as-mode-lighters) 4 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-mouse.el: -------------------------------------------------------------------------------- 1 | ;; IntelliMouse 2 | (use-feature mwheel 3 | :config 4 | (mwheel-install)) 5 | 6 | ;; This is presumably only useful when my normal window manager 7 | ;; mouse bindings and/or Meta key binding are not in effect. 8 | (when window-system 9 | (bind-key "M-" 'lower-frame) 10 | (bind-key "M-" 'raise-frame)) 11 | 12 | (bind-key "C-S-" 'mouse-start-secondary) 13 | (bind-key "C-S-" 'mouse-set-secondary) 14 | (bind-key "C-S-" 'mouse-drag-secondary) 15 | (bind-key "C-S-" 'mouse-secondary-save-then-kill) 16 | (bind-key "C-S-" 'mouse-yank-secondary) 17 | 18 | (use-feature bn-secondary-region 19 | :bind (("C-M-?" . bn-make-region-into-secondary) 20 | ("C-M-T" . bn-exchange-region-and-secondary) 21 | ("C-g" . bn-keyboard-quit))) 22 | 23 | (provide 'as-mouse) 24 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-mutt.el: -------------------------------------------------------------------------------- 1 | ;; See also mutt-mode on MELPA; not sure which is better 2 | 3 | (use-package muttrc-mode 4 | :straight (muttrc-mode 5 | :fetcher github 6 | :repo "neomutt/muttrc-mode-el")) 7 | 8 | (provide 'as-mutt) 9 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-notmuch.el: -------------------------------------------------------------------------------- 1 | (use-package ol-notmuch 2 | :after org) 3 | 4 | (provide 'as-notmuch) 5 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-ocaml.el: -------------------------------------------------------------------------------- 1 | (use-package tuareg 2 | :mode ("\\.ml\\'" . tuareg-mode)) 3 | 4 | ;; If this causes issues with merlin-company, make sure merlin is up 5 | ;; to date. 6 | (use-package flycheck-ocaml) 7 | 8 | (use-package ocp-indent) 9 | 10 | (provide 'as-ocaml) 11 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-org-integrations.el: -------------------------------------------------------------------------------- 1 | (use-package org-noter) 2 | 3 | (use-package org-notion 4 | :straight (:host github :repo "richardwesthaver/org-notion") 5 | :custom 6 | (org-notion-keymap-prefix "C-c M-n") 7 | :hook (org-mode . org-notion-mode)) 8 | 9 | (provide 'as-org-integrations) 10 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-org-keyword-switching.el: -------------------------------------------------------------------------------- 1 | (require 'as-org-mode) 2 | 3 | (defun org-todo-previous-keyword () 4 | "Move to previous TODO keyword in all sets." 5 | (interactive) 6 | (org-todo 'left)) 7 | 8 | (defun org-todo-next-keyword () 9 | "Move to next TODO keyword in all sets." 10 | (interactive) 11 | (org-todo 'right)) 12 | 13 | (defun org-todo-previous-set () 14 | "Move to previous TODO keyword set." 15 | (interactive) 16 | (org-todo 'previousset)) 17 | 18 | (defun org-todo-next-set () 19 | "Move to next TODO keyword set." 20 | (interactive) 21 | (org-todo 'nextset)) 22 | 23 | (add-hook 24 | 'org-mode-hook 25 | (lambda () 26 | (define-key org-mode-map [(control shift f)] 'org-todo-next-keyword) 27 | (define-key org-mode-map [(control shift b)] 'org-todo-previous-keyword) 28 | (define-key org-mode-map [(control shift p)] 'org-todo-previous-set) 29 | (define-key org-mode-map [(control shift n)] 'org-todo-next-set) 30 | )) 31 | 32 | (provide 'as-org-keyword-switching) 33 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-org-mode-early.el: -------------------------------------------------------------------------------- 1 | ;; Some org-mode initialisation needs to be loaded before packages 2 | ;; which depend on it, otherwise the version of org-mode distributed 3 | ;; with emacs will automatically get pulled in when packages which 4 | ;; depend on org-mode are initialized, and that would result in the 5 | ;; default values for `org-disputed-keys' taking effect and sticking 6 | ;; as long as emacs stays running. 7 | 8 | (custom-set-variables 9 | '(org-disputed-keys 10 | (quote 11 | (([(control shift right)] . [(control shift n)]) 12 | ([(control shift left)] . [(control shift p)]) 13 | ([(control ?,)] . [(control ?')]) 14 | ([(control tab)] . [(control meta tab)])))) 15 | '(org-replace-disputed-keys t)) 16 | 17 | (use-package org) 18 | 19 | (provide 'as-org-mode-early) 20 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-parens.el: -------------------------------------------------------------------------------- 1 | (require 'paren) 2 | 3 | (use-package smartparens 4 | :custom 5 | (sp-ignore-modes-list 6 | '(minibuffer-mode 7 | minibuffer-inactive-mode 8 | emacs-lisp-mode)) 9 | 10 | :config 11 | (smartparens-global-mode t) 12 | (show-smartparens-global-mode t)) 13 | 14 | ;; No integration with treesit.el: 15 | ;; https://github.com/Fanael/rainbow-delimiters/issues/81 16 | ;; 17 | ;; so produces unreliable results. 18 | ;; 19 | ;; (use-package rainbow-delimiters 20 | ;; :hook (prog-mode . rainbow-delimiters-mode)) 21 | 22 | (provide 'as-parens) 23 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-perl.el: -------------------------------------------------------------------------------- 1 | ;; one of these two will work 2 | (autoload 'perl-mode "cperl-mode" "alternate mode for editing Perl programs" t) 3 | (defalias 'perl-mode 'cperl-mode) 4 | 5 | (add-hook 'perl-mode-hook 'as-font-lock-mode-if-window-system) 6 | 7 | (autoload 'as-cperl-setup "as-cperl" "as-cperl-setup") 8 | (add-hook 'cperl-mode-hook 'as-cperl-setup) 9 | (add-hook 'cperl-mode-hook 'turn-on-auto-fill) 10 | (defalias 'cp 'cperl-mode "Abbreviation for `cperl-mode'.") 11 | (add-hook 'cperl-mode-hook (lambda () (setq comment-start "#"))) 12 | 13 | (add-to-list 'auto-mode-alist '("\\.\\(pod\\|t\\)\\'" . cperl-mode)) 14 | 15 | (provide 'as-perl) 16 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-phi-search.el: -------------------------------------------------------------------------------- 1 | (use-package phi-search 2 | :bind (("C-c m C-s" . phi-search) 3 | ("C-c m C-r" . phi-search-backward)) 4 | :config 5 | ;; FIXME: change to req-package 6 | (require 'phi-search-mc) 7 | (define-key phi-search-default-map (kbd "C-g") 'phi-search-abort)) 8 | 9 | (provide 'as-phi-search) 10 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-php.el: -------------------------------------------------------------------------------- 1 | (use-package php-mode 2 | :mode ("\\.php\\'" . php-mode)) 3 | 4 | (provide 'as-php) 5 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-pre-init-d.el: -------------------------------------------------------------------------------- 1 | ;; Needs to be done early, because we load a crap-ton of stuff before 2 | ;; as-custom. 3 | (setq message-log-max 1000) 4 | 5 | (defun as-quick-startup nil 6 | "Non-nil if the current emacs was required to start up quickly." 7 | (getenv "QUICK_EMACS")) 8 | 9 | ;; Duplicated in .emacs in order to be able to load this file 10 | (defvar edotdir 11 | (or (getenv "ZDOTDIR") "~") 12 | "Home directory to be used to retrieve emacs init files.") 13 | 14 | (defvar as-init-d 15 | (cond (load-file-name 16 | (let ((path (file-name-directory load-file-name))) 17 | ;; strip any trailing slash 18 | (if (eq (aref path (- (string-width path) 1)) ?/) 19 | (substring path 0 -1) 20 | path))) 21 | (as-init-d-suffix 22 | (concat edotdir "/" as-init-d-suffix)) 23 | (t 24 | (error "Neither `load-file-name' nor `as-init-d-suffix' set"))) 25 | "Directory containing Adam's emacs startup files.") 26 | 27 | (add-to-list 'load-path as-init-d) 28 | 29 | (require 'as-load-paths) 30 | (require 'as-progress) 31 | 32 | ;; package loading is common enough that we don't want to have to 33 | ;; require it in each file which uses it. This also requires 34 | ;; as-custom. 35 | (require 'as-package-loading) 36 | 37 | (require 'as-org-mode-early) 38 | 39 | (as-loading-done) 40 | 41 | (provide 'as-pre-init-d) 42 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-require.el: -------------------------------------------------------------------------------- 1 | (defun as-check-feature-loaded (feature) 2 | "Check whether FEATURE is loaded: if so, returns it, otherwise 3 | issues a warning and returns nil." 4 | (if (featurep feature) 5 | feature 6 | (message "Warning: failed to load %s" feature) 7 | nil)) 8 | 9 | (provide 'as-require) 10 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-ruby.el: -------------------------------------------------------------------------------- 1 | (use-package ruby-mode 2 | :mode "\\(\\.\\(e?rb\\|rjs\\|rake\\)\\|Rakefile\\|Guardfile\\)\\'" 3 | :interpreter "ruby\\|ruby[12]\\.[0-9]\\|jruby\\|rbx") 4 | 5 | (use-package flymake-ruby) 6 | 7 | (use-feature tar-mode 8 | :mode ("\\.gem\\'" . tar-mode)) 9 | 10 | ;;{{{ rcov.el 11 | 12 | ;; corrections for rcov.el, although it kinda looks lame - no red/green overlaying 13 | 14 | (autoload 'rcov "rcov" "rcov" t) 15 | 16 | (defvar rcov-command-line "rake test:units:rcov RCOVOPTS='--gcc --no-html'" 17 | "Rcov command line to find uncovered code. 18 | It is good to use rcov with Rake because it `cd's appropriate directory. 19 | `--gcc' option is strongly recommended because `rcov' uses compilation-mode.") 20 | (defvar rcovsave-command-line "rake rcov RCOVOPTS='--gcc --no-html --save=coverage.info'" 21 | "Rcov command line to save coverage status. See also `rcov-command-line'.") 22 | (defvar rcovdiff-command-line "rake rcov RCOVOPTS='-D --gcc --no-html'" 23 | "Rcov command line to find new uncovered code. See also `rcov-command-line'.") 24 | 25 | ;;}}} 26 | 27 | (autoload 'rcov-buffer "rcov-overlay" "rcov-overlay" t) 28 | ;; (bind-key "C-c C-r" 'rcov-buffer) 29 | 30 | ;; (use-package autotest :commands autotest) 31 | 32 | ;; I don't use this and it seems to have bugs with autoloading 33 | ;; and maybe also leaving processes running within emacs. 34 | ;; (use-package inf-ruby) 35 | 36 | (require 'as-jump) 37 | (use-package bundler 38 | ;; Need to load which-key to ensure define-key is advised 39 | :after which-key 40 | :config 41 | ;; (defvar as-jump-ruby-map (make-sparse-keymap "Jump to Ruby") 42 | ;; "Adam's prefix keymap for quickly jumping to Ruby stuff") 43 | ;; (bind-keys :map as-jump-ruby-map 44 | ;; ("g" "Ruby bundler gems" . bundle-open)) 45 | 46 | (bind-keys :map as-jump-map 47 | :prefix "R" 48 | :prefix-map as-jump-ruby-map 49 | :prefix-docstring "foo" 50 | :menu-name "ruby map" 51 | ("g" "Ruby bundler gems" . bundle-open))) 52 | 53 | (with-packages (bundler as-which-key) 54 | :config 55 | 56 | ;; Poor workaround which doesn't work for key chords: 57 | ;; (which-key-add-key-based-replacements "C-c j r" "Ruby") 58 | 59 | (as-which-key-add-map-title 'as-jump-ruby-map "Ruby")) 60 | 61 | 62 | (use-package rubocop) 63 | ;; (use-package rudel) 64 | 65 | (provide 'as-ruby) 66 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-scilla.el: -------------------------------------------------------------------------------- 1 | (defvar scilla-root (concat (getenv "HOME") "/blockchain/scilla/scilla") 2 | "Directory where scilla repository is checked out.") 3 | 4 | (use-feature scilla-mode 5 | :after flycheck 6 | :if (file-directory-p scilla-root) 7 | :load-path (lambda () (concat scilla-root "/misc/emacs-mode"))) 8 | 9 | (provide 'as-scilla) 10 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-sclang.el: -------------------------------------------------------------------------------- 1 | (use-package sclang 2 | :mode ("\\.sc\\'" . sclang-mode)) 3 | 4 | (use-package sclang-snippets) 5 | (use-package sclang-extensions) 6 | 7 | (provide 'as-sclang) 8 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-search.el: -------------------------------------------------------------------------------- 1 | ;; Issues with ctrlf: 2 | ;; 3 | ;; - can't disable wraparound 4 | ;; https://github.com/radian-software/ctrlf/issues/68 5 | ;; 6 | ;; - minibuffer overview only via M-s o => ctrlf-occur 7 | ;; which has no native integration 8 | ;; https://github.com/radian-software/ctrlf/issues/69 9 | ;; 10 | ;; - doesn't reveal org structure correctly 11 | ;; https://github.com/radian-software/ctrlf/issues/118 12 | ;; Workaround requires switching back to slower older `overlays' 13 | ;; option for org-fold-core-style. 14 | ;; 15 | ;; (use-package ctrlf 16 | ;; :defer 2 17 | ;; :config 18 | ;; (ctrlf-mode +1) 19 | ;; 20 | ;; ;; https://github.com/raxod502/ctrlf/issues/65 21 | ;; (defun ctrlf-yank-word-or-char () 22 | ;; (interactive) 23 | ;; (let ((input (field-string (point-max))) yank) 24 | ;; (when (or ctrlf--match-bounds (= (length input) 0)) 25 | ;; (with-current-buffer (window-buffer (minibuffer-selected-window)) 26 | ;; (setq yank (buffer-substring-no-properties 27 | ;; (or (and ctrlf--match-bounds 28 | ;; (cdr ctrlf--match-bounds)) 29 | ;; ctrlf--current-starting-point) 30 | ;; (progn (forward-word) (point))))) 31 | ;; (goto-char (field-end (point-max))) 32 | ;; (insert yank)))) 33 | ;; 34 | ;; :bind (:map ctrlf-minibuffer-mode-map 35 | ;; ("" . 'ctrlf-forward-literal) 36 | ;; ("" . 'ctrlf-backward-literal) 37 | ;; ("M-j" . 'ctrlf-yank-word-or-char))) 38 | 39 | ;; Loaded by counsel 40 | (use-package swiper 41 | :demand t 42 | :bind (("C-s" . swiper-isearch) 43 | ("C-r" . swiper-isearch-backward)) 44 | 45 | ;; enable this if you want `swiper' to use it 46 | ;; (setq search-default-mode #'char-fold-to-regexp) 47 | ) 48 | 49 | ;; C-o in ivy mode (e.g. in swiper) gives this super helpful hydra 50 | (use-package ivy-hydra 51 | :after swiper) 52 | 53 | (use-package rg 54 | :chords ("zr" . rg) 55 | :chords ("ZR" . rg-dwim) 56 | :config 57 | (rg-enable-default-bindings) 58 | (rg-define-toggle "-A 3" "A") 59 | (rg-define-toggle "-B 3" "B") 60 | (rg-define-toggle "-C 3" "C")) 61 | 62 | ;; These are used by projectile: 63 | (use-package ripgrep 64 | :after projectile) 65 | (use-package ag 66 | :after projectile) 67 | 68 | (provide 'as-search) 69 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-server.el: -------------------------------------------------------------------------------- 1 | (use-package server 2 | :commands (server-start server-force-delete) 3 | :defer 10 4 | :config 5 | (defun server-restart (interactive) 6 | "Equivalent to `server-force-delete' followed by `server-start'." 7 | (server-force-delete) 8 | (server-start)) 9 | (unless (as-quick-startup) 10 | (condition-case err 11 | (server-start) 12 | (file-error (message "%s" (error-message-string err)))))) 13 | 14 | (use-package edit-server 15 | :commands (edit-server-start edit-server-stop) 16 | :defer 10 17 | :config 18 | (defun edit-server-restart (interactive) 19 | "Equivalent to `edit-server-stop' followed by `edit-server-start'." 20 | (edit-server-stop) 21 | (edit-server-start)) 22 | (unless (as-quick-startup) 23 | (condition-case err 24 | (edit-server-start) 25 | (file-error (message "%s" (error-message-string err)))))) 26 | 27 | (use-package edit-server-htmlize 28 | :commands (edit-server-maybe-dehtmlize-buffer 29 | edit-server-maybe-htmlize-buffer) 30 | :after edit-server 31 | :hook 32 | ((edit-server-start . edit-server-maybe-dehtmlize-buffer) 33 | (edit-server-done . edit-server-maybe-htmlize-buffer))) 34 | 35 | (use-package atomic-chrome 36 | :config 37 | (atomic-chrome-start-server)) 38 | 39 | (with-packages (atomic-chrome markdown-mode) 40 | :custom 41 | (atomic-chrome-default-major-mode 'markdown-mode) 42 | (atomic-chrome-buffer-open-style 'frame)) 43 | 44 | (provide 'as-server) 45 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-shell.el: -------------------------------------------------------------------------------- 1 | (autoload 'sh-ins-template "as-sh-mode-exts" 2 | "Template for new shell script texts" t) 3 | (autoload 'make-buffer-file-executable-if-script-p "as-sh-mode-exts" 4 | "Make shell scripts executable" t) 5 | (add-hook 'sh-mode-hook 'sh-ins-template) 6 | 7 | (use-package flymake-shell) 8 | 9 | ;; This can accidentally change permissions in git repos, for instance. 10 | ;;(add-hook 'after-save-hook 'make-buffer-file-executable-if-script-p) 11 | 12 | (bind-key "C-c m x" 'make-buffer-file-executable) 13 | 14 | (add-to-list 'auto-mode-alist 15 | '("/\\.zsh\\(env\\|rc\\|/functions/\\)\\|\\.stp$" . sh-mode)) 16 | 17 | ;; This doesn't work for some strange reason. 18 | (add-hook 'shell-script-mode-hook 'as-font-lock-mode-if-window-system) 19 | 20 | (add-hook 'shell-script-mode-hook (lambda () (setq comment-start "#"))) 21 | 22 | (defun sm () "Abbreviation for `sm-mode'." (interactive) (sh-mode)) 23 | 24 | (provide 'as-shell) 25 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-smart-mode-line.el: -------------------------------------------------------------------------------- 1 | (use-package smart-mode-line 2 | :config 3 | (progn 4 | (sml/setup) 5 | ;; https://github.com/Bruce-Connor/smart-mode-line/issues/51 6 | (when (version<= emacs-version "24.3") 7 | (unless (member mode-line-front-space mode-line-format) 8 | (setq-default mode-line-format (cons mode-line-front-space mode-line-format)))))) 9 | 10 | ;; Note: use rich-minority to hide minor modes 11 | 12 | (provide 'as-smart-mode-line) 13 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-source-paths.el.dis: -------------------------------------------------------------------------------- 1 | (require 'as-load-paths) 2 | 3 | (defvar find-function-source-path load-path) 4 | 5 | ;; (require 'cl) 6 | ;; (setq org-source-paths 7 | ;; (remove-if-not 8 | ;; (lambda (dir) (file-directory-p dir)) 9 | ;; (directory-files (concat as-emacs-dir "/major-modes") 'full-paths "org[-.]"))) 10 | ;; (mapc (lambda (dir) (add-to-list 'find-function-source-path dir)) 11 | ;; org-source-paths) 12 | 13 | (defvar as-source-paths 14 | '( 15 | "major-modes" 16 | "major-modes/org-mode.git/lisp" 17 | "major-modes/org-mode.git/contrib/lisp" 18 | "minor-modes" 19 | "utils" 20 | "fun")) 21 | 22 | (defun as-add-to-find-function-source-path (paths) 23 | "Adds paths to `find-function-source-path'." 24 | (dolist (x as-source-paths) 25 | (let ((path (concat as-emacs-dir "/" x))) 26 | (and (file-directory-p path) 27 | (add-to-list 'find-function-source-path path))))) 28 | 29 | (as-add-to-find-function-source-path as-source-paths) 30 | 31 | (provide 'as-source-paths) 32 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-ssh.el: -------------------------------------------------------------------------------- 1 | (defun as-read-ssh-agent-cache () 2 | (interactive) 3 | (let* ((short-hostname (car (split-string (system-name) "\\."))) 4 | (cache-file (format "/tmp/.dsa-cache-%s-%s.el" 5 | (user-real-login-name) 6 | short-hostname))) 7 | (if (not (file-exists-p cache-file)) 8 | (warn "Couldn't find %s" cache-file) 9 | (load cache-file) 10 | (message "Using ssh-agent with pid %s from %s" 11 | (getenv "SSH_AGENT_PID") 12 | cache-file)))) 13 | 14 | (as-read-ssh-agent-cache) 15 | 16 | (provide 'as-ssh) 17 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-tech-langs.el: -------------------------------------------------------------------------------- 1 | ;; Technical languages, excluding programming languages. 2 | ;; 3 | ;; See also as-doc-langs.el and as-config-langs.el, 4 | ;; and as-{ruby,javascript}.el etc. 5 | 6 | ;; feature-mode for Cucumber's feature DSL ("Gherkin") 7 | (use-package feature-mode 8 | :mode ("\\.feature\\'" . feature-mode)) 9 | 10 | (use-package yaml-mode 11 | :mode ("\\.ya?ml\\'" . yaml-mode)) 12 | 13 | (use-package json-mode 14 | ;; https://github.com/kiennq/json-mode is currently ahead of 15 | ;; the upstream https://github.com/joshwnj/json-mode, and it 16 | ;; seems the upstream may be dead: 17 | ;; https://github.com/joshwnj/json-mode/issues/64 18 | :straight (:host github :repo "kiennq/json-mode") 19 | :mode ("\\.json\\'" . json-mode)) 20 | 21 | (provide 'as-tech-langs) 22 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-templating.el: -------------------------------------------------------------------------------- 1 | (require 'as-mode-lighters) 2 | 3 | (use-package yasnippet 4 | :commands yas-minor-mode 5 | :diminish yas-minor-mode 6 | :config 7 | (defalias 'yamm 'yas-minor-mode) 8 | (defalias 'yagm 'yas-global-mode) 9 | (yas-global-mode 1)) 10 | 11 | (use-package yasnippet-snippets) 12 | 13 | (use-package yasnippet-treesitter-shim 14 | :straight (:host github :repo "fbrosda/yasnippet-treesitter-shim" 15 | :files ("snippets/*")) 16 | :no-require t 17 | :config 18 | (add-to-list 'yas-snippet-dirs 19 | (straight--build-dir "yasnippet-treesitter-shim"))) 20 | 21 | ;;{{{ _I_nsert auto-text (C-c i) 22 | 23 | (use-feature as-autotext 24 | :bind (("C-c i d" . as-insert-date-and-time) 25 | ("C-c i D" . as-insert-date-interactive) 26 | ("C-c i e" . as-insert-email-address) 27 | ("C-c i m" . as-insert-local-mode) 28 | ("C-c i w" . as-insert-work-email-address) 29 | ("C-c i W" . as-insert-name-and-work-email) 30 | ("C-c i j" . as-insert-japh-method-chain-sig) 31 | ("C-c i J" . as-insert-japh-indirect-sig) 32 | ("C-c i l" . as-insert-log-timestamp) 33 | ("C-c i L" . as-insert-log-datestamp) 34 | ("C-c i N" . as-insert-name-and-email) 35 | ("C-c i n" . as-insert-name) 36 | ("C-c i r" . as-insert-rpm-changelog-datestamp) 37 | ("C-c i s" . as-insert-scissors) 38 | ("C-c i S" . as-snip-region) 39 | ("C-c i t" . as-insert-time))) 40 | 41 | ;;}}} 42 | 43 | (provide 'as-templating) 44 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-terminals.el: -------------------------------------------------------------------------------- 1 | (use-package vterm) 2 | 3 | (use-package vterm-toggle 4 | :bind (("C-`" . vterm-toggle) 5 | ("M-`" . vterm-toggle-forward) 6 | ("M-~" . vterm-toggle-backward))) 7 | 8 | (provide 'as-terminals) 9 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-toggles.el: -------------------------------------------------------------------------------- 1 | ;; _T_oggles and settings (C-c t) 2 | 3 | (defun as-toggle-indent-tabs-mode () 4 | "Toggles the value of indent-tabs-mode in the current buffer" 5 | (interactive) 6 | (setq indent-tabs-mode (not indent-tabs-mode)) 7 | (message "indent-tabs-mode set to %s" indent-tabs-mode)) 8 | 9 | (defun as-set-tab-width (width) 10 | "Sets the tab-width variable to the given argument." 11 | (interactive "NNew hard tab width: ") 12 | (setq tab-width width)) 13 | 14 | (use-package hydra 15 | :config 16 | (defun format3 (var) (format "%3s" var)) 17 | (defhydra hydra-toggle (:color blue) 18 | " 19 | _a_ abbrev-mode: %s(format3 abbrev-mode) ^^^^^^^^^^^^^^ _d_ debug-on-error: %s(format3 debug-on-error) 20 | _f_ auto-fill-mode: %3s(if auto-fill-function \"yes\") ^^^ _S_ truncate-lines: %s(format3 truncate-lines) 21 | _o_ overwrite-mode: %3s(if overwrite-mode \"yes\") ^^^^^^^ _w_ tab-width: %s(format3 tab-width) ^^^^^^^^^^^^^^^^ 22 | _SPC_ whitespace-mode: %s(format3 whitespace-mode) ^^^^^^^^^^ _TAB_ indent-tabs-mode: %s(format3 indent-tabs-mode) 23 | " 24 | ("a" abbrev-mode nil) 25 | ("d" toggle-debug-on-error nil) 26 | ("f" auto-fill-mode nil) 27 | ("o" overwrite-mode nil) 28 | ("s" toggle-truncate-lines nil) 29 | ("S" toggle-truncate-lines nil) 30 | ("w" as-set-tab-width nil) 31 | ("TAB" as-toggle-indent-tabs-mode nil) 32 | ("SPC" whitespace-mode nil) 33 | ("q" nil "quit")) 34 | 35 | :bind ("C-c t" . hydra-toggle/body)) 36 | 37 | (provide 'as-toggles) 38 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-treemacs.el: -------------------------------------------------------------------------------- 1 | ;; I came up with a neotree config, but rejected it in favour of 2 | ;; treemacs due to lack of native projectile integration and inability 3 | ;; to only display open files. 4 | 5 | (use-package treemacs 6 | :defer t 7 | 8 | :init 9 | (with-eval-after-load 'winum 10 | (define-key winum-keymap (kbd "M-0") #'treemacs-select-window)) 11 | 12 | :config 13 | (progn 14 | ;; The default width and height of the icons is 22 pixels. If you are 15 | ;; using a Hi-DPI display, uncomment this to double the icon size. 16 | ;;(treemacs-resize-icons 44) 17 | 18 | (treemacs-follow-mode t) 19 | (treemacs-filewatch-mode t) 20 | (treemacs-fringe-indicator-mode t) 21 | (treemacs-indent-guide-mode t) 22 | (pcase (cons (not (null (executable-find "git"))) 23 | (not (null treemacs-python-executable))) 24 | (`(t . t) 25 | (treemacs-git-mode 'deferred)) 26 | (`(t . _) 27 | (treemacs-git-mode 'simple)))) 28 | :bind 29 | (:map global-map 30 | ("C-'" . treemacs) 31 | ("C-x t 1" . treemacs-delete-other-windows) 32 | ("C-x t t" . treemacs-select-window) 33 | ("C-x t B" . treemacs-bookmark) 34 | ("C-x t C-f" . treemacs-find-file) 35 | ("C-x t M-t" . treemacs-find-tag))) 36 | 37 | (use-package treemacs-projectile 38 | :after treemacs projectile) 39 | 40 | (use-package treemacs-icons-dired 41 | :after dired 42 | :config (treemacs-icons-dired-mode)) 43 | 44 | (use-package treemacs-magit 45 | :after treemacs magit) 46 | 47 | ;; treemacs-perspective if you use perspective.el vs. persp-mode 48 | ;; (use-package treemacs-persp 49 | ;; :after treemacs persp-mode ;; or perspective vs. persp-mode 50 | ;; :ensure t 51 | ;; :config (treemacs-set-scope-type 'Perspectives)) 52 | 53 | (provide 'as-treemacs) 54 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-undo-tree.el: -------------------------------------------------------------------------------- 1 | (use-package undo-tree 2 | :init 3 | (global-undo-tree-mode) 4 | 5 | :custom 6 | (undo-tree-visualizer-timestamps t) 7 | (undo-tree-enable-undo-in-region t)) 8 | 9 | (provide 'as-undo-tree) 10 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-vcs.el: -------------------------------------------------------------------------------- 1 | ;; Version control 2 | 3 | (use-feature vc-osc 4 | :straight (:local-repo "~/.GIT/adamspiers.org/vc-osc") 5 | :config 6 | (add-to-list 'vc-handled-backends 'osc 'append)) 7 | 8 | (require 'find-file-in-dir) 9 | 10 | (define-find-file-in-dir-function as-find-CVS-repo 11 | "~/.CVS/" "Find CVS repo: ") 12 | (define-find-file-in-dir-function as-find-my-git-repo 13 | "~/.GIT/adamspiers.org/" "Find adamspiers.org git repo: ") 14 | (define-find-file-in-dir-function as-find-upstream-git-repo 15 | "~/.GIT/3rd-party/" "Find 3rd-party git repo: ") 16 | 17 | ;; See as-jump.el / as-package-loading.el for explanation of usage 18 | (use-feature as-jump 19 | :after which-key 20 | 21 | :config 22 | (bind-keys :map as-jump-map 23 | ("C" "CVS repos" . as-find-CVS-repo) 24 | ("g" "my git repos" . as-find-my-git-repo) 25 | ("3" "3rd party git repos" . as-find-upstream-git-repo))) 26 | 27 | (use-package git-timemachine 28 | :commands git-timemachine) 29 | 30 | (require 'as-magit) 31 | 32 | (use-package gerrit-download) 33 | 34 | (provide 'as-vcs) 35 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-web.el: -------------------------------------------------------------------------------- 1 | ;; Pull in autoloads 2 | (require 'w3m-load "w3m-load" t) 3 | (autoload 'w3m-find-file "w3m" nil t) 4 | 5 | (eval-when-compile (require 'dired)) 6 | (add-hook 'dired-mode-hook 7 | (lambda () 8 | (define-key dired-mode-map "\C-xm" 'dired-w3m-find-file))) 9 | 10 | (autoload 'w3m-find-file "w3m") 11 | (autoload 'dired-get-filename "dired") 12 | (defun dired-w3m-find-file () 13 | (interactive) 14 | (let ((file (dired-get-filename))) 15 | (if (y-or-n-p (format "Open 'w3m' %s " (file-name-nondirectory file))) 16 | (w3m-find-file file)))) 17 | 18 | (defun mhj-w3m-browse-current-buffer () 19 | (interactive) 20 | (let ((filename (concat (make-temp-file "w3m-" nil) ".html"))) 21 | (unwind-protect 22 | (progn 23 | (write-region (point-min) (point-max) filename) 24 | (w3m-find-file filename)) 25 | (delete-file filename)))) 26 | 27 | (use-package web-mode 28 | :mode "\\.\\(phtml\\|tpl\\.php\\|jsp\\|as[cp]x\\|erb\\|mustache\\|djhtml\\|html?\\)\\'" 29 | :config 30 | (define-key web-mode-map (kbd "C-;") nil) 31 | ;; fci-mode *still* breaks web-mode :-( 32 | ;; https://github.com/alpaker/Fill-Column-Indicator/issues/46 33 | ;; (add-hook 'after-change-major-mode-hook 34 | ;; (lambda () (if (string= major-mode "web-mode") 35 | ;; (turn-off-fci-mode)))) 36 | ) 37 | 38 | (use-package gist) 39 | (use-package haml-mode 40 | :mode "\\.haml\\'") 41 | (use-package sass-mode 42 | :mode "\\.scss\\'" 43 | :hook (sass-mode . flycheck-mode)) 44 | (use-package flymake-sass) 45 | (use-package flymake-css) 46 | 47 | (provide 'as-web) 48 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-which-key.el: -------------------------------------------------------------------------------- 1 | (defvar as-which-key-no-delay-prefixes () 2 | "List of regexps matching keymap prefix bindings for which 3 | `which-key` should not delay showing the keymap's bindings.") 4 | 5 | (require 'as-mode-lighters) 6 | 7 | (use-package which-key 8 | :defer 0.1 9 | :diminish 10 | 11 | :init 12 | ;; FIXME: This one has to go before the mode is *loaded*! 13 | (setq which-key-enable-extended-define-key t) 14 | 15 | :custom 16 | 17 | ;; These have to go before the mode is activated 18 | (which-key-idle-delay 0.1) 19 | (which-key-idle-secondary-delay 0.1) 20 | (which-key-lighter "") 21 | (which-key-max-description-length nil) 22 | 23 | :config 24 | (which-key-mode) 25 | 26 | (require 's) 27 | (defun as-which-key-delay-function (prefix length) 28 | (cond ((and as-which-key-no-delay-prefixes 29 | (string-match-p 30 | (s-join "\\|" as-which-key-no-delay-prefixes) 31 | prefix)) 32 | 0) 33 | (t 1.0))) 34 | (add-to-list 'which-key-delay-functions 35 | 'as-which-key-delay-function) 36 | 37 | ;; Can't name prefix keymap - reported in: 38 | ;; 39 | ;; https://github.com/justbur/emacs-which-key/issues/253 40 | ;; 41 | ;; in which this workaround was suggested but doesn't work: 42 | ;; 43 | ;; (define-prefix-command 'as-jump-ruby) 44 | ;; (define-key as-jump-map "r" '("Ruby" . as-jump-ruby)) 45 | 46 | ;; Neither does this: 47 | ;; 48 | ;; (bind-keys :map as-jump-map ("r" "Ruby" . as-jump-ruby)) 49 | 50 | ;; So write a helper function to fix it, which effectively does 51 | ;; something like this: 52 | ;; 53 | ;; (push '((nil . "as-jump-ruby-map") . (nil . "Ruby")) which-key-replacement-alist) 54 | (defun as-which-key-add-map-title (map text) 55 | "Assign a which-key title of TEXT to the prefix map MAP, if it's 56 | not already done." 57 | (let* ((map-name (symbol-name map)) 58 | (key (cons nil map-name)) 59 | (existing (cdr (assoc key which-key-replacement-alist))) 60 | (replacement (cons nil text))) 61 | (if existing 62 | (if (not (equal existing replacement)) 63 | (warn "Tried to set %s to %s but was already %s" 64 | map-name text (cdr existing))) 65 | (push (cons key replacement) which-key-replacement-alist))))) 66 | 67 | (provide 'as-which-key) 68 | -------------------------------------------------------------------------------- /.emacs.d/init.d/as-windows.el: -------------------------------------------------------------------------------- 1 | (bind-key "C-," 'delete-other-windows) 2 | (bind-key "C-." 'delete-window) 3 | (bind-key "C-" 'other-window) 4 | (defun previous-window-interactive () 5 | "Interactive wrapper around (other-window -1) for key binding purposes." 6 | (interactive) 7 | (other-window -1)) 8 | (bind-key "C-S-" 'previous-window-interactive) 9 | (bind-key "C-S-" 'previous-window-interactive) 10 | 11 | ;; There's also ace-window but it doesn't have fancy large numbers 12 | (use-package switch-window 13 | :bind (("C-S-x o" . switch-window) 14 | ("C-S-x 1" . switch-window-then-maximize) 15 | ("C-S-x 2" . switch-window-then-split-below) 16 | ("C-S-x 3" . switch-window-then-split-right) 17 | ("C-S-x 0" . switch-window-then-delete) 18 | 19 | ("C-S-x 4 d" . switch-window-then-dired) 20 | ("C-S-x 4 f" . switch-window-then-find-file) 21 | ("C-S-x 4 m" . switch-window-then-compose-mail) 22 | ("C-S-x 4 r" . switch-window-then-find-file-read-only) 23 | 24 | ("C-S-x 4 C-f" . switch-window-then-find-file) 25 | ("C-S-x 4 C-o" . switch-window-then-display-buffer) 26 | 27 | ("C-S-x 4 0" . switch-window-then-kill-buffer)) 28 | 29 | :custom 30 | (switch-window-multiple-frames t)) 31 | 32 | ;; TODO: check out https://www.emacswiki.org/emacs/WinnerMode 33 | 34 | ;; (use-package golden-ratio) 35 | 36 | (provide 'as-windows) 37 | -------------------------------------------------------------------------------- /.emacs.d/lib/.gitignore: -------------------------------------------------------------------------------- 1 | as-loaddefs.el 2 | -------------------------------------------------------------------------------- /.emacs.d/lib/as-bounce-buffer.el: -------------------------------------------------------------------------------- 1 | (defvar as-bounce-buffer-regexp-alist '() 2 | "Controls the behaviour of `as-bounce-buffer'.") 3 | 4 | ;;;###autoload 5 | (defun as-bounce-buffer () 6 | "For each element of `as-bounce-buffer-regexp-alist', attempts a search 7 | and replace on the current buffer's filename. (The CARs are the 8 | search regexps, and the CDRs the corresponding strings to replace the 9 | matches with). As soon a search is successful, the filename resulting 10 | from the replace is visited via `find-file'." 11 | (interactive) 12 | (catch 'gotcha 13 | (mapcar 14 | (lambda (x) 15 | (let ((case-fold-search nil) 16 | (match (car x)) 17 | (replace (cdr x))) 18 | (cond 19 | ((string-match match (buffer-file-name)) 20 | (let ((bounce-to (replace-match replace t t (buffer-file-name) nil))) 21 | (message (format "Bounced to %s" bounce-to)) 22 | (find-file bounce-to)) 23 | (throw 'gotcha nil))))) 24 | as-bounce-buffer-regexp-alist))) 25 | 26 | (provide 'as-bounce-buffer) 27 | -------------------------------------------------------------------------------- /.emacs.d/lib/as-destroy-buffer.el: -------------------------------------------------------------------------------- 1 | ;;{{{ as-destroy-buffer 2 | 3 | ;;;###autoload 4 | (defun as-destroy-buffer () 5 | "Kill the current buffer without leaving crappy auto-save files around." 6 | (interactive) 7 | (let ((tmpfile (format "/tmp/.emacs.as-destroy-buffer.%d" (emacs-pid))) 8 | (buf (buffer-name))) 9 | (write-file tmpfile) 10 | (kill-buffer nil) 11 | (delete-file tmpfile) 12 | (message (concat "Destroyed buffer " buf)))) 13 | 14 | ;;}}} 15 | ;;{{{ as-destroy-buffer-delete-file 16 | 17 | ;;;###autoload 18 | (defun as-destroy-buffer-delete-file () 19 | "Kill the current buffer and delete the associated file." 20 | (interactive) 21 | (save-buffer) 22 | (let ((fn (buffer-file-name))) 23 | (delete-file fn) 24 | (kill-buffer nil) 25 | (message (format "Deleted %s" fn)))) 26 | 27 | ;;}}} 28 | 29 | (provide 'as-destroy-buffer) 30 | -------------------------------------------------------------------------------- /.emacs.d/lib/as-display-buffer-names.el: -------------------------------------------------------------------------------- 1 | ;;{{{ as-display-buffer-filename 2 | 3 | ;; (eval-when-compile 4 | ;; (autoload 'x-select-text "term/x-win" nil t)) 5 | 6 | ;;;###autoload 7 | (defun as-display-buffer-filename (&optional mode) 8 | "Displays the current buffer's filename in the minibuffer. 9 | 10 | If a prefix argument is given, stores the result in the kill ring 11 | and in the X selection for other programs. 12 | 13 | If the prefix argument is 2, forks the external program abs (must 14 | be in $PATH) to convert the filename to an absolute one with all 15 | symlinks resolved. 16 | 17 | If the prefix argument is 3 or 16, calculates the path relative to the 18 | project root." 19 | (interactive "p") 20 | (let ((file-name 21 | (cond ((eq major-mode 'Info-mode) 22 | Info-current-file) 23 | ((eq major-mode 'dired-mode) 24 | dired-directory) 25 | (buffer-file-name) 26 | (t 27 | (error "No file associated with this buffer"))))) 28 | (let ((fn (cond ((eq mode 2) 29 | (substring 30 | (shell-command-to-string (concat "abs " file-name)) 31 | 0 -1)) 32 | ((or (= mode 3) (= mode 16)) 33 | (file-relative-name file-name (projectile-project-root))) 34 | (t file-name)))) 35 | (cond (mode 36 | (kill-new fn) 37 | ;; No need for x-select-text since kill-new calls function set 38 | ;; in interprogram-cut-function, which is x-select-text anyway. 39 | ;; (x-select-text buffer-file-name) 40 | (setq fn (concat fn " (stored in kill ring and X selection)")))) 41 | (message "%s" fn)))) 42 | 43 | ;;}}} 44 | ;;{{{ as-display-buffer-name 45 | 46 | ;;;###autoload 47 | (defun as-display-buffer-name (&optional prefix) 48 | "Displays the current buffer's name in the minibuffer. 49 | 50 | If a prefix argument is given, stores the result in the kill ring 51 | and in the X selection for other programs." 52 | (interactive "P") 53 | (let ((fn (buffer-name))) 54 | (cond (prefix 55 | (kill-new fn) 56 | (setq fn (concat fn " (stored in kill ring and X selection)")))) 57 | (message "%s" fn))) 58 | 59 | ;;}}} 60 | 61 | (provide 'as-display-buffer-names) 62 | -------------------------------------------------------------------------------- /.emacs.d/lib/as-file-functions.el: -------------------------------------------------------------------------------- 1 | ;; Obsolete functions, may come in handy another time 2 | 3 | (defun as-containing-dir (filename) 4 | "Return the containing directory of a filename when given the full path." 5 | (string-match "\\([^/]+\\)/[^/]+$" filename) 6 | (match-string 1 filename)) 7 | 8 | (defun as-last-dir-and-filename (filename) 9 | "Strip a full path of all of its directory components but the last." 10 | (string-match "\\(.*/\\).+/.+$" (buffer-file-name)) 11 | (replace-match "" t t (buffer-file-name) 1)) 12 | 13 | (defun as-buffer-rename-add-one-dir () 14 | "Add the name of the containing directory of the buffer's file 15 | to the beginning of the buffer name." 16 | (interactive) 17 | (rename-buffer (as-last-dir-and-filename (buffer-name))) t) 18 | 19 | -------------------------------------------------------------------------------- /.emacs.d/lib/as-find-file-matching-regexp-hook.el: -------------------------------------------------------------------------------- 1 | (defvar as-find-file-matching-regexp-alist '() 2 | "alist mapping filename regexps to functions which will be evaluated when 3 | filenames matching the regexps are visited. 4 | 5 | This allows you to set local variables specific to sets of files, e.g. 6 | 7 | (setq as-find-file-matching-regexp-alist 8 | '((\"/foo/bar/.*\.pm\" . (lambda () (setq cperl-indent-level 2)))))") 9 | 10 | ;;;###autoload 11 | (defun as-find-file-matching-regexp-hook () 12 | "Hook to run arbitrary functions on newly visited files. 13 | 14 | Controlled by `as-find-file-matching-regexp-alist'." 15 | (mapcar 16 | (lambda (x) 17 | (cond 18 | ((let ((case-fold-search nil)) 19 | (string-match (concat ".*" (car x)) (buffer-file-name))) 20 | ;; (message (format "%s matched %s" (buffer-file-name) (car x))) 21 | (funcall (cdr x))) 22 | (t 23 | ;; (message (format "%s didn't match %s" (buffer-file-name) (car x))) 24 | ))) 25 | as-find-file-matching-regexp-alist)) 26 | 27 | (add-hook 'find-file-hooks 'as-find-file-matching-regexp-hook) 28 | 29 | (provide 'as-find-file-matching-regexp-hook) 30 | -------------------------------------------------------------------------------- /.emacs.d/lib/as-list-utils.el: -------------------------------------------------------------------------------- 1 | (defun list-has-prefix (l p) 2 | "Return t if list `l' starts with the prefix list `p'." 3 | (cond ((null p) t) 4 | ((null l) nil) 5 | ((equal (car l) (car p)) (list-has-prefix (cdr l) (cdr p))) 6 | nil)) 7 | 8 | (provide 'as-list-utils) 9 | -------------------------------------------------------------------------------- /.emacs.d/lib/as-org-agenda-lib.el: -------------------------------------------------------------------------------- 1 | ;;;###autoload 2 | (defun as-org-switch-to-agenda-buffer (&optional mode redisplay) 3 | "Switch to an existing *Org Agenda(%s)* buffer, otherwise run 4 | `org-agenda' to generate that buffer and then switch to it." 5 | (interactive) 6 | (setq mode (or mode "a")) 7 | (let ((buf (format "*Org Agenda(%s)*" mode))) 8 | (cond ((get-buffer buf) 9 | (switch-to-buffer buf)) 10 | (t 11 | (message "Loading %s..." buf) 12 | (org-agenda nil mode) 13 | (message "Loading %s...done" buf))) 14 | (when redisplay 15 | (message "Refreshing %s..." buf) 16 | (redisplay) 17 | (org-agenda-redo-all) 18 | (message "Refreshing %s...done" buf)))) 19 | 20 | ;;;###autoload 21 | (defun as-org-agenda-skip-select-category-function (category-to-select) 22 | "Creates a function suitable for use with 23 | `org-agenda-skip-function' which skips all items except for those 24 | in the provided category. 25 | 26 | From the docs for `org-agenda-skip-function', if the returned 27 | function returns nil, the current match should not be skipped. 28 | Otherwise, the function must return a position from where the 29 | search should be continued." 30 | `(lambda () 31 | (let ((cat (org-get-category))) 32 | ;;(message "Is '%s' '%s' ?" cat ,category-to-select) 33 | (if (equal cat ,category-to-select) 34 | nil ;; don't skip 35 | ;; the invisible-ok param below is crucial to avoid infinite loops 36 | (org-end-of-subtree t))))) 37 | 38 | (provide 'as-org-agenda-lib) 39 | -------------------------------------------------------------------------------- /.emacs.d/lib/as-org-stats.el: -------------------------------------------------------------------------------- 1 | ;;;###autoload 2 | (defun org-count-keywords () 3 | "Count number of occurrences of TODO keywords in the current 4 | buffer, respecting any scope restriction." 5 | (let (result) 6 | (org-map-entries 7 | (lambda () 8 | (let ((keyword (elt (org-heading-components) 2))) 9 | (if keyword 10 | (if (assoc keyword result) 11 | (setcdr (assoc keyword result) 12 | (1+ (cdr (assoc keyword result)))) 13 | (setq result (cons (cons keyword 1) result))))))) 14 | result)) 15 | 16 | ;;;###autoload 17 | (defun org-count-matches (search) 18 | "Count the number of matches from the given tag search in the 19 | current buffer, respecting any scope restriction." 20 | (interactive "sMatch: ") 21 | (length (org-map-entries t search))) 22 | 23 | ;;;###autoload 24 | (defun org-dblock-write:count (params) 25 | "Write a table showing the number of occurrences of each of the 26 | specified keywords and tag searches. Example usage: 27 | 28 | #+BEGIN:dynamic block 29 | #+BEGIN: count :keywords (\"NEXT\" \"DONE\") :searches (\"@phone\" \"@home\") 30 | | NEXT | 522 | 31 | | DONE | 69 | 32 | | @phone | 77 | 33 | | @home | 182 | 34 | #+END: 35 | " 36 | (let ((keywords (plist-get params :keywords)) 37 | (searches (plist-get params :searches)) 38 | (format "| %-10s | %3d |\n")) 39 | (insert 40 | (concat 41 | (mapconcat (lambda (keyword) 42 | (format format keyword (org-count-matches 43 | (concat "/" keyword)))) 44 | keywords "") 45 | (mapconcat (lambda (search) 46 | (format format search (org-count-matches search))) 47 | searches ""))) 48 | (backward-delete-char 1))) 49 | 50 | (provide 'as-org-stats) 51 | -------------------------------------------------------------------------------- /.emacs.d/lib/as-quelpa.el: -------------------------------------------------------------------------------- 1 | (unless (package-installed-p 'quelpa) 2 | (with-temp-buffer 3 | (url-insert-file-contents "https://raw.githubusercontent.com/quelpa/quelpa/master/quelpa.el") 4 | (eval-buffer) 5 | (quelpa-self-upgrade))) 6 | 7 | (as-progress "Setting up quelpa-use-package") 8 | (message "%s" load-path) 9 | 10 | (quelpa 11 | '(quelpa-use-package 12 | :fetcher git 13 | :url "https://framagit.org/steckerhalter/quelpa-use-package.git")) 14 | (require 'quelpa-use-package) 15 | 16 | ;; Make sure it works with use-package-always-ensure set to t (which 17 | ;; is how I generally like it). This is needed for installing stuff 18 | ;; via quelpa, otherwise it will default to searching ELPA archives. 19 | (quelpa-use-package-activate-advice) 20 | 21 | (require 'find-file-in-dir) 22 | (define-find-file-in-dir-function as-find-quelpa-package 23 | "~/.emacs.d/quelpa/build" "Find quelpa package: ") 24 | 25 | ;; See as-jump.el / as-package-loading.el for explanation of usage 26 | (use-package as-jump 27 | :ensure nil 28 | :after which-key 29 | :config 30 | (bind-keys :map as-jump-map 31 | ("q" "quelpa package" . as-find-quelpa-package))) 32 | 33 | (provide 'as-quelpa) 34 | -------------------------------------------------------------------------------- /.emacs.d/lib/as-word-motion.el: -------------------------------------------------------------------------------- 1 | ;; Word motion 2 | 3 | ;;;###autoload 4 | (defun as-forward-word-start (&optional count) 5 | "As `forward-word', but lands at the start of a word not the end." 6 | (interactive "p") 7 | (forward-word (or count 1)) 8 | (forward-word 1) 9 | (forward-word -1)) 10 | 11 | ;;;###autoload 12 | (defun as-backward-before-word (&optional count) 13 | "As `backward-word', but lands at the start of a word not the end." 14 | (interactive "p") 15 | (forward-word (- (or count 1))) 16 | (forward-word -1) 17 | (forward-word 1)) 18 | 19 | ;;;###autoload 20 | (defun as-kill-word () 21 | "Kills forward to where as-forward-word-start would land." 22 | (interactive) 23 | (kill-region (point) 24 | (save-excursion (as-forward-word-start) (point)))) 25 | 26 | ;; Sexp motion 27 | 28 | ;;;###autoload 29 | (defun as-forward-sexp-start (&optional count) 30 | "As `forward-sexp', but lands at the start of a sexp not the end." 31 | (interactive "p") 32 | (forward-sexp (or count 1)) 33 | (forward-sexp 1) 34 | (forward-sexp -1)) 35 | 36 | ;;;###autoload 37 | (defun as-backward-before-sexp (&optional count) 38 | "As `backward-sexp', but lands at the start of a sexp not the end." 39 | (interactive "p") 40 | (forward-sexp (- (or count 1))) 41 | (forward-sexp -1) 42 | (forward-sexp 1)) 43 | 44 | ;;;###autoload 45 | (defun as-kill-sexp () 46 | "Kills forward to where `as-forward-sexp-start' would land." 47 | (interactive) 48 | (kill-region (point) 49 | (save-excursion (as-forward-sexp-start) (point)))) 50 | 51 | 52 | (provide 'as-word-motion) 53 | -------------------------------------------------------------------------------- /.emacs.d/lib/bn-end-of-line-but-one.el: -------------------------------------------------------------------------------- 1 | ;;;###autoload 2 | (defun bn-end-of-line-but-one (arg) 3 | "Move point to one character before the end of current line. 4 | With argument ARG not nil or 1, move forward ARG - 1 lines first. 5 | If scan reaches end of buffer, stop there without error. 6 | If the line is empty, doesn't do anything." 7 | (interactive "*p") 8 | (end-of-line arg) 9 | (unless (bolp) 10 | (backward-char))) 11 | 12 | (provide 'bn-end-of-line-but-one) 13 | -------------------------------------------------------------------------------- /.emacs.d/lib/bn-secondary-region.el: -------------------------------------------------------------------------------- 1 | ;; Ben North's secondary selection hacks 2 | 3 | ;;;###autoload 4 | (defun bn-make-region-into-secondary (start end) 5 | "Turn the region into the secondary selection. 6 | The secondary selection is enabled if required, and set equal to 7 | the region. The region is deactivated. The buffer is not 8 | altered at all." 9 | (interactive "r") 10 | (if mouse-secondary-overlay 11 | (move-overlay mouse-secondary-overlay start end (current-buffer)) 12 | (setq mouse-secondary-overlay (make-overlay start end))) 13 | (overlay-put mouse-secondary-overlay 'face 'secondary-selection) 14 | (x-set-selection 15 | 'SECONDARY 16 | (buffer-substring (overlay-start mouse-secondary-overlay) 17 | (overlay-end mouse-secondary-overlay))) 18 | (deactivate-mark)) 19 | 20 | ;;;###autoload 21 | (defun bn-exchange-region-and-secondary (start end) 22 | "Interchange the region and the secondary selection. 23 | The results are not well-defined if the region and the 24 | secondary selection overlap." 25 | (interactive "r") 26 | (or mouse-secondary-overlay 27 | (error "The secondary selection is not active now")) 28 | (let ((sec-start (overlay-start mouse-secondary-overlay)) 29 | (sec-end (overlay-end mouse-secondary-overlay))) 30 | (transpose-regions start end sec-start sec-end) 31 | (delete-overlay mouse-secondary-overlay) 32 | (setq mouse-secondary-overlay nil))) 33 | 34 | ;;;###autoload 35 | (defun bn-keyboard-quit () 36 | "Deactivate secondary region, deactivate region, or perform quit. 37 | If the secondary region is active, then deactivate it. If not, then if 38 | the region is active, then deactivate it. If not, then do 39 | `keyboard-quit'." 40 | (interactive) 41 | (cond ((and (overlayp mouse-secondary-overlay) 42 | (overlay-buffer mouse-secondary-overlay)) 43 | (delete-overlay mouse-secondary-overlay)) 44 | ((and (boundp 'mark-active) 45 | mark-active) 46 | (deactivate-mark)) 47 | (t 48 | (keyboard-quit)))) 49 | 50 | (provide 'bn-secondary-region) 51 | -------------------------------------------------------------------------------- /.emacs.d/lib/fill-common-prefix-region.el: -------------------------------------------------------------------------------- 1 | ;; fill-common-prefix-region 2 | 3 | (autoload 'cl-flet "cl" 4 | nil ;; not interactive 5 | 'macro) 6 | 7 | ;;;###autoload 8 | (defun fill-common-prefix-region (&optional justify nosqueeze) 9 | "Call `fill-region' on the largest region surrounding the 10 | current point within which all line beginnings yield exactly the 11 | same when matched against `adaptive-fill-regexp'. 12 | 13 | A line containing nothing but the common prefix and possibly trailing 14 | whitespace is treated as a region boundary. 15 | 16 | This is particularly useful for filling subsections of 17 | paragraphs, e.g. email with different levels of nested \"> \" 18 | quoting, where by default emacs considers all the different 19 | levels as part of one big paragraph." 20 | (interactive (progn 21 | (barf-if-buffer-read-only) 22 | (list (if current-prefix-arg 'full)))) 23 | (save-excursion 24 | (beginning-of-line) 25 | (or (looking-at adaptive-fill-regexp) 26 | (error "Current line prefix does not match adaptive-fill-regexp")) 27 | (let* ((common-prefix (match-string 0)) 28 | (common-prefix-nw (concat (regexp-quote common-prefix) 29 | "[^\n]*[^[:space:]\n]"))) 30 | (cl-flet 31 | ((find-limit (result-fn buffer-limit-fn line-step) 32 | (save-excursion 33 | (let (result) 34 | ;; Keep looking while we see the same fill-prefix 35 | ;; followed by some non-whitespace. 36 | (while (and (setq result (funcall result-fn)) 37 | (not (funcall buffer-limit-fn)) 38 | (forward-line line-step) 39 | (looking-at adaptive-fill-regexp) 40 | (equal common-prefix (match-string 0)) 41 | (looking-at common-prefix-nw))) 42 | result)))) 43 | (let ((start (find-limit #'point #'bobp -1)) 44 | (end (find-limit #'line-end-position #'eobp 1))) 45 | (fill-region start end justify nosqueeze)))))) 46 | 47 | (provide 'fill-common-prefix-region) 48 | -------------------------------------------------------------------------------- /.emacs.d/lib/find-file-in-dir.el: -------------------------------------------------------------------------------- 1 | ;;; find-file-in-dir.el 2 | 3 | ;; Copyright (C) 2015 Adam Spiers 4 | 5 | ;; Author: Adam Spiers 6 | ;; Maintainer: Adam Spiers 7 | ;; Created: 3 Jan 2015 8 | ;; Package-Requires: ((counsel)) 9 | ;; Keywords: dotemacs file find speed config package 10 | ;; URL: https://github.com/aspiers/emacs 11 | 12 | (autoload 'counsel--find-file-1 "counsel") 13 | 14 | ;;;###autoload 15 | (defmacro define-find-file-in-dir-function (name dir &optional prompt) 16 | "Defines function which invokes equivalent of `counsel-find-file' 17 | from within a given directory." 18 | `(defun ,name () 19 | ,(format "Uses counsel to find a file within %s. 20 | This function was defined via `define-find-file-in-dir-function', 21 | and invokes `counsel--find-file-1'." dir) 22 | (interactive) 23 | (counsel--find-file-1 ,(or prompt "Find file: ") 24 | ,dir #'counsel-find-file-action 25 | 'counsel-find-file))) 26 | 27 | (provide 'find-file-in-dir) 28 | -------------------------------------------------------------------------------- /.emacs.d/lib/find-location-in-file.el: -------------------------------------------------------------------------------- 1 | (defun parse-file-and-location (str) 2 | "Parse a string to extract a file path and (optionally, if they are 3 | present) line and column numbers." 4 | (cond 5 | ((string-match "^\\(\\.?/.+\\) \\([0-9]+\\):\\([0-9]+\\)-\\([0-9]+\\)$" str) 6 | (list (match-string 1 str) 7 | (string-to-number (match-string 2 str)) 8 | (string-to-number (match-string 3 str)))) 9 | ((string-match "^\\(\\.?/.+\\)(\\([0-9]+\\),\\([0-9]+\\))$" str) 10 | (list (match-string 1 str) 11 | (string-to-number (match-string 2 str)) 12 | (string-to-number (match-string 3 str)))) 13 | ((string-match "^\\(\\.?/.+\\)\\+\\([0-9]+\\):\\([0-9]+\\)$" str) 14 | (list (match-string 1 str) 15 | (string-to-number (match-string 2 str)) 16 | (string-to-number (match-string 3 str)))) 17 | (t (list str)))) 18 | 19 | (defun find-location-in-file (file &optional line column) 20 | "Find a file, optionally specifying a line and even column within 21 | that file to jump to. 22 | 23 | LINE starts at 1 but COLUMN starts at 0." 24 | (find-file file) 25 | (when line (goto-line line)) 26 | (when column (forward-char column))) 27 | 28 | (defun find-file-with-location (str) 29 | "Find a file with an optional line and column location to jump to." 30 | (apply 'find-location-in-file (parse-file-and-location str))) 31 | 32 | (provide 'find-location-in-file) 33 | -------------------------------------------------------------------------------- /.emacs.d/lib/flowed-text.el: -------------------------------------------------------------------------------- 1 | (defun format-as-flowed-text () 2 | "Format the buffer as flowed text according to RFC 2646. 3 | This ensures that appropriate lines should be terminated with a 4 | single space, and that \"> \" quoting prefixes are replaced with 5 | \">\". Operates on the current region if active, otherwise on 6 | the whole buffer." 7 | (interactive) 8 | (let ((start (if (use-region-p) (copy-marker (region-beginning)) (point-min-marker))) 9 | (end (if (use-region-p) (copy-marker (region-end)) (point-max-marker)))) 10 | (save-excursion 11 | (goto-char start) 12 | ;; Ensure appropriate lines end with a space 13 | (while (re-search-forward "^\\(>+ ?\\)?\\S-.\\{10,\\}\\S-$" 14 | (marker-position end) t) 15 | (replace-match "\\& " t)) 16 | 17 | ;; Replace "> " quoting prefixes with ">" 18 | (goto-char (marker-position start)) 19 | (let ((eol) 20 | (eolm (make-marker))) 21 | (while (setq eol (re-search-forward "^>.*" end t)) 22 | (set-marker eolm eol) 23 | (goto-char (match-beginning 0)) 24 | (while (looking-at ">") 25 | (if (looking-at "> \\([^  ]\\)") 26 | (replace-match ">\\1") 27 | (forward-char))) 28 | (goto-char (marker-position eolm))))))) 29 | 30 | (provide 'flowed-text) 31 | -------------------------------------------------------------------------------- /.emacs.d/lib/org-jump-olp.el: -------------------------------------------------------------------------------- 1 | ;;; TODO: upstream this 2 | 3 | ;;;###autoload 4 | (defun org-jump-olp (file olp &optional context) 5 | "Jump to an outline path in an org file" 6 | (find-file file) 7 | (let ((m (org-find-olp (cons file olp)))) 8 | (set-buffer (marker-buffer m)) 9 | (goto-char m) 10 | (set-marker m nil)) 11 | (org-show-context (or context 'tree)) 12 | (org-show-children)) 13 | 14 | (provide 'org-jump-olp) 15 | -------------------------------------------------------------------------------- /.emacs.d/lib/org-meeting-actions.el: -------------------------------------------------------------------------------- 1 | ;;;###autoload 2 | (defun org-dblock-write:extract-actions (params) 3 | "Dynamic block writer which extracts headlines from a file and 4 | generates a table with one row per headline. 5 | 6 | The `:keyword' parameter determines the tag search to use for 7 | selecting which headlines to extract." 8 | ;; TODO: pass :delimiter param to table-row-todo-owner 9 | (insert 10 | (concat 11 | "| Owner | Action | 12 | | / | < | 13 | |- 14 | " 15 | (apply 'concat 16 | ;; need a (car ) around this next bit if I've patched 17 | ;; org-map-entries to return a list per file 18 | (org-map-entries 'org-dblock-write:table-row-todo-owner 19 | (or (plist-get params :keyword) "/ACTION") 20 | 'file))) 21 | ;; (let ((fmt (or (plist-get params :format) "%d. %m. %Y"))) 22 | ;; (insert "Last block update at: " 23 | ;; (format-time-string fmt (current-time))))) 24 | ) 25 | (backward-delete-char 1) ;; not sure where the extra \n comes from 26 | (org-table-align)) 27 | 28 | (defun org-dblock-write:table-row-todo-owner (&optional owner-delim) 29 | "Generates a row in an actions table from a single headline at 30 | point." 31 | (let ((owners (mapconcat 'identity 32 | (org-get-tags) 33 | (or owner-delim ", ")))) 34 | (if (looking-at org-complex-heading-regexp) 35 | (let ((item (match-string 4))) 36 | (concat "| " owners " | " item " |\n")) 37 | (error "Odd, '%s' didn't match '%s'" 38 | (buffer-substring (point) (+ (point) 20)) 39 | org-complex-heading-regexp)))) 40 | 41 | (provide 'org-meeting-actions) 42 | -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/ar: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: ar 3 | # key: ar 4 | # -- 5 | sub ${1:attribute} { shift->{$1} } -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/arg: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: arg 3 | # key: arg 4 | # -- 5 | my ($0) = @_; -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/carp: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: carp 3 | # key: carp 4 | # -- 5 | use Carp qw(carp cluck croak confess); 6 | -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/cd: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: cd 3 | # key: cd 4 | # -- 5 | chdir(${1:dir}) or die "chdir($1) failed: $!\n"; 6 | -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/cl: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: cl 3 | # key: cl 4 | # -- 5 | $class-> -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/class: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: class 3 | # key: class 4 | # -- 5 | my $class = shift; -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/cmeth: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: cmeth 3 | # key: cmeth 4 | # -- 5 | sub ${1:class_method} { 6 | my $class = shift; 7 | my (${2:args}) = @_; 8 | ${3:code} 9 | } 10 | -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/cmethx: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: cmethx 3 | # key: cmethx 4 | # -- 5 | =head2 ${1:methodname} 6 | 7 | ${2:docs} 8 | 9 | =cut 10 | 11 | 12 | -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/constr: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: constr 3 | # key: constr 4 | # -- 5 | =head1 CONSTRUCTORS 6 | 7 | $0 8 | 9 | =cut 10 | 11 | -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/db: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: db 3 | # key: db 4 | # -- 5 | debug(${1:1}, "${2:message}\n"); -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/debug: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: debug 3 | # key: debug 4 | # -- 5 | sub debug { 6 | my $level = shift; 7 | warn @_, "\n" if $opts{verbosity} >= $level; 8 | } 9 | -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/debugf: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: debugf 3 | # key: debugf 4 | # -- 5 | sub debugf { 6 | my $level = shift; 7 | warn sprintf @_, "\n" if $opts{verbosity} >= $level; 8 | } 9 | -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/dump: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: dump 3 | # key: dump 4 | # -- 5 | use Data::Dumper; 6 | warn Dumper($0); 7 | -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/find: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: find 3 | # key: find 4 | # -- 5 | use File::Find; 6 | 7 | find(\&${1:wanted}, ${2:dir}); 8 | 9 | sub $1 { 10 | ${3:code} 11 | if ($_ eq 'OLD') { 12 | $File::Find::prune = 1; 13 | return; 14 | } 15 | return unless /\.java$/; 16 | return unless $File::Find::name =~ m!^(?:\./)?(.+/src/(.+\.java))$!; 17 | return unless $File::Find::dir eq 'src'; 18 | } 19 | -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/for: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: for 3 | # key: for 4 | # -- 5 | for my $${1:var} (${2:list}) { 6 | ${3:...} 7 | } -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/foreach: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: foreach 3 | # key: foreach 4 | # -- 5 | foreach my $${1:var} (${2:list}) { 6 | ${3:...} 7 | } -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/getopts: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: getopts 3 | # key: getopts 4 | # -- 5 | use Getopt::Long; 6 | 7 | Getopt::Long::Configure('bundling'); 8 | 9 | my %opts = ( verbosity => 1 ); 10 | GetOptions( 11 | \%opts, 12 | 'help|h', 13 | 'debug|d', 14 | 'verbosity|verbose|v:+', 15 | 'version|V', 16 | $0${1:options} 17 | ) or usage(); 18 | usage() if @ARGV == 0 or $opts{help}; 19 | -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/h1: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: h1 3 | # key: h1 4 | # -- 5 | =head1 ${1:heading} 6 | 7 | ${2:text} 8 | 9 | =cut 10 | 11 | -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/h2: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: h2 3 | # key: h2 4 | # -- 5 | =head2 ${1:heading} 6 | 7 | ${2:text} 8 | 9 | =cut 10 | 11 | -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/hb: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: hb 3 | # key: hb 4 | # -- 5 | #!/usr/bin/perl 6 | 7 | use strict; 8 | use warnings; 9 | 10 | -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/la: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: la 3 | # key: la 4 | # -- 5 | my $${1:var} = $self->$1; 6 | -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/main: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: main 3 | # key: main 4 | # -- 5 | #!/usr/bin/perl -w 6 | 7 | use strict; 8 | 9 | my $numargs = $#ARGV + 1; 10 | //my $filename = $ARGV[0]; 11 | 12 | # error checking argument 13 | if ($numargs != 1) { 14 | printf("Usage: %s \n", $0); 15 | exit(1); 16 | } 17 | -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/md: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: md 3 | # key: md 4 | # -- 5 | mkdir(${1:dir}) or die "mkdir($1) failed: $!\n"; 6 | -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/me: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: me 3 | # key: me 4 | # -- 5 | (my $ME = $0) =~ s,.*/,,; 6 | -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/meth: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: meth 3 | # key: meth 4 | # -- 5 | sub ${1:method} { 6 | my $self = shift; 7 | my (${2:args}) = @_; 8 | ${3:code} 9 | } 10 | -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/methx: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: methx 3 | # key: methx 4 | # -- 5 | =head2 ${1:methodname} 6 | 7 | ${2:docs} 8 | 9 | =cut 10 | 11 | sub $1 { 12 | my $self = shift; 13 | my (${3:args}) = @_; 14 | ${4:code} 15 | } 16 | -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/new: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: new 3 | # key: new 4 | # -- 5 | sub new { 6 | my $self = shift; 7 | my $class = ref($self) || $self; 8 | my (${1:args}) = @_; 9 | 10 | ${2:code} 11 | 12 | my $new = bless { 13 | }, $class; 14 | 15 | return $new; 16 | } 17 | -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/od: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: od 3 | # key: od 4 | # -- 5 | or die "${1:text} failed: $!\n"; -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/open: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: open 3 | # key: open 4 | # -- 5 | open($0${1:FH}, ${2:file}) 6 | or die "Couldn't open($2): $!\n"; 7 | while (<$1>) { 8 | ${3:...;}$0 9 | } 10 | close($1); -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/opendir: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: opendir 3 | # key: opendir 4 | # -- 5 | opendir(${1:DIR}, ${2:directory}) 6 | or die "opendir($2) failed: $!\n"; -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/openfrom: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: openfrom 3 | # key: openfrom 4 | # -- 5 | open($0${1:FH}, "${2:cmd}|") 6 | or die "Couldn't open($2|): $!\n"; 7 | while (<$1>) { 8 | $>${3:...}; 9 | } 10 | ${4:...;}$0 11 | close($1) 12 | or die "close($2|) failed: $!\n"; -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/opento: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: opento 3 | # key: opento 4 | # -- 5 | open($0${1:FH}, "| ${2:cmd}") 6 | or die "Couldn't open(| $2): $!\n"; 7 | print $1 ${3:...}; 8 | ${4:...;}$0 9 | close($1) 10 | or die "close(| $2) failed: $!\n"; -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/opentox: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: opentox 3 | # key: opentox 4 | # -- 5 | open($0${1:FH}, "|-", ${2:cmd}, ${3:args}) 6 | or die "Couldn't open(| $2): $!\n"; 7 | print $1 ${4:...}; 8 | ${5:...;}$0 9 | close($1) 10 | or die "close(| $2) failed: $!\n"; 11 | -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/openw: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: openw 3 | # key: openw 4 | # -- 5 | open($0${1:FH}, ">${2:file}") 6 | or die "Couldn't open(>$2): $!\n"; 7 | print $1 ${3:...}$0; 8 | close($1); -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/openwh: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: openwh 3 | # key: openwh 4 | # -- 5 | open($0${1:FH}, ${2:file}) 6 | or die "Couldn't open($2): $!\n"; 7 | while (<$1>) { 8 | ${3:...;}$0 9 | } 10 | close($1); -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/over: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: over 3 | # key: over 4 | # -- 5 | =over 4 6 | 7 | =item * ${1:item} 8 | 9 | ${2:contents} 10 | 11 | =back 12 | 13 | -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/p: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: p 3 | # key: p 4 | # -- 5 | print "${1:OUTPUT}\n"; 6 | -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/pf: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: pf 3 | # key: pf 4 | # -- 5 | printf("$0"); -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/pkg: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: pkg 3 | # key: pkg 4 | # -- 5 | package ${1:Package}; 6 | 7 | =head1 NAME 8 | 9 | $1 - ${2:name} 10 | 11 | =head1 SYNOPSIS 12 | 13 | ${3:synopsis} 14 | 15 | =head1 DESCRIPTION 16 | 17 | ${4:description} 18 | 19 | =cut 20 | 21 | use strict; 22 | use warnings; 23 | 24 | ${5:code} 25 | 26 | =head1 BUGS 27 | 28 | =head1 SEE ALSO 29 | 30 | =cut 31 | 32 | 1; 33 | -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/psub: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: psub 3 | # key: psub 4 | # -- 5 | =head2 ${1:subrname} 6 | 7 | ${2:docs} 8 | 9 | =cut 10 | 11 | sub $1 { 12 | my (${3:args}) = @_; 13 | ${4:code}$0 14 | } 15 | -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/self: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: self 3 | # key: self 4 | # -- 5 | my $self = shift; -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/sf: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: sf 3 | # key: sf 4 | # -- 5 | $self-> -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/sub: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: sub 3 | # key: sub 4 | # -- 5 | sub ${1:subrname} { 6 | my (${2:args}) = @_; 7 | ${3:code} 8 | } 9 | -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/test: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: test 3 | # key: test 4 | # -- 5 | =over 4 6 | 7 | =item * $0 8 | 9 | =back 10 | 11 | -------------------------------------------------------------------------------- /.emacs.d/snippets/perl-mode/usage: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: usage 3 | # key: usage 4 | # -- 5 | sub usage { 6 | warn @_, "\n" if @_; 7 | 8 | (my $ME = $0) =~ s,.*/,,; 9 | 10 | die <&2 16 | Usage: $me ${1:[options]} ${2:ARGS} 17 | Options: 18 | -h, --help Show this help and exit 19 | -v, --version Output version information and exit 20 | ${3:options} 21 | EOF 22 | 23 | if [ -n "\$1" ]; then 24 | echo >&2 25 | echo >&2 "$*" 26 | fi 27 | 28 | exit "$exit_code" 29 | } 30 | 31 | main () { 32 | if [ "\$1" == '-h' ] || [ "\$1" == '--help' ]; then 33 | usage 0 34 | fi 35 | # or use getopts 36 | } 37 | -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/file tests/de: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: de 3 | # key: de 4 | # -- 5 | [ -d "${1:dirname}" ] -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/file tests/fe: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: fe 3 | # key: fe 4 | # -- 5 | [ -e "${1:filename}" ] -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/file tests/fr: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: fr 3 | # key: fr 4 | # -- 5 | [ -r "${1:filename}" ] -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/file tests/fx: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: fx 3 | # key: fx 4 | # -- 5 | [ -x "${1:filename}" ] -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/flow control/else: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: else 3 | # key: el 4 | # -- 5 | else$> 6 | -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/flow control/elseif: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: elseif 3 | # key: eli 4 | # -- 5 | elif ${1:expression}; then 6 | $0 -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/flow control/for: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: for 3 | # key: for 4 | # -- 5 | for ${1:var} in ${2:range}; do 6 | ${3:action} 7 | done -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/flow control/if: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: if 3 | # key: if 4 | # -- 5 | if ${1:expression}; then 6 | $0 7 | fi -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/flow control/ifdie: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: ifdie 3 | # key: ifd 4 | # -- 5 | if ${1:expression}; then 6 | echo >&2 "${2:ERROR}" 7 | exit 1 8 | fi -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/flow control/while: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: while 3 | # key: wh 4 | # -- 5 | while ${1:true}; do 6 | $0 7 | done -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/func: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: func 3 | # key: func 4 | # -- 5 | function ${1:name} { 6 | $0 7 | } 8 | -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/hb: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: hb 3 | # key: hb 4 | # -- 5 | #!/bin/sh 6 | 7 | -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/hbb: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: hbb 3 | # key: hbb 4 | # -- 5 | #!/bin/bash 6 | 7 | -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/logging/abort: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: abort 3 | # key: ab 4 | # -- 5 | abort () { 6 | die "$*; aborting." 7 | } 8 | -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/logging/clog: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: clog 3 | # key: clog 4 | # -- 5 | _color_log () { color="\$1"; shift; tput setaf "$color"; echo "$*"; tput sgr0; } 6 | _bold_color_log () { tput bold; _color_log "$@"; } 7 | _log () { echo "\`date\` $*" >>& "$LOGFILE"; } 8 | 9 | progress () { _bold_color_log 2 "$@" ; } 10 | warn () { _bold_color_log 3 "$@" >&2; } 11 | error () { _bold_color_log 1 "$@" >&2; } 12 | fatal () { error "$@"; exit 1; } 13 | -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/logging/die: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: die 3 | # key: die 4 | # -- 5 | die () { 6 | echo >&2 "$*" 7 | exit 1 8 | } 9 | -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/logging/dlog: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: dlog 3 | # key: dlog 4 | # -- 5 | _dlog () { echo "\`date\` $*" >> "$LOGFILE" 2>&1; } 6 | debug () { _dlog "$*"; } 7 | progress () { _dlog "$*"; echo "$me: $*"; } 8 | warn () { _dlog "$*"; echo >&2 "$me: $*"; } 9 | error () { _dlog "ERROR: $*"; echo >&2 "$me: ERROR: $*"; } 10 | fatal () { _dlog "FATAL: $*"; echo >&2 "$me: FATAL: $*"; exit 1; } 11 | -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/logging/err: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: err 3 | # key: err 4 | # -- 5 | echo >&2 "ERROR: " 6 | exit 1 7 | -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/logging/log: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: log 3 | # key: log 4 | # -- 5 | _log () { echo "$*"; } 6 | 7 | progress () { _log "$@" ; } 8 | warn () { _log "$@" >&2; } 9 | error () { _log "$@" >&2; } 10 | fatal () { error "$@"; exit 1; } 11 | -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/logging/warn: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: warn 3 | # key: warn 4 | # -- 5 | echo >&2 "${1:WARNING}" 6 | -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/numeric comparisons/neq: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: neq 3 | # key: neq 4 | # -- 5 | [ ${1:s1} -eq ${2:s2} ] -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/numeric comparisons/nge: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: nge 3 | # key: nge 4 | # -- 5 | [ ${1:s1} -ge ${2:s2} ] -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/numeric comparisons/ngex: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: ngex 3 | # key: ngex 4 | # -- 5 | [[ ${1:s1} -ge ${2:s2} ]] -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/numeric comparisons/ngt: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: ngt 3 | # key: ngt 4 | # -- 5 | [ ${1:s1} -gt ${2:s2} ] -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/numeric comparisons/ngtx: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: ngtx 3 | # key: ngtx 4 | # -- 5 | [[ ${1:s1} -gt ${2:s2} ]] -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/numeric comparisons/nle: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: nle 3 | # key: nle 4 | # -- 5 | [ ${1:s1} -le ${2:s2} ] -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/numeric comparisons/nlex: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: nlex 3 | # key: nlex 4 | # -- 5 | [[ ${1:s1} -le ${2:s2} ]] -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/numeric comparisons/nlt: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: nlt 3 | # key: nlt 4 | # -- 5 | [ ${1:s1} -lt ${2:s2} ] -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/numeric comparisons/nltx: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: nltx 3 | # key: nltx 4 | # -- 5 | [[ ${1:s1} -lt ${2:s2} ]] -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/numeric comparisons/nne: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: nne 3 | # key: nne 4 | # -- 5 | [ ${1:s1} -ne ${2:s2} ] -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/permissions/nroot: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: nroot 3 | # key: nroot 4 | # -- 5 | if [ "$USER" == root ]; then 6 | echo >&2 "Must not be root" 7 | exit 1 8 | fi 9 | -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/permissions/root: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: root 3 | # key: root 4 | # -- 5 | if [ "$USER" != root ]; then 6 | echo >&2 "Must be root" 7 | exit 1 8 | fi 9 | -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/processes/gunzip: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: gunzip 3 | # key: gunzip 4 | # -- 5 | gunzip -qc ${1:filename} | tar xvf - 6 | -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/processes/qr: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: qr 3 | # key: qr 4 | # -- 5 | if ! out=$(${1:cmd} 2>&1); then 6 | echo "$out" 7 | fi 8 | -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/processes/sr: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: safe_run 3 | # key: sr 4 | # -- 5 | safe_run () { 6 | if ! "$@"; then 7 | fatal "$* failed! Aborting." >&2 8 | exit 1 9 | fi 10 | } 11 | -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/script context/here: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: here 3 | # key: here 4 | # -- 5 | here=$(dirname \$0) 6 | -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/script context/me: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: me 3 | # key: me 4 | # -- 5 | me=$(basename \$0) 6 | -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/string tests/se: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: se 3 | # key: se 4 | # -- 5 | [ ${1:s1} = ${2:s2} ] -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/string tests/sex: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: sex 3 | # key: sex 4 | # -- 5 | [[ ${1:s1} == ${2:s2} ]] -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/string tests/sn: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: sn 3 | # key: sn 4 | # -- 5 | [ -n "$${1:var}" ] -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/string tests/sne: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: sne 3 | # key: sne 4 | # -- 5 | [ ${1:s1} != ${2:s2} ] -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/string tests/snex: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: snex 3 | # key: snex 4 | # -- 5 | [[ ${1:s1} != ${2:s2} ]] -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/string tests/sz: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: sz 3 | # key: sz 4 | # -- 5 | [ -z "$${1:var}" ] -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/tmp: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: tmp 3 | # key: tmp 4 | # -- 5 | if ! tmpfile=\`mktemp ${1:path}/$me.tmp.XXXXXXXX\`; then 6 | echo "mktemp failed: $!" 7 | exit 1 8 | fi 9 | -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/tmpd: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: tmpd 3 | # key: tmpd 4 | # -- 5 | if ! tmpdir=\`mktemp -d ${1:path}/$me.tmp.XXXXXXXX\`; then 6 | echo "mktemp failed: $!" 7 | exit 1 8 | fi 9 | -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/variables/passthru: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: passthru 3 | # key: passthru 4 | # -- 5 | ${1+"$@"} -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/variables/v: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: v 3 | # key: v 4 | # -- 5 | "$${1:varname}" -------------------------------------------------------------------------------- /.emacs.d/snippets/sh-mode/variables/vx: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: vx 3 | # key: vx 4 | # -- 5 | "\${${1:varname}}" -------------------------------------------------------------------------------- /.emacs.d/test/debug-init.el: -------------------------------------------------------------------------------- 1 | ;; Usage: emacs -Q -l ~/.emacs.d/test/debug-init.el 2 | ;; 3 | ;; in preference to emacs --debug-init 4 | 5 | (setq debug-on-error t) 6 | (setq truncate-lines nil) 7 | (require 'edebug) 8 | (switch-to-buffer "*Messages*") 9 | (setq truncate-lines nil) 10 | 11 | -------------------------------------------------------------------------------- /.emacs.d/test/key-chord-which-key.el: -------------------------------------------------------------------------------- 1 | (package-initialize) 2 | 3 | (package-install 'bundler) 4 | 5 | (package-install 'key-chord) 6 | (key-chord-mode 1) 7 | 8 | (setq which-key-enable-extended-define-key t) 9 | (package-install 'which-key) 10 | (which-key-mode) 11 | 12 | (defvar as-jump-map (make-sparse-keymap "Jump to stuff")) 13 | (global-set-key (kbd "C-c j") as-jump-map) 14 | (key-chord-define-global "zj" as-jump-map) 15 | (key-chord-define-global "zr" 'dired) 16 | 17 | (defvar as-jump-ruby-map (make-sparse-keymap "Jump to Ruby") 18 | "Adam's prefix keymap for quickly jumping to Ruby stuff") 19 | (define-key as-jump-map "r" as-jump-ruby-map) 20 | (define-key as-jump-ruby-map "g" 'bundle-open) 21 | -------------------------------------------------------------------------------- /.emacs.d/test/package-autoloads.el: -------------------------------------------------------------------------------- 1 | ;; This minimal test case shows how (package-initialize) sets up 2 | ;; autoloads for all installed packages without further effort. 3 | ;; 4 | ;; Usage: 5 | ;; emacs -Q --debug-init -l ~/.emacs.d/test/package-autoloads.el 6 | 7 | (package-initialize) 8 | 9 | ;; (require 'use-package) 10 | ;; (setq use-package-verbose 'debug) 11 | 12 | (add-to-list 'load-path "/home/adam/.emacs.d/lib") 13 | (add-to-list 'load-path "/home/adam/.emacs.d/init.d") 14 | 15 | ;; This is only needed to ensure it's installed: 16 | ;; 17 | ;; (use-package helm-org 18 | ;; :defer t :ensure t) 19 | 20 | (message "helm-org loaded: %s" (featurep 'helm-org)) 21 | (message "helm-org-parent-headings autoloaded: %s" 22 | (autoloadp (symbol-function 'helm-org-parent-headings))) 23 | (describe-function 'helm-org-parent-headings) 24 | (switch-to-buffer "*Messages*") 25 | -------------------------------------------------------------------------------- /.emacs.d/test/which-key.el: -------------------------------------------------------------------------------- 1 | ;; This minimal test case shows how (package-initialize) sets up 2 | ;; autoloads for all installed packages without further effort. 3 | ;; 4 | ;; Usage: 5 | ;; emacs -Q --debug-init -l ~/.emacs.d/test/package-autoloads.el 6 | 7 | (package-initialize) 8 | 9 | 10 | ;; (require 'use-package) 11 | ;; (setq use-package-verbose 'debug) 12 | 13 | (add-to-list 'load-path "/home/adam/.emacs.d/lib") 14 | (add-to-list 'load-path "/home/adam/.emacs.d/init.d") 15 | 16 | (setq which-key-enable-extended-define-key t) 17 | (require 'which-key) 18 | (setq which-key-idle-delay 0.1) 19 | (setq which-key-idle-secondary-delay 0.1) 20 | ;; FIXME: This one doesn't work >-( 21 | (setq which-key-lighter "") 22 | 23 | (defvar as-jump-map (make-sparse-keymap "Jump to")) 24 | (message "l %s" (featurep 'which-key)) 25 | (define-key as-jump-map "M" 26 | '("Switch to *Messages*" . switch-to-messages-buffer)) 27 | (bind-key "C-c j" as-jump-map) 28 | 29 | (which-key-mode) 30 | (switch-to-buffer "*Messages*") 31 | (describe-function 'define-key) 32 | -------------------------------------------------------------------------------- /.kde/share/kde4/services/org.protocol: -------------------------------------------------------------------------------- 1 | # -*- conf -*- 2 | [Protocol] 3 | protocol=org-protocol 4 | exec=/usr/bin/emacsclient '%u' 5 | input=none 6 | output=none 7 | helper=true 8 | listing= 9 | reading=false 10 | writing=false 11 | makedir=false 12 | deleting=false 13 | Icon=emacs 14 | Description=A protocol for org-mode 15 | -------------------------------------------------------------------------------- /.local/share/applications/quick-emacs.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=Quick Emacs 3 | Exec=quick-emacs --bg-if-poss %u 4 | Icon=emacs-icon 5 | Type=Application 6 | Terminal=false 7 | MimeType=x-scheme-handler/org-protocol; 8 | -------------------------------------------------------------------------------- /.netrc.d/.dir-locals.el: -------------------------------------------------------------------------------- 1 | (((t 2 | . ((t 3 | . ((eval . (authinfo-mode t)))))))) 4 | -------------------------------------------------------------------------------- /.shared_env.d/person-adam.spiers/emacs: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ED=$ZDOTDIR/.emacs.d 4 | EID=$ZDOTDIR/.emacs.d/init.d 5 | ELPA=$ZDOTDIR/.emacs.d/elpa 6 | ES=$ZDOTDIR/.emacs.d/straight 7 | ESR=$ES/repos 8 | ESB=$ES/build 9 | LE=$ZDOTDIR/lib/emacs 10 | LEI=$LE/init 11 | LEC=$LEI/common 12 | LEU=$LE/utils 13 | MAJ=$LE/major-modes 14 | ORG=$MAJ/org-mode.git 15 | MIN=$LE/minor-modes 16 | -------------------------------------------------------------------------------- /.sig/Oxford/Quake: -------------------------------------------------------------------------------- 1 | -- 2 | Adze /adz/ {/n./} 1. A cutting tool, formed with an arching blade set at 3 | right angles to the handle; 2. Quake handle for adam.spiers@new.ox.ac.uk: 4 | member of QPD and ClanUK squad, Vindaloo servers and #quake.uk admin, LPB 5 | doing IT Support at Oxford University --> SuperJANET access ............. 6 | -------------------------------------------------------------------------------- /.sig/Oxford/job: -------------------------------------------------------------------------------- 1 | -- 2 | Adam Spiers, IT Support Team, New College, Oxford University. 3 | * e-mail IT related queries to: it-support@new.ox.ac.uk 4 | -------------------------------------------------------------------------------- /.sig/Oxford/job_with_disclaimer: -------------------------------------------------------------------------------- 1 | -- 2 | Adam Spiers, IT Support Team, New College, Oxford University, UK. 3 | * e-mail: adam.spiers@new.ox.ac.uk | #include 4 | -------------------------------------------------------------------------------- /.sig/Oxford/normal: -------------------------------------------------------------------------------- 1 | -- 2 | Adam Spiers, Computing Officer, New College, Oxford University. 3 | * e-mail to: adam.spiers@new.ox.ac.uk 4 | -------------------------------------------------------------------------------- /.sig/RAM/RTFM: -------------------------------------------------------------------------------- 1 | -- 2 | "The RTFM concept should be rammed down every child's throat at birth." -- me 3 | 4 | Adam Spiers -=- music student @ RAM.ac.uk -=- part-time Perl/Linux hacker 5 | e-mail: adam@spiers.net PGP & WWW: http://www.new.ox.ac.uk/~adam/ 6 | -------------------------------------------------------------------------------- /.sig/RAM/adam@spiers.net-large: -------------------------------------------------------------------------------- 1 | -- 2 | . __ , 3 | _. _| _.._ _ /(]| __._ * _ ._. __ ._ _ -+- music student @ RAM.ac.uk 4 | (_](_](_][ | )\__/ _) [_)|(/,[ _) * [ )(/, | part-time Perl/Linux hacker 5 | | http://www.new.ox.ac.uk/~adam/ 6 | -------------------------------------------------------------------------------- /.sig/RAM/simple: -------------------------------------------------------------------------------- 1 | -- 2 | Adam Spiers -=- music student @ RAM.ac.uk -=- part-time Perl/Linux hacker 3 | e-mail: adam@spiers.net PGP & WWW: http://www.new.ox.ac.uk/~adam/ 4 | -------------------------------------------------------------------------------- /.sig/perl/Oxford_e-mail: -------------------------------------------------------------------------------- 1 | -- 2 | /- Adam Spiers, Computing Officer, New College, Oxford University, UK -/, 3 | #!perl -l .sig 'cello, jazz, cycling, juggling, Linux, security, anti-M$ 4 | open$[;$;=q,,,$-++?$?:($#=lc<0>),$==$=>>++$*,$- ++, map {($k=ord)-=$=+$*, 5 | $c=($k &$-+$*)<<$*,$k>>=$-;$;.=($#=~m[^.{$k}(.{$c})])[$[],$#=$'}(split// 6 | =>(q,.";7=/43+':,)[$===$[]);;s;;$\;;, y$k, /u-$c@.kau$&&s&||/ \&&print&e; 7 | -------------------------------------------------------------------------------- /.sig/perl/japh_5.004_only: -------------------------------------------------------------------------------- 1 | -- 2 | perl -le '@^M=map(ord()-($=>>1)=>split//,qq/\$!4 1"*!\47!1!/);*$=\q/(.*)/;sub _ 3 | {$^M.=($_[0]=~/.{$^M[$.++]}(.{$^M[$.++]})/ )[0]}$SIG{__WARN__}=$SIG{__DIE__}=*_ 4 | ,map eval()=>split m) ),q,goto delete(42) /?/ :: goto eval"}";die$@,;$_=$^M,$,= 5 | chr(--($==$=+($=>>$^F))),y, \166,,,s$\$\$(r )\$\$$\$,\$1\$2\u\$^X\$3\$2$;print' 6 | -------------------------------------------------------------------------------- /.sig/perl/japh_indirect: -------------------------------------------------------------------------------- 1 | -- 2 | Adam Spiers -=- musician & hacker -=- adam@spiers.net -=- http://tigerpig.org/ 3 | echo '$_=bless[q]]],q;_;;sub s;{local$_=shift;push@$_,++$0,pop(@$_).$s;;$_}($, 4 | =eval((join"\$_->[",qw)Just Another Perl Hacker)).q)$_->[1]]]])))=~s~((?<=.(?{ 5 | ++$*})))?_::~$*&&$"~egx,print""=>""=>'|perl -ln0e';s;s\;;_::AUTOLOAD$1;g;eval' 6 | -------------------------------------------------------------------------------- /.sig/perl/japh_method_chain: -------------------------------------------------------------------------------- 1 | -- 2 | ## Adam Spiers ## musician & hacker ## me@adamspiers.org ## http://tigerpig.org 3 | $@=>$_=q^*{$Just =bless{},'$another ';"\$Perl \::$hacker,"}=sub{print$%[$.++];$ 4 | },eval join+v45.62,(q)$q ))x v54^,s.(?<=\$)\w*[\s,].f if+push@%,$&.sixmegs,eval 5 | -------------------------------------------------------------------------------- /.stow-local-ignore: -------------------------------------------------------------------------------- 1 | \.git 2 | \.gitignore 3 | .*,v 4 | .*~ 5 | \.\#.* 6 | \#.*\# 7 | .*\.orig 8 | .*\.old 9 | .*\.rej 10 | .*\.bak 11 | .*\.o 12 | .*\.elc 13 | .*\.pyc 14 | .*\.class 15 | \.pcl-cvs-cache 16 | \.emacs\.desktop 17 | \.emacs\.backup 18 | TODO.org 19 | README.md 20 | -------------------------------------------------------------------------------- /.zsh/functions/_emk: -------------------------------------------------------------------------------- 1 | #compdef emk 2 | 3 | cd $zdotdir/lib/emacs 4 | _make "$@" 5 | cd - >&/dev/null 6 | 7 | -------------------------------------------------------------------------------- /TODO.org: -------------------------------------------------------------------------------- 1 | * STARTED lazy-load everything which doesn't need to be loaded 2 | * move Makefile to ~/.emacs.d 3 | * byte-compile .emacs.d/init.d/*.el 4 | * publish .emacs.d/lib/*.el as public packages 5 | * optimise for batch runs, using =noninteractive= test 6 | *** https://github.com/jwiegley/use-package/issues/416 7 | -------------------------------------------------------------------------------- /bin/e: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #new-emacs "$@" &! 4 | 5 | quick-emacs --bg-if-poss -c "$@" 6 | -------------------------------------------------------------------------------- /bin/ediff: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | me=`basename $0` 4 | 5 | usage () { 6 | if [ -n "$1" ]; then 7 | echo "$*" >&2 8 | echo 9 | fi 10 | 11 | cat <&2 12 | Usage: $me FILE1 FILE2 13 | EOF 14 | exit 1 15 | } 16 | 17 | if [ "$1" == '-h' ] || [ "$1" == '--help' ] || [ $# -ne 2 ]; then 18 | usage 19 | fi 20 | 21 | quick-emacs --eval "(ediff-files \"$1\" \"$2\")" 22 | -------------------------------------------------------------------------------- /bin/edirs: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | me=`basename $0` 4 | 5 | usage () { 6 | if [ -n "$1" ]; then 7 | echo "$*" >&2 8 | echo 9 | fi 10 | 11 | cat <&2 12 | Usage: $me DIR1 DIR2 [REGEXP] 13 | EOF 14 | exit 1 15 | } 16 | 17 | if [ "$1" == '-h' ] || [ "$1" == '--help' ] || [ $# -lt 2 ] || [ $# -gt 3 ]; then 18 | usage 19 | fi 20 | 21 | if [ -n "$3" ]; then 22 | regexp="\"$3\"" 23 | else 24 | regexp=nil 25 | fi 26 | 27 | quick-emacs -e "(ediff-directories \"$1\" \"$2\" $regexp)" 28 | -------------------------------------------------------------------------------- /bin/ef: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | create_frame= 4 | while [ $# != 0 ]; do 5 | case "$1" in 6 | -c|--create-frame) 7 | create_frame=$1 8 | shift 9 | ;; 10 | *) 11 | break 12 | ;; 13 | esac 14 | done 15 | 16 | if [ $# = 0 ]; then 17 | set -- . 18 | fi 19 | 20 | here=$(pwd) 21 | 22 | for file in "$@"; do 23 | if [[ $file =~ ^\.\.?/ ]]; then 24 | file="$here/$file" 25 | fi 26 | 27 | quick-emacs \ 28 | --bg-if-poss $create_frame \ 29 | --eval "(find-file-with-location \"$file\")" 30 | done 31 | -------------------------------------------------------------------------------- /bin/efg: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Emacs Find Grep 4 | 5 | usage () { 6 | # Call as: usage [EXITCODE] [USAGE MESSAGE] 7 | exit_code=1 8 | if [[ "$1" == [0-9] ]]; then 9 | exit_code="$1" 10 | shift 11 | fi 12 | if [ -n "$1" ]; then 13 | echo >&2 "$*" 14 | echo 15 | fi 16 | 17 | me=`basename $0` 18 | 19 | cat <&2 20 | Usage: $me [-c] GREP-ARGS ... 21 | Options: 22 | -h, --help Show this help and exit 23 | -c, --create-frame Open in a new emacs frame 24 | options 25 | EOF 26 | exit "$exit_code" 27 | } 28 | 29 | create_frame= 30 | while [ $# != 0 ]; do 31 | case "$1" in 32 | -h|--help) 33 | usage 0 34 | ;; 35 | -c|--create-frame) 36 | create_frame=$1 37 | shift 38 | ;; 39 | *) 40 | break 41 | ;; 42 | esac 43 | done 44 | 45 | args=() 46 | for arg in "$@"; do 47 | #echo "processing arg [$arg]" 48 | case "$arg" in 49 | *\'*) 50 | arg="${arg//\\/\\\\}" 51 | # bash doesn't allow interpolation of single quotes 52 | # inside single quotes, so we have to close the single 53 | # quoting, add a raw single quote, and then re-open 54 | # the single quoting. And bash's ${foo//PAT/REPL} 55 | # requires single quotes to be escaped in PAT and REPL. 56 | arg="'${arg//\'/\'\\\'\'}'" 57 | ;; 58 | *\ *|*\"*|*\\*) 59 | arg="${arg//\\/\\\\}" 60 | arg="'$arg'" 61 | ;; 62 | esac 63 | #echo "adding arg [$arg]" 64 | args+=("$arg") 65 | done 66 | 67 | # emacs' grep-find will run this inside: bash -c "..." 68 | cmd="find . -type f -print0 | xargs -0 grep -nH -E ${args[*]}" 69 | 70 | # Quote the double-quotes and wrap in double quotes to allow 71 | # interpolation by emacs: 72 | elisp="(grep-find \"${cmd//\"/\\\"}\")" 73 | 74 | quick-emacs --bg-if-poss $create_frame --eval "$elisp" 75 | -------------------------------------------------------------------------------- /bin/emacs-window-id: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | LOGFILE=$HOME/.log/emacs-window-id.log 4 | me=`basename $0` 5 | 6 | _dlog () { echo "`date` $*" >> "$LOGFILE" 2>&1; } 7 | debug () { _dlog "$*"; } 8 | fatal () { _dlog "FATAL: $*"; echo >&2 "$me: FATAL: $*"; exit 1; } 9 | 10 | check_prereqs () { 11 | if [ -z "$DISPLAY" ]; then 12 | fatal "DISPLAY environment variable was not set" 13 | fi 14 | 15 | if ! which wmctrl >/dev/null 2>&1; then 16 | fatal "wmctrl not found; aborting." 17 | fi 18 | } 19 | 20 | emacs_window_ids=( $(wmctrl -lpx | awk '$4 ~ /emacs/ && $5 ~ /'"$host"'/ { print $1 }') ) 21 | debug "emacs_window_ids ${emacs_window_ids[@]}" 22 | 23 | if [ "${#emacs_window_ids[*]}" -eq 1 ]; then 24 | echo "${emacs_window_ids[0]}" 25 | elif [ "${#emacs_window_ids[*]}" -gt 1 ]; then 26 | current_desktop=`current-desktop` 27 | debug "More than one emacs frame" 28 | emacs_window_id=$( wmctrl -lpx | \ 29 | awk '$4 ~ /emacs/ && 30 | $5 ~ /'"$host"'/ && 31 | $2 == '$current_desktop' { print $1; exit 0 }' ) 32 | if [ -n "$emacs_window_id" ]; then 33 | debug "window_id of emacs on current desktop is $emacs_window_id" 34 | echo "$emacs_window_id" 35 | 36 | # The problem here is that emacsclient doesn't tell emacs 37 | # server which frame to open the new buffer in. FIXME: tweak 38 | # `server-switch-hook' to do this somehow (env variable?) 39 | # http://emacs-fu.blogspot.com/2008/12/opening-emacsclient-windows-on-current.html 40 | else 41 | debug "No emacs on current desktop; picking any one from ${emacs_window_ids[*]}" 42 | echo "${emacs_window_ids[0]}" 43 | fi 44 | else 45 | fatal "No emacs windows found on $DISPLAY" 46 | fi 47 | -------------------------------------------------------------------------------- /bin/emk: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if which gmake >/dev/null 2>&1; then 4 | MAKE=gmake 5 | elif which make >/dev/null 2>&1; then 6 | MAKE=make 7 | else 8 | echo "No make found; aborting!" >&2 9 | exit 1 10 | fi 11 | 12 | # -C produces extra unwanted output 13 | cd ~/lib/emacs 14 | $MAKE "$@" 15 | #exec ~/lib/emacs/compile "$@" 16 | -------------------------------------------------------------------------------- /bin/fe: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # "fast emacs" - forces non-windowing version and 4 | # bypasses some init code. 5 | 6 | if which emacs >/dev/null 2>&1; then 7 | QUICK_EMACS=1 8 | export QUICK_EMACS 9 | exec new-emacs -nw --no-site-file "$@" 10 | fi 11 | 12 | if which jmacs >/dev/null 2>&1; then 13 | exec jmacs "$@" 14 | fi 15 | 16 | echo "ERROR: neither emacs nor jmacs found; aborting." >&2 17 | exit 1 18 | -------------------------------------------------------------------------------- /bin/feed-X11: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ -z "$DISPLAY" ]; then 4 | echo "$0: no DISPLAY" >&2 5 | exit 1 6 | fi 7 | 8 | # If this is triggered via a keyboard shortcut, make sure 9 | # no modifiers still pressed are going to affect the results. 10 | xdotool keyup Shift_L 11 | xdotool keyup Shift_R 12 | xdotool keyup Control_L 13 | xdotool keyup Meta_L 14 | xdotool keyup Super_R 15 | 16 | key-seq-to-xdotool | xdotool - 17 | -------------------------------------------------------------------------------- /bin/key-seq-to-xmacro: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # 3 | # Converts STDIN sequences such as 'M-right C-u M-e foo \n' into 4 | # the equivalent xmacroplay commands. 5 | 6 | use strict; 7 | use warnings; 8 | 9 | my %keysyms; 10 | open(KEYSYMS, "/usr/include/X11/keysymdef.h") 11 | or die "Couldn't open(keysymdef.h): $!\n"; 12 | while () { 13 | /#define XK_(\w\S+)/ && $keysyms{$1}++; 14 | } 15 | close(KEYSYMS); 16 | 17 | my @actions = split /\s+/, join '', grep ! /^\s*(#|$)/, <>; 18 | foreach (@actions) { 19 | #print "Got: [$_]\n"; 20 | 21 | if (/^((?:[CMSH]-){1,4})(.+)$/) { 22 | my ($modifiers, $key) = ($1, $2); 23 | my @mods = split /-/, $modifiers; 24 | foreach my $abbrev (@mods) { 25 | my $keysym = $abbrev eq 'C' ? 'Control_L' 26 | : $abbrev eq 'M' ? 'Meta_L' 27 | : $abbrev eq 'S' ? 'Super_R' 28 | : $abbrev eq 'H' ? 'Hyper_R' 29 | : die "BUG"; 30 | print "KeyStrPress $keysym\n"; 31 | } 32 | if (length $key > 1 and $keysyms{$key}) { 33 | print "KeyStr $key\n"; 34 | } 35 | else { 36 | print "String $key\n"; 37 | } 38 | foreach my $abbrev (reverse @mods) { 39 | my $keysym = $abbrev eq 'C' ? 'Control_L' 40 | : $abbrev eq 'M' ? 'Meta_L' 41 | : $abbrev eq 'S' ? 'Super_R' 42 | : $abbrev eq 'H' ? 'Hyper_R' 43 | : die "BUG"; 44 | print "KeyStrRelease $keysym\n"; 45 | } 46 | next; 47 | } 48 | 49 | if (/^\\n$/) { 50 | print "KeyStr Return\n"; 51 | next; 52 | } 53 | 54 | if (/^\\e$/) { 55 | print "KeyStr Escape\n"; 56 | next; 57 | } 58 | 59 | if (/^\\t$/) { 60 | print "KeyStr Tab\n"; 61 | next; 62 | } 63 | 64 | if ($keysyms{$_}) { 65 | print "KeyStr $_\n"; 66 | next; 67 | } 68 | 69 | if (/^\\(.+)$/ and $keysyms{$1}) { 70 | # escaped keysym -> treat as string 71 | s/^\\//; 72 | } 73 | 74 | # We assume anything else is a normal string. 75 | print "String $_\n"; 76 | } 77 | -------------------------------------------------------------------------------- /bin/msf-to-yasnippet: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | MSF_DIR=~/lib/emacs/minor-modes/msf-abbrev/mode-abbrevs 4 | YASNIPPET_DIR=~/.GIT/adamspiers.org/emacs/.emacs.d/snippets 5 | cd "$MSF_DIR" 6 | 7 | for msf in perl-mode/*x; do 8 | mode="$(dirname $msf)" 9 | name="$(basename $msf)" 10 | name="${name%x}" 11 | 12 | snippet_dir="$YASNIPPET_DIR/$mode" 13 | snippet="$snippet_dir/$name" 14 | if [ -e "$snippet" ]; then 15 | echo "$snippet already exists" 16 | continue 17 | fi 18 | 19 | if ! [ -d "$snippet_dir" ]; then 20 | mkdir -p "$YASNIPPET_DIR/$mode" 21 | echo "mkdir $YASNIPPET_DIR/$mode" 22 | fi 23 | 24 | ( 25 | cat </ 35 | $i++; 36 | if ($1) { $ids{$2} = $i; } 37 | "\${$i:$3}" 38 | /ge; 39 | s//$ids{$1} ? "\$$ids{$1}": $&/ge; 40 | s//\$0/g; 41 | s//\$0/g; 42 | s//\$>/g; 43 | ' >"$snippet" 44 | echo "Wrote $snippet:" 45 | cat "$snippet" 46 | done 47 | -------------------------------------------------------------------------------- /bin/new-emacs: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # For the times when a new emacs instance is required (vs. 4 | # quick-emacs et al. which try their best to reuse an 5 | # existing one). 6 | 7 | which detect_ssh_agent >&/dev/null && detect_ssh_agent 8 | which detect_gpg_agent >&/dev/null && detect_gpg_agent 9 | 10 | if [ -n "$OTHER_USER" ]; then 11 | exec emacs -l $ZDOTDIR/.emacs "$@" 12 | else 13 | exec emacs "$@" 14 | fi 15 | -------------------------------------------------------------------------------- /bin/org-annotation-helper: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # org-annotation-helper -- pass a remember-url to emacs 3 | # 4 | # Author: Geert Kloosterman 5 | # Date: Sat Nov 19 22:33:18 2005 6 | 7 | exec > ~/.org-annotation-helper.log 2>&1 8 | 9 | me=`basename $0` 10 | 11 | echo "`date` $me $@" 12 | 13 | if [ -z "$1" ]; then 14 | echo "$0: Error: no arguments given!" 1>&2 15 | exit 1 16 | fi 17 | 18 | # For years I've been using Martin Schwenke's dtemacs script to start 19 | # Emacs. The script uses gnuclient to connect to Emacs and starts a 20 | # new Emacs process when necessary. 21 | # See http://www.meltin.net/hacks/emacs/ 22 | # 23 | 24 | url="$1" 25 | url="${url//%u2013/-}" 26 | # dtemacs -batch -eval "(progn (gjk/planner-annotation-helper \"$url\" ) \"\")" 27 | 28 | elisp="(progn (bzg/org-annotation-helper \"$url\" ) nil)" 29 | if emacsclient --help 2>&1 | grep -q -- --eval; then 30 | # As of Emacs 22 emacsclient will work too 31 | emacsclient --eval "$elisp" 32 | else 33 | linkfile="$HOME/.org-link" 34 | hlinkfile="${linkfile/$HOME/~}" 35 | echo -n "$url" | \ 36 | perl -MURI::Escape -0777ne \ 37 | 's!^annotation://![[!; 38 | s/%1C/][/; 39 | print uri_unescape($_), "]]"' \ 40 | > $linkfile 41 | 42 | logger -t "$me[$$]" -- "new $hlinkfile: `cat $linkfile`" 43 | fi 44 | -------------------------------------------------------------------------------- /bin/qe: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | quick-emacs -c "$@" 4 | -------------------------------------------------------------------------------- /bin/switch-emacs-eval: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | me=`basename $0` 4 | 5 | log () { 6 | echo "`date` $me: $*" >> ~/.log/$me.log 2>&1 7 | } 8 | 9 | if [ -z "$DISPLAY" ]; then 10 | echo "$me: Need \$DISPLAY set for $me to work; aborting." >&2 11 | sleep 1 # ensure we see the message if we're in mutt 12 | exit 1 13 | fi 14 | 15 | if ! fast-X11-display; then 16 | # switch-feed-emacs seems to care about this scenario, but 17 | # I can't remember why. 18 | : No fast X11 display 19 | exit 1 20 | fi 21 | 22 | : Assume we already have an emacs running. We could alternatively 23 | : use quick-emacs at this point. 24 | xdotool set_desktop 0 # prefer first desktop 25 | focus-emacs-frame || exit $? 26 | log "`current-window-id` / `current-window-name`" 27 | 28 | code="$1" 29 | shift 30 | 31 | if [ -f "$code" ]; then 32 | echo >&2 "Will eval file $code" 33 | code="(load \"$code\")" 34 | fi 35 | 36 | if [[ $# -gt 0 ]]; then 37 | # Escape double quotes 38 | escaped_args=("${@//\"/\\\"}") 39 | 40 | # Surround each arg with double quotes 41 | quoted_args=("${escaped_args[@]/#*/\"&\"}") 42 | 43 | code="(progn (setq emacsclient-args '(${quoted_args[@]})) $code)" 44 | fi 45 | 46 | log "$code" 47 | 48 | emacsclient --quiet --no-wait --eval "$code" 49 | -------------------------------------------------------------------------------- /bin/switch-feed-emacs: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . ~/.shared_env # fix PATH since xmacroplay might be in ~/local/bin 4 | 5 | me=`basename $0` 6 | 7 | if [ -z "$DISPLAY" ]; then 8 | echo "$me: Need \$DISPLAY set for feed-X11 to work; aborting." >&2 9 | sleep 1 # ensure we see the message if we're in mutt 10 | exit 1 11 | fi 12 | 13 | # backwards compatibility 14 | if [ "$1" = -l ]; then 15 | shift 16 | fi 17 | 18 | feed_X11 () { 19 | ( 20 | echo "C-g" 21 | cat 22 | ) | feed-X11 23 | } 24 | 25 | if fast-X11-display; then 26 | : Assume we already have an emacs running. We could alternatively 27 | : use quick-emacs at this point. 28 | xdotool set_desktop 0 # prefer first desktop 29 | focus-emacs-frame || exit $? 30 | echo "`date` $me: `current-window-id` / `current-window-name`" \ 31 | >> ~/.log/switch-feed-emacs.log 2>&1 32 | feed_X11 33 | else 34 | : No fast X11 display 35 | # The bash manual says: 36 | # 37 | # If a command is followed by a & and job control is not active, 38 | # the default standard input for the command is the empty file 39 | # /dev/null. 40 | # 41 | # So we first save the current STDIN which is connected to the 42 | # output end of the pipe which will receive the key macro to feed 43 | # to feed-X11. 44 | exec 3<&0 45 | ( sleep 2; feed_X11 <&3 ) & 46 | 47 | # For some reason we don't need STDIN to be a tty for 48 | # interactive emacs to run happily in the foreground?! 49 | quick-emacs "$@" 50 | fi 51 | -------------------------------------------------------------------------------- /bin/todo: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | e --eval '(as-org-switch-to-agenda-buffer)' 4 | #e "$@" ~/roaming/TODO.org 5 | -------------------------------------------------------------------------------- /bin/update-mairix-link: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Selects next mairix link in emacs, opens it in mutt, 4 | # re-stores the link, and replaces the existing link 5 | # in emacs with the new one. 6 | # 7 | # Written 17 years ago so can't remember what this was 8 | # for; perhaps some kind of link format change or 9 | # reindexing. 10 | 11 | # find next direct link to a message 12 | echo 'C-s link 28 | C-r < \n 29 | 30 | # Zap to > at end of link 31 | M-z > 32 | 33 | # Yank new link 34 | C-c M y 35 | 36 | # Try to indent right 37 | \t 38 | EOF 39 | 40 | # switch back to xterm 41 | wmctrl -a 'adam@' 42 | 43 | echo 'KeyStr Up' | xmacroplay $DISPLAY >/dev/null 44 | -------------------------------------------------------------------------------- /lib/emacs/.gitignore: -------------------------------------------------------------------------------- 1 | .elcs 2 | .lispdir 3 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/.emacs-dirvars: -------------------------------------------------------------------------------- 1 | ;; -*- emacs-lisp -*- 2 | ;; 3 | ;; This file is processed by the dirvars emacs package. Each variable 4 | ;; setting below is performed when this dirvars file is loaded. 5 | ;; 6 | indent-tabs-mode: nil 7 | tab-width: 4 8 | show-trailing-whitespace: t 9 | require-final-newline: nil 10 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/emacs-lisp-mode/defadvicex: -------------------------------------------------------------------------------- 1 | (defadvice (around activate) 2 | 3 | ad-do-it 4 | ) -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/emacs-lisp-mode/defunx: -------------------------------------------------------------------------------- 1 | (defun () 2 | (interactive) 3 | ) -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/emacs-lisp-mode/funcx: -------------------------------------------------------------------------------- 1 | (defun () 2 | (interactive) 3 | ) -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/emacs-lisp-mode/hlskx: -------------------------------------------------------------------------------- 1 | (add-hook '-mode-hook 2 | (lambda () (local-set-key [()] '))) 3 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/emacs-lisp-mode/printx: -------------------------------------------------------------------------------- 1 | (message "") -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/emacs-lisp-mode/whilex: -------------------------------------------------------------------------------- 1 | (while 2 | ) -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/global/flatx: -------------------------------------------------------------------------------- 1 | 70 Ocean Wharf 2 | 60 Westferry Road 3 | London 4 | E14 8JS 5 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/global/hpx: -------------------------------------------------------------------------------- 1 | http://www.adamspiers.org/ 2 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/global/lmodex: -------------------------------------------------------------------------------- 1 | # -*- mode: -*- 2 | 3 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/global/nvex: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/global/nvsx: -------------------------------------------------------------------------------- 1 | 2 | -- 3 | Adam Spiers email: 4 | Senior Linux/OSS Architect, EMEA cell: +44 7712 487 130 5 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/global/nvx: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/global/snailx: -------------------------------------------------------------------------------- 1 | 70 Ocean Wharf 2 | 60 Westferry Road 3 | London 4 | E14 8JS 5 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/global/tigpx: -------------------------------------------------------------------------------- 1 | http://tigerpig.org/ -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/global/waddrx: -------------------------------------------------------------------------------- 1 | Novell (UK) Ltd. 2 | 1 Arlington Square 3 | Downshire Way 4 | Bracknell 5 | Berkshire 6 | RG12 1WA 7 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/global/wex: -------------------------------------------------------------------------------- 1 | aspiers@novell.com -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/global/wsnailx: -------------------------------------------------------------------------------- 1 | Novell (UK) Ltd. 2 | 1 Arlington Square 3 | Downshire Way 4 | Bracknell 5 | Berkshire 6 | RG12 1WA 7 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/argx: -------------------------------------------------------------------------------- 1 | my () = @_; -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/arx: -------------------------------------------------------------------------------- 1 | sub { shift->{} } -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/carpx: -------------------------------------------------------------------------------- 1 | use Carp qw(carp cluck croak confess); 2 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/cdx: -------------------------------------------------------------------------------- 1 | chdir() or die "chdir() failed: $!\n"; 2 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/classx: -------------------------------------------------------------------------------- 1 | my $class = shift; -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/clx: -------------------------------------------------------------------------------- 1 | $class-> -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/cmethx: -------------------------------------------------------------------------------- 1 | sub { 2 | my $class = shift; 3 | my () = @_; 4 | 5 | } 6 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/cmethxx: -------------------------------------------------------------------------------- 1 | =head2 2 | 3 | 4 | 5 | =cut 6 | 7 | 8 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/constrx: -------------------------------------------------------------------------------- 1 | =head1 CONSTRUCTORS 2 | 3 | 4 | 5 | =cut 6 | 7 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/dbx: -------------------------------------------------------------------------------- 1 | debug(, "\n"); -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/debugfx: -------------------------------------------------------------------------------- 1 | sub debugf { 2 | my $level = shift; 3 | warn sprintf @_, "\n" if $opts{verbosity} >= $level; 4 | } 5 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/debugx: -------------------------------------------------------------------------------- 1 | sub debug { 2 | my $level = shift; 3 | warn @_, "\n" if $opts{verbosity} >= $level; 4 | } 5 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/dumpx: -------------------------------------------------------------------------------- 1 | use Data::Dumper; 2 | warn Dumper(); 3 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/findx: -------------------------------------------------------------------------------- 1 | use File::Find; 2 | 3 | find(\&, ); 4 | 5 | sub { 6 | 7 | if ($_ eq 'OLD') { 8 | $File::Find::prune = 1; 9 | return; 10 | } 11 | return unless /\.java$/; 12 | return unless $File::Find::name =~ m!^(?:\./)?(.+/src/(.+\.java))$!; 13 | return unless $File::Find::dir eq 'src'; 14 | } 15 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/for: -------------------------------------------------------------------------------- 1 | for -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/foreach: -------------------------------------------------------------------------------- 1 | foreach -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/foreachx: -------------------------------------------------------------------------------- 1 | foreach my $ () { 2 | 3 | } -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/forx: -------------------------------------------------------------------------------- 1 | for my $ () { 2 | 3 | } -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/getoptsx: -------------------------------------------------------------------------------- 1 | use Getopt::Long; 2 | 3 | Getopt::Long::Configure('bundling'); 4 | 5 | my %opts = ( verbosity => 1 ); 6 | GetOptions( 7 | \%opts, 8 | 'help|h', 9 | 'debug|d', 10 | 'verbosity|verbose|v:+', 11 | 'version|V', 12 | 13 | ) or usage(); 14 | usage() if @ARGV == 0 or $opts{help}; 15 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/h1x: -------------------------------------------------------------------------------- 1 | =head1 2 | 3 | 4 | 5 | =cut 6 | 7 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/h2x: -------------------------------------------------------------------------------- 1 | =head2 2 | 3 | 4 | 5 | =cut 6 | 7 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/hbx: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | use strict; 4 | use warnings; 5 | 6 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/if: -------------------------------------------------------------------------------- 1 | if -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/ifx: -------------------------------------------------------------------------------- 1 | if () { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/lax: -------------------------------------------------------------------------------- 1 | my $ = $self->; 2 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/mainx: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | 3 | use strict; 4 | 5 | my $numargs = $#ARGV + 1; 6 | //my $filename = $ARGV[0]; 7 | 8 | # error checking argument 9 | if ($numargs != 1) { 10 | printf("Usage: %s \n", $0); 11 | exit(1); 12 | } 13 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/mdx: -------------------------------------------------------------------------------- 1 | mkdir() or die "mkdir() failed: $!\n"; 2 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/methx: -------------------------------------------------------------------------------- 1 | sub { 2 | my $self = shift; 3 | my () = @_; 4 | 5 | } 6 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/methxx: -------------------------------------------------------------------------------- 1 | =head2 2 | 3 | 4 | 5 | =cut 6 | 7 | 8 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/mex: -------------------------------------------------------------------------------- 1 | (my $ME = $0) =~ s,.*/,,; 2 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/newx: -------------------------------------------------------------------------------- 1 | sub new { 2 | my $self = shift; 3 | my $class = ref($self) || $self; 4 | my () = @_; 5 | 6 | 7 | 8 | my $new = bless { 9 | }, $class; 10 | 11 | return $new; 12 | } 13 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/odx: -------------------------------------------------------------------------------- 1 | or die " failed: $!\n"; -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/opendirx: -------------------------------------------------------------------------------- 1 | opendir(, ) 2 | or die "opendir() failed: $!\n"; -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/openfromx: -------------------------------------------------------------------------------- 1 | open(, "|") 2 | or die "Couldn't open(|): $!\n"; 3 | while (<>) { 4 | ; 5 | } 6 | 7 | close() 8 | or die "close(|) failed: $!\n"; -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/opentox: -------------------------------------------------------------------------------- 1 | open(, "| ") 2 | or die "Couldn't open(| ): $!\n"; 3 | print ; 4 | 5 | close() 6 | or die "close(| ) failed: $!\n"; -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/opentoxx: -------------------------------------------------------------------------------- 1 | open(, "|-", , ) 2 | or die "Couldn't open(| ): $!\n"; 3 | print ; 4 | 5 | close() 6 | or die "close(| ) failed: $!\n"; 7 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/openwhx: -------------------------------------------------------------------------------- 1 | open(, ) 2 | or die "Couldn't open(): $!\n"; 3 | while (<>) { 4 | 5 | } 6 | close(); -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/openwx: -------------------------------------------------------------------------------- 1 | open(, ">") 2 | or die "Couldn't open(>): $!\n"; 3 | print ; 4 | close(); -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/openx: -------------------------------------------------------------------------------- 1 | open(, ) 2 | or die "Couldn't open(): $!\n"; 3 | while (<>) { 4 | 5 | } 6 | close(); -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/overx: -------------------------------------------------------------------------------- 1 | =over 4 2 | 3 | =item * 4 | 5 | 6 | 7 | =back 8 | 9 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/pfx: -------------------------------------------------------------------------------- 1 | printf(""); -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/pkgx: -------------------------------------------------------------------------------- 1 | package ; 2 | 3 | =head1 NAME 4 | 5 | - 6 | 7 | =head1 SYNOPSIS 8 | 9 | 10 | 11 | =head1 DESCRIPTION 12 | 13 | 14 | 15 | =cut 16 | 17 | use strict; 18 | use warnings; 19 | 20 | 21 | 22 | =head1 BUGS 23 | 24 | =head1 SEE ALSO 25 | 26 | =cut 27 | 28 | 1; 29 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/psubx: -------------------------------------------------------------------------------- 1 | =head2 2 | 3 | 4 | 5 | =cut 6 | 7 | sub { 8 | my () = @_; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/px: -------------------------------------------------------------------------------- 1 | print "\n"; 2 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/selfx: -------------------------------------------------------------------------------- 1 | my $self = shift; 2 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/sfx: -------------------------------------------------------------------------------- 1 | $self-> -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/subx: -------------------------------------------------------------------------------- 1 | sub { 2 | my () = @_; 3 | 4 | } 5 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/testx: -------------------------------------------------------------------------------- 1 | =over 4 2 | 3 | =item * 4 | 5 | =back 6 | 7 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/usagex: -------------------------------------------------------------------------------- 1 | sub usage { 2 | warn @_, "\n" if @_; 3 | 4 | (my $ME = $0) =~ s,.*/,,; 5 | 6 | die < 8 | Options: 9 | -h, --help Show this help 10 | -v, --verbose[=N] Increase [specify] verbosity (defaults to 1) 11 | -V, --version Show version 12 | 13 | EOUSAGE 14 | } 15 | 16 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/while: -------------------------------------------------------------------------------- 1 | while -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/perl-mode/whilex: -------------------------------------------------------------------------------- 1 | while () { 2 | 3 | } -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/acceptx: -------------------------------------------------------------------------------- 1 | (csock, addr) = s.accept() -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/argsx: -------------------------------------------------------------------------------- 1 | if ((len(sys.argv)-1) != ): 2 | usage() -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/assertx: -------------------------------------------------------------------------------- 1 | assert -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/boolandx: -------------------------------------------------------------------------------- 1 | and -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/buttonx: -------------------------------------------------------------------------------- 1 | Button(, text=, command=) -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/classx: -------------------------------------------------------------------------------- 1 | class : 2 | def __init__(self): 3 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/cnx: -------------------------------------------------------------------------------- 1 | __class__.__name__ -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/commandthreadx: -------------------------------------------------------------------------------- 1 | class CommandThread(threading.Thread): 2 | def __init__(self, cmd): 3 | threading.Thread.__init__(self) 4 | self.cmd = cmd 5 | def run(self): 6 | (status, output) = commands.getstatusoutput(self.cmd) 7 | print 'CommandThread: (status, output) of [%s] is (%d, %s)' % \ 8 | (self.cmd, status, output) -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/commandx.el: -------------------------------------------------------------------------------- 1 | (progn 2 | (save-excursion 3 | (goto-char (point-min)) 4 | (when (not (re-search-forward "^import.*\\" nil t)) 5 | (forward-line 1) 6 | (insert "import commands\n"))) 7 | (insert "commands.getoutput(\"\")") 8 | (backward-char 2)) 9 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/commentx: -------------------------------------------------------------------------------- 1 | # -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/cx: -------------------------------------------------------------------------------- 1 | __class__ -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/elseifx: -------------------------------------------------------------------------------- 1 | elif : 2 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/elsex: -------------------------------------------------------------------------------- 1 | else: 2 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/errx: -------------------------------------------------------------------------------- 1 | sys.stderr.write("ERROR: ") -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/excx: -------------------------------------------------------------------------------- 1 | exc_type, exc_value, exc_traceback = sys.exc_info() 2 | print "%s: %s" % (exc_type.__name__, exc_value) 3 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/exitx: -------------------------------------------------------------------------------- 1 | sys.exit(1) -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/fclosex: -------------------------------------------------------------------------------- 1 | f.close() -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/fileexistsx: -------------------------------------------------------------------------------- 1 | os.path.exists() -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/filesizex: -------------------------------------------------------------------------------- 1 | os.path.getsize() -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/filex: -------------------------------------------------------------------------------- 1 | f = open(, ) -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/flusherrx: -------------------------------------------------------------------------------- 1 | sys.stderr.flush() -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/flushoutx: -------------------------------------------------------------------------------- 1 | sys.stdout.flush() -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/fnx: -------------------------------------------------------------------------------- 1 | def (): 2 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/fopenx: -------------------------------------------------------------------------------- 1 | f = open(, ) -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/forx: -------------------------------------------------------------------------------- 1 | for in : 2 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/fwritex: -------------------------------------------------------------------------------- 1 | f.write() -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/getenvx: -------------------------------------------------------------------------------- 1 | os.getenv() -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/getoptx: -------------------------------------------------------------------------------- 1 | try: 2 | opts, args = getopt.getopt(sys.argv[1:], "ho:v", ["help", "output="]) 3 | except getopt.GetoptError: 4 | usage() 5 | output = None 6 | verbose = False 7 | for opt, arg in opts: 8 | if opt == "-v": 9 | verbose = True 10 | if opt in ("-h", "--help"): 11 | usage() 12 | if opt in ("-o", "--output"): 13 | output = arg 14 | for arg in args: 15 | pass -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/groupx: -------------------------------------------------------------------------------- 1 | group = Pmw.Group(, tag_text=) -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/gtkconnectx: -------------------------------------------------------------------------------- 1 | button.connect('clicked', ) -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/gtkscrollx: -------------------------------------------------------------------------------- 1 | scrolled_win = gtk.ScrolledWindow(hadjustment=None) 2 | scrolled_win.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) 3 | scrolled_win.add_with_viewport() -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/gtkthreadx: -------------------------------------------------------------------------------- 1 | gtk.threads_init() 2 | 3 | gtk.threads_enter() 4 | 5 | gtk.threads_leave() 6 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/hashx: -------------------------------------------------------------------------------- 1 | def __hash__(self): 2 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/hbx: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/hostnamex: -------------------------------------------------------------------------------- 1 | socket.gethostname() -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/ifx: -------------------------------------------------------------------------------- 1 | if : 2 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/importx: -------------------------------------------------------------------------------- 1 | import os, os.path, sys, re, commands, pickle, tempfile, getopt 2 | import socket, string, random, threading, time, traceback -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/initx: -------------------------------------------------------------------------------- 1 | def __init__(self): 2 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/listx: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/mainx: -------------------------------------------------------------------------------- 1 | if __name__ == "__main__": # when run as a script 2 | # psyco 3 | try: 4 | import psyco 5 | psyco.full() 6 | except ImportError: 7 | pass 8 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/mapx: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/matchrefx: -------------------------------------------------------------------------------- 1 | m = re.match(pattern, string) 2 | m.group(1) # references \1 -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/matchx: -------------------------------------------------------------------------------- 1 | re.search(, ) -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/mex: -------------------------------------------------------------------------------- 1 | def (self, ): 2 | 3 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/mutexx: -------------------------------------------------------------------------------- 1 | threading.Semaphore() -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/nx: -------------------------------------------------------------------------------- 1 | __name__ -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/packx: -------------------------------------------------------------------------------- 1 | pack(side=, expand=, fill=, padx=, pady=) -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/pdbx: -------------------------------------------------------------------------------- 1 | import pdb; pdb.set_trace() 2 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/printx: -------------------------------------------------------------------------------- 1 | print -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/profilex: -------------------------------------------------------------------------------- 1 | import profile, pstats 2 | 3 | profile_file = 'profile.prof' 4 | profile.run('main()', profile_file) 5 | st = pstats.Stats(profile_file) 6 | print 'cumulative:' 7 | st.sort_stats('cumulative').print_stats(10) 8 | print 'time:' 9 | st.sort_stats('time').print_stats(10) 10 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/psycox: -------------------------------------------------------------------------------- 1 | try: 2 | import psyco 3 | psyco.full() 4 | except ImportError: 5 | pass -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/putenvx: -------------------------------------------------------------------------------- 1 | os.environ[''] = -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/randomx: -------------------------------------------------------------------------------- 1 | random.randint(, ) -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/setenvx: -------------------------------------------------------------------------------- 1 | os.environ[] = -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/shiftx: -------------------------------------------------------------------------------- 1 | sys.argv = sys.argv[:1] + sys.argv[2:] -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/sleepx: -------------------------------------------------------------------------------- 1 | time.sleep() -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/sortx: -------------------------------------------------------------------------------- 1 | def sort_cmp(a, b): 2 | if a < b: 3 | return 1 4 | elif a > b: 5 | return -1 6 | else: 7 | return 0 8 | 9 | list.sort(sort_cmp) -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/strx: -------------------------------------------------------------------------------- 1 | def __str__(self): 2 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/subx: -------------------------------------------------------------------------------- 1 | re.sub(pattern, replacement, string) -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/tcpserversocketx: -------------------------------------------------------------------------------- 1 | s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 2 | s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) 3 | s.bind(('', port)) 4 | s.listen(5) -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/tcpsocketx: -------------------------------------------------------------------------------- 1 | s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 2 | s.connect((, )) -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/tempdirx: -------------------------------------------------------------------------------- 1 | tempdirname = tempfile.mkdtemp() -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/tempfilex: -------------------------------------------------------------------------------- 1 | (tempfd, tempfn) = tempfile.mkstemp(suffix="") -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/threadclassx: -------------------------------------------------------------------------------- 1 | class (threading.Thread): 2 | def __init__(self): 3 | threading.Thread.__init__(self) 4 | def run(self): 5 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/trace2x: -------------------------------------------------------------------------------- 1 | import sys, traceback 2 | traceOutput = sys.stdout 3 | watchOutput = sys.stdout 4 | rawOutput = sys.stdout 5 | watch_format = ('File "%(fileName)s", line %(lineNumber)d, in' 6 | ' %(methodName)s\n %(varName)s <%(varType)s>' 7 | ' = %(value)s\n\n') 8 | def watch(variableName): 9 | if __debug__: 10 | stack = traceback.extract_stack( )[-2:][0] 11 | actualCall = stack[3] 12 | if actualCall is None: 13 | actualCall = "watch([unknown])" 14 | left = actualCall.find('(') 15 | right = actualCall.rfind(')') 16 | paramDict = dict(varName=actualCall[left+1:right].strip(), 17 | varType=str(type(variableName))[7:-2], 18 | value=repr(variableName), 19 | methodName=stack[2], 20 | lineNumber=stack[1], 21 | fileName=stack[0]) 22 | watchOutput.write(watch_format % paramDict) 23 | trace_format = ('File "%(fileName)s", line %(lineNumber)d, in' 24 | ' %(methodName)s\n %(text)s\n\n') 25 | def trace(text): 26 | if __debug__: 27 | stack = traceback.extract_stack( )[-2:][0] 28 | paramDict = dict(text=text, 29 | methodName=stack[2], 30 | lineNumber=stack[1], 31 | fileName=stack[0]) 32 | watchOutput.write(trace_format % paramDict) 33 | # calling 'raw("some raw text")' prints out something like: 34 | # Just some raw text 35 | def raw(text): 36 | if __debug__: 37 | rawOutput.write(text) 38 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/tracex: -------------------------------------------------------------------------------- 1 | def trace(fr, evt, arg): 2 | import linecache 3 | if evt == 'line': 4 | f = fr.f_code.co_filename 5 | n = fr.f_lineno 6 | print '%s:%d -> ' %(f, n), linecache.getline(f, n), 7 | return trace 8 | sys.settrace(trace) -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/tryx: -------------------------------------------------------------------------------- 1 | try: 2 | 3 | except Exception: 4 | traceback.print_exc() 5 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/udpsocketx: -------------------------------------------------------------------------------- 1 | s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) 2 | s.bind(('', 0)) 3 | s.sendto(message, (host, port)) -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/unamex: -------------------------------------------------------------------------------- 1 | os.uname() -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/unpackx: -------------------------------------------------------------------------------- 1 | (v1, v2, ...) = struct.unpack(") -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/usagex: -------------------------------------------------------------------------------- 1 | def usage(): 2 | print 'usage:', os.path.basename(sys.argv[0]) + ' ' 3 | sys.exit(1) -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/whichx: -------------------------------------------------------------------------------- 1 | def which(filename): 2 | if not os.environ.has_key('PATH') or os.environ['PATH'] == '': 3 | p = os.defpath 4 | else: 5 | p = os.environ['PATH'] 6 | pathlist = string.split(p, os.pathsep) 7 | for path in pathlist: 8 | f = os.path.join(path, filename) 9 | if os.access(f, os.X_OK): 10 | return f 11 | return None 12 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/python-mode/whilex: -------------------------------------------------------------------------------- 1 | while : 2 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/ruby-mode.el: -------------------------------------------------------------------------------- 1 | ;;(msf-abbrev-install-locally 'sh-mode) 2 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/ruby-mode/acx: -------------------------------------------------------------------------------- 1 | attr_accessor : -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/ruby-mode/arx: -------------------------------------------------------------------------------- 1 | attr_reader : -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/ruby-mode/awx: -------------------------------------------------------------------------------- 1 | attr_writer : -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/ruby-mode/clx: -------------------------------------------------------------------------------- 1 | class 2 | 3 | end 4 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/ruby-mode/defx: -------------------------------------------------------------------------------- 1 | def () 2 | 3 | end -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/ruby-mode/edr: -------------------------------------------------------------------------------- 1 | .each do || 2 | . 3 | end 4 | render : 5 | 6 | 7 | 8 | => "rendereing using :" 9 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/ruby-mode/hbx: -------------------------------------------------------------------------------- 1 | #!/usr/bin/ruby 2 | 3 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/ruby-mode/ifx: -------------------------------------------------------------------------------- 1 | if 2 | 3 | end 4 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/ruby-mode/initx: -------------------------------------------------------------------------------- 1 | def initialize() 2 | 3 | end 4 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/ruby-mode/mex: -------------------------------------------------------------------------------- 1 | ME = File.basename($0) 2 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/ruby-mode/ubrx: -------------------------------------------------------------------------------- 1 | #!/usr/bin/ruby -w 2 | 3 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/ruby-mode/usagex: -------------------------------------------------------------------------------- 1 | 2 | unless ARGV.length == 1 3 | $stderr.puts "Usage: #{ME} " 4 | exit 1 5 | end 6 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/abortx: -------------------------------------------------------------------------------- 1 | abort () { 2 | die "$*; aborting." 3 | } 4 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/bunzipx: -------------------------------------------------------------------------------- 1 | bzcat | tar xvf - -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/clogx: -------------------------------------------------------------------------------- 1 | _color_log () { color="$1"; shift; tput setaf "$color"; echo "$*"; tput sgr0; } 2 | _bold_color_log () { tput bold; _color_log "$@"; } 3 | _log () { echo "`date` $*" >>& "$LOGFILE"; } 4 | 5 | progress () { _bold_color_log 2 "$@" ; } 6 | warn () { _bold_color_log 3 "$@" >&2; } 7 | error () { _bold_color_log 1 "$@" >&2; } 8 | fatal () { error "$@"; exit 1; } 9 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/dex: -------------------------------------------------------------------------------- 1 | [ -d "" ] -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/diex: -------------------------------------------------------------------------------- 1 | die () { 2 | echo >&2 "$*" 3 | exit 1 4 | } 5 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/dlogx: -------------------------------------------------------------------------------- 1 | _dlog () { echo "`date` $*" >> "$LOGFILE" 2>&1; } 2 | debug () { _dlog "$*"; } 3 | progress () { _dlog "$*"; echo "$me: $*"; } 4 | warn () { _dlog "$*"; echo >&2 "$me: $*"; } 5 | error () { _dlog "ERROR: $*"; echo >&2 "$me: ERROR: $*"; } 6 | fatal () { _dlog "FATAL: $*"; echo >&2 "$me: FATAL: $*"; exit 1; } 7 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/echonnx: -------------------------------------------------------------------------------- 1 | EchoNoNewline() { 2 | if [ "`echo -n`" = "-n" ]; then 3 | echo "$@\c" 4 | else 5 | echo -n "$@" 6 | fi 7 | } -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/elseifx: -------------------------------------------------------------------------------- 1 | elif [ ]; then 2 | 3 | fi -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/elsex: -------------------------------------------------------------------------------- 1 | else 2 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/errx: -------------------------------------------------------------------------------- 1 | echo >&2 "ERROR: " 2 | exit 1 -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/fex: -------------------------------------------------------------------------------- 1 | [ -e "" ] -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/filesizex: -------------------------------------------------------------------------------- 1 | filesize () { 2 | ls -al $1 | awk '{print $5}' 3 | } -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/forx: -------------------------------------------------------------------------------- 1 | for in ; do 2 | 3 | done -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/frx: -------------------------------------------------------------------------------- 1 | [ -r "" ] -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/funcx: -------------------------------------------------------------------------------- 1 | function { 2 | 3 | } -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/fxx: -------------------------------------------------------------------------------- 1 | [ -x "" ] -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/getoptsx: -------------------------------------------------------------------------------- 1 | parse_opts () { 2 | while [ $# != 0 ]; do 3 | case "$1" in 4 | -h|--help) 5 | usage 0 6 | ;; 7 | -v|--version) 8 | echo "$me $VERSION" 9 | ;; 10 | -*) 11 | usage "Unrecognised option: $1" 12 | ;; 13 | *) 14 | break 15 | ;; 16 | esac 17 | done 18 | 19 | if [ $# -lt 2 ]; then 20 | usage 21 | fi 22 | 23 | ARGV=( "$@" ) 24 | } 25 | 26 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/gunzipx: -------------------------------------------------------------------------------- 1 | gunzip -qc | tar xvf - -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/hbbx: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/hbx: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/herex: -------------------------------------------------------------------------------- 1 | here=`dirname $0` 2 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/ifdiex: -------------------------------------------------------------------------------- 1 | if ; then 2 | echo >&2 "" 3 | exit 1 4 | fi -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/ifx: -------------------------------------------------------------------------------- 1 | if ; then 2 | 3 | fi -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/instx: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | R= 5 | upak-wget $R.tar.gz 6 | gunzip -qc $R.tar.gz | tar xvf - 7 | cd $R 8 | ./configure --prefix=$UPAKINSTALLDIR 9 | make 10 | make install -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/logx: -------------------------------------------------------------------------------- 1 | _log () { echo "$*"; } 2 | 3 | progress () { _log "$@" ; } 4 | warn () { _log "$@" >&2; } 5 | error () { _log "$@" >&2; } 6 | fatal () { error "$@"; exit 1; } 7 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/mex: -------------------------------------------------------------------------------- 1 | me=`basename $0` 2 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/neqx: -------------------------------------------------------------------------------- 1 | [ -eq ] -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/ngex: -------------------------------------------------------------------------------- 1 | [ -ge ] -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/ngexx: -------------------------------------------------------------------------------- 1 | [[ -ge ]] -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/ngtx: -------------------------------------------------------------------------------- 1 | [ -gt ] -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/ngtxx: -------------------------------------------------------------------------------- 1 | [[ -gt ]] -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/nlex: -------------------------------------------------------------------------------- 1 | [ -le ] -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/nlexx: -------------------------------------------------------------------------------- 1 | [[ -le ]] -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/nltx: -------------------------------------------------------------------------------- 1 | [ -lt ] -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/nltxx: -------------------------------------------------------------------------------- 1 | [[ -lt ]] -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/nnex: -------------------------------------------------------------------------------- 1 | [ -ne ] -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/nrootx: -------------------------------------------------------------------------------- 1 | if [ "$USER" == root ]; then 2 | echo >&2 "Must not be root" 3 | exit 1 4 | fi -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/passthrux: -------------------------------------------------------------------------------- 1 | ${1+"$@"} -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/qrx: -------------------------------------------------------------------------------- 1 | if ! out=$( 2>&1); then 2 | echo "$out" 3 | fi 4 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/requireutilx: -------------------------------------------------------------------------------- 1 | requireutil () { 2 | while [ -n "$1" ]; do 3 | type $1 >/dev/null 2>/dev/null 4 | if [ $? -ne 0 ]; then 5 | echo Missing utility "$1". Please install it. >/dev/stderr 6 | exit 1 7 | fi 8 | shift 9 | done 10 | } -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/rootx: -------------------------------------------------------------------------------- 1 | if [ "$USER" != root ]; then 2 | echo >&2 "Must be root" 3 | exit 1 4 | fi -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/sex: -------------------------------------------------------------------------------- 1 | [ = ] -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/sexx: -------------------------------------------------------------------------------- 1 | [[ == ]] -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/snex: -------------------------------------------------------------------------------- 1 | [ != ] -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/snexx: -------------------------------------------------------------------------------- 1 | [[ != ]] -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/snx: -------------------------------------------------------------------------------- 1 | [ -n "$" ] -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/srx: -------------------------------------------------------------------------------- 1 | safe_run () { 2 | if ! "$@"; then 3 | fatal "$* failed! Aborting." >&2 4 | exit 1 5 | fi 6 | } 7 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/szx: -------------------------------------------------------------------------------- 1 | [ -z "$" ] -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/tmpdx: -------------------------------------------------------------------------------- 1 | if ! tmpdir=`mktemp -d /$me.tmp.XXXXXXXX`; then 2 | echo "mktemp failed: $!" 3 | exit 1 4 | fi 5 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/tmpx: -------------------------------------------------------------------------------- 1 | if ! tmpfile=`mktemp /$me.tmp.XXXXXXXX`; then 2 | echo "mktemp failed: $!" 3 | exit 1 4 | fi 5 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/usagex: -------------------------------------------------------------------------------- 1 | usage () { 2 | # Call as: usage [EXITCODE] [USAGE MESSAGE] 3 | exit_code=1 4 | if [[ "$1" == [0-9] ]]; then 5 | exit_code="$1" 6 | shift 7 | fi 8 | 9 | me=`basename $0` 10 | 11 | cat <&2 12 | Usage: $me 13 | Options: 14 | -h, --help Show this help and exit 15 | -v, --version Output version information and exit 16 | 17 | EOF 18 | 19 | if [ -n "$1" ]; then 20 | echo >&2 21 | echo >&2 "$*" 22 | fi 23 | 24 | exit "$exit_code" 25 | } 26 | 27 | main () { 28 | if [ "$1" == '-h' ] || [ "$1" == '--help' ]; then 29 | usage 0 30 | fi 31 | # or use getoptsx 32 | } 33 | -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/vx: -------------------------------------------------------------------------------- 1 | "$" -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/vxx: -------------------------------------------------------------------------------- 1 | "${}" -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/warnx: -------------------------------------------------------------------------------- 1 | echo >&2 "" -------------------------------------------------------------------------------- /lib/emacs/minor-modes/msf-abbrev/mode-abbrevs/sh-mode/whilex: -------------------------------------------------------------------------------- 1 | while ; do 2 | 3 | done -------------------------------------------------------------------------------- /lib/emacs/shortcuts/org-agenda-daily-review.el: -------------------------------------------------------------------------------- 1 | (as-org-switch-to-agenda-buffer "rd") 2 | -------------------------------------------------------------------------------- /lib/emacs/shortcuts/org-agenda-today.el: -------------------------------------------------------------------------------- 1 | (as-org-switch-to-agenda-buffer "d" t) 2 | -------------------------------------------------------------------------------- /lib/emacs/shortcuts/org-agenda-weekly-review.el: -------------------------------------------------------------------------------- 1 | (as-org-switch-to-agenda-buffer "r7") 2 | -------------------------------------------------------------------------------- /lib/emacs/shortcuts/org-capture-personal-TODO-from-mairix.el: -------------------------------------------------------------------------------- 1 | (org-capture "m") 2 | -------------------------------------------------------------------------------- /lib/emacs/shortcuts/org-capture-personal-diary-from-mairix.el: -------------------------------------------------------------------------------- 1 | (org-capture "a") 2 | -------------------------------------------------------------------------------- /lib/emacs/shortcuts/org-jump-personal-diary.el: -------------------------------------------------------------------------------- 1 | (find-file "~/org/diary.org") 2 | -------------------------------------------------------------------------------- /lib/emacs/utils/org-clock-sound-quiet.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspiers/emacs/a4aa97dfa41d64e2d81f4342924d936f87d88c74/lib/emacs/utils/org-clock-sound-quiet.wav -------------------------------------------------------------------------------- /lib/emacs/utils/org-clock-sound.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspiers/emacs/a4aa97dfa41d64e2d81f4342924d936f87d88c74/lib/emacs/utils/org-clock-sound.wav -------------------------------------------------------------------------------- /lib/xmacro/org-agenda: -------------------------------------------------------------------------------- 1 | # This works regardless of key-binding or current 2 | # buffer. Also Escape should be more portable than Meta_L etc. 3 | #\e x org-agenda \n a 4 | 5 | # Another way of doing it since I bind M-o a to `org-agenda' 6 | # both in org-mode and globally. 7 | \e o a 8 | -------------------------------------------------------------------------------- /lib/xmacro/org-agenda-daily-review: -------------------------------------------------------------------------------- 1 | # See org-agenda 2 | #C-g \e x org-agenda \n d 3 | 4 | # Escape should be more portable than Meta_L etc. 5 | #\e o a d 6 | 7 | # Better UX to use as-org-switch-to-agenda-buffer then refresh 8 | \e o b g 9 | -------------------------------------------------------------------------------- /lib/xmacro/org-capture: -------------------------------------------------------------------------------- 1 | # See org-agenda 2 | C-c c 3 | 4 | #\e x org-remember \n 5 | -------------------------------------------------------------------------------- /lib/xmacro/org-capture-personal-TODO-from-mail: -------------------------------------------------------------------------------- 1 | # See org-agenda 2 | C-c c m 3 | -------------------------------------------------------------------------------- /lib/xmacro/org-capture-personal-diary-from-mail: -------------------------------------------------------------------------------- 1 | # See org-agenda 2 | C-c c a 3 | -------------------------------------------------------------------------------- /lib/xmacro/org-jump-personal-diary: -------------------------------------------------------------------------------- 1 | C-x C-f ~/org/diary.org \n 2 | -------------------------------------------------------------------------------- /lib/xmacro/org-jump-personal-note: -------------------------------------------------------------------------------- 1 | C-c j n 2 | -------------------------------------------------------------------------------- /lib/xmacro/org-jump-personal-todo: -------------------------------------------------------------------------------- 1 | #C-x C-f ~/org/TODO.org \n 2 | C-c j t -------------------------------------------------------------------------------- /lib/xmacro/org-jump-to-clock: -------------------------------------------------------------------------------- 1 | C-c C-x C-j 2 | --------------------------------------------------------------------------------