12 |
--------------------------------------------------------------------------------
/docs/20170317T110410--03-a-demo-of-my-day-in-emacs.org:
--------------------------------------------------------------------------------
1 | :PROPERTIES:
2 | :ID: 20170317T110410
3 | :CREATED: [2017-03-17 Fri 11:04]
4 | :END:
5 | #+title: 03 A Demo of my day in Emacs
6 | #+author: Vedang Manerikar
7 | #+email: vedang.manerikar@gmail.com
8 | #+date: [2017-03-17 Fri 11:04]
9 | #+filetags:
10 | #+identifier: 20170317T110410
11 |
12 | * Org-Mode
13 |
14 | ** Agenda
15 |
16 | ** Capture
17 |
18 | * Shell
19 |
20 | * It's All Text
21 |
22 | * Email
23 |
--------------------------------------------------------------------------------
/el-get-init-files/personal-recipes/doom-themes.rcp:
--------------------------------------------------------------------------------
1 | (:name doom-themes
2 | :website "https://github.com/hlissner/emacs-doom-themes"
3 | :description "DOOM Themes is an opinionated UI plugin and pack of themes extracted from my emacs.d, inspired by some of my favorite color themes."
4 | :depends (all-the-icons cl-lib)
5 | :load-path ("." "extensions")
6 | :type github
7 | :pkgname "hlissner/emacs-doom-themes"
8 | :features doom-themes)
9 |
--------------------------------------------------------------------------------
/snippets/org-mode/b_frame:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: b_frame
3 | # key: b_frame
4 | # --
5 | ** ${1:Frame Title}
6 | *** ${3:Image Reference Title} :B_ignoreheading:
7 | :PROPERTIES:
8 | :BEAMER_env: ignoreheading
9 | :END:
10 | #+attr_latex: :width 0.75\textwidth
11 | #+caption: ${4:FIXME: caption}
12 | [[file:${5:images/temp_img.png}]]
13 | *** Speaker Note :B_noteNH:
14 | :PROPERTIES:
15 | :BEAMER_env: noteNH
16 | :END:
17 | ${2:Speaker Text}
18 | $0
--------------------------------------------------------------------------------
/snippets/org-mode/summary:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: Meeting Summary Template
3 | # key: summary
4 | # --
5 |
6 |
7 |
8 | *** Meeting Details
9 | - Attendee Names: %^{Who is part of the discussion? |} ,Vedang
10 | - Meeting Purpose:
11 |
12 | *** Next Steps and Action Items [0/2]
13 | - [ ]
14 | - [ ]
15 |
16 | *** Key Takeaways
17 | -
18 | -
19 |
20 | *** Main Topics covered
21 | **** Topic 1
22 | Summary of discussion points around Topic 1
23 |
24 | **** Topic 2
25 | Summary of discussion points around Topic 2
26 |
27 |
--------------------------------------------------------------------------------
/snippets/org-mode/an_kafka_new_topic:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: HS: Create new topic in Kafka Prod
3 | # key: an_kafka_new_topic
4 | # --
5 | - [ ] $3
6 | #+begin_src sh :eval no
7 | /opt/kafka/kafka_2.13-2.7.0/bin/kafka-topics.sh --create --zookeeper zkcl02-01.p.helpshift.com:2181,zkcl02-02.p.helpshift.com:2181,zkcl02-03.p.helpshift.com:2181,zkcl02-04.p.helpshift.com:2181,zkcl02-05.p.helpshift.com:2181/hsft-kafka02 --partitions ${1:Number of Partitions} --replication-factor ${2:Replication Factor} --config retention.ms= --config retention.bytes=$0 --topic ${3:Topic Name}
8 | #+end_src
9 |
--------------------------------------------------------------------------------
/el-get-init-files/personal-recipes/yasnippet.rcp:
--------------------------------------------------------------------------------
1 | (:name yasnippet
2 | :website "https://github.com/capitaomorte/yasnippet.git"
3 | :description "YASnippet is a template system for Emacs."
4 | :type github
5 | :pkgname "capitaomorte/yasnippet"
6 | :compile "yasnippet.el"
7 | :depends (request cl-lib)
8 | ;; Yasnippet used to have submodules which failed to checkout
9 | ;; on Windows (see #1511), keep them disabled though there are
10 | ;; no submodules anymore. See the `yasnippet-snippets' package
11 | ;; to get the snippets which previously came with yasnippet.
12 | :submodule nil)
13 |
--------------------------------------------------------------------------------
/snippets/org-mode/microblog:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: microblog
3 | # key: microblog
4 | # --
5 |
6 | $0
7 |
8 | * Meta Information :noexport:
9 | #+begin_comment
10 | Clock the writing time against this entry.
11 | #+end_comment
12 |
13 | Posted to:
14 | - [ ] Fosstodon
15 | - [ ] Twitter
16 | - [ ] Bluesky
17 | - [ ] Linkedin
18 | - [ ] Substack Notes
19 | - [ ] Chaitimers Discord
20 | - [ ] Unravel Discord
21 | - [ ] TEO Discord
22 | - [ ] REPL Discord
23 | - [ ] Links blog
24 | - [ ] ELD Whatsapp Group
25 | - [ ] XShift Whatsapp Group
26 | - [ ] Recurse Whatsapp Group
27 | - [ ] Recurse Zulip
28 | - [ ] Clojure Slack
29 | - [ ] Nilenso Slack
30 |
--------------------------------------------------------------------------------
/snippets/org-mode/morningpage:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: The Morning Page Check-in Template
3 | # key: morningpage
4 | # --
5 |
6 | #+filetags: :truth:
7 |
8 | #+begin_comment
9 | The Morning Page checkin is "stream of consciousness" writing to empty your mind. A foolscap page has 32 ruled lines (I counted in Neha's book). Each line should contain 8 words at Max according to Pu La Deshpande. This means that 1 full page should contain 256 words. The Morning Page exercise requires you to write 3 foolscap pages worth of stream of consciousness. This means that I should be writing 768 words everyday to meet my target.
10 | #+end_comment
11 |
12 | $0
13 |
--------------------------------------------------------------------------------
/snippets/org-mode/an_change_tag:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: HS Ansible: Change a tag on a node
3 | # key: an_change_tag
4 | # --
5 | * Change the tag for node(s) ${1:$$(yas-choose-value '(tag_Name_ cl_ rl_))${2:Name}}
6 | ** Command to execute on Bastion
7 | #+begin_example
8 | ansible-playbook2 ansible2/manage_tags.yml -e "cli_cloud_provider=ec2 cli_hosts=$1 cli_tag_key=${3:Tag Key to change} cli_tag_csv=${4:Value to change to} cli_mode=override" --vault-password-file ~/.vault
9 | #+end_example
10 | ** Checklist
11 | The playbook will stop in the middle before making any tag changes and show you the diff. Review it carefully and then hit Enter, and the playbook will make the necessary change.
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | multisession/
2 | network-security.data
3 | oauth2-auto.plist
4 | org-fc-reviews.tsv
5 | persist/
6 | temp-files/
7 | *.elc
8 | *.eln
9 | *~
10 | el-get/
11 | loaddefs.el
12 | tramp
13 | personal.el
14 | common_personal.el
15 | elpa/
16 | ido.last
17 | url/
18 | projectile.cache
19 | projectile-bookmarks.eld
20 | var/
21 | eshell/
22 | helm-doc.org
23 | .git-fetch
24 | transient/
25 | tutorial/
26 | history
27 | smex-items
28 | emojis/
29 | bookmarks
30 | org-gcal/
31 | request/
32 | .recentf
33 | session*
34 | forge-database.sqlite
35 | .cask/
36 | .DS_Store
37 | parinfer-rust/
38 | eln-cache/
39 | projects
40 | tree-sitter/*.dylib
41 | rfc/
42 | snippets/org-mode/salher_student_interview
43 | .aider*
44 | .env
45 |
--------------------------------------------------------------------------------
/el-get-init-files/init-isearch+.el:
--------------------------------------------------------------------------------
1 | ;;; init-search+.el --- configuration for isearch+ and isearch-prop -*- lexical-binding: t -*-
2 | ;;; Author: Vedang Manerikar
3 | ;;; Created on: 16 Jan 2012
4 | ;;; Copyright (c) 2012, 2013 Vedang Manerikar
5 |
6 | ;; This file is not part of GNU Emacs.
7 |
8 | ;;; License:
9 |
10 | ;; This program is free software; you can redistribute it and/or
11 | ;; modify it under the terms of the Do What The Fuck You Want to
12 | ;; Public License, Version 2, which is included with this distribution.
13 | ;; See the file LICENSE.txt
14 |
15 | ;;; Code:
16 |
17 |
18 | (with-eval-after-load 'isearch
19 | (require 'isearch+))
20 |
21 |
22 | (provide 'init-search+)
23 |
--------------------------------------------------------------------------------
/el-get-init-files/init-workgroups.el:
--------------------------------------------------------------------------------
1 | ;;; init-workgroups.el --- Configuration for workgroups -*- lexical-binding: t -*-
2 | ;;; Author: Vedang Manerikar
3 | ;;; Created on: 6 Dec 2013
4 | ;;; Copyright (c) 2013 Vedang Manerikar
5 |
6 | ;; This file is not part of GNU Emacs.
7 |
8 | ;;; License:
9 |
10 | ;; This program is free software; you can redistribute it and/or
11 | ;; modify it under the terms of the Do What The Fuck You Want to
12 | ;; Public License, Version 2, which is included with this distribution.
13 | ;; See the file LICENSE.txt
14 |
15 | ;;; Code:
16 |
17 |
18 | (setq wg-morph-on nil
19 | wg-switch-on-load nil)
20 |
21 | (workgroups-mode 1)
22 | (wg-load wg-file)
23 |
24 | (provide 'init-workgroups)
25 |
26 | ;;; init-workgroups ends here
27 |
--------------------------------------------------------------------------------
/el-get-init-files/init-el-spice.el:
--------------------------------------------------------------------------------
1 | ;;; init-el-spice.el --- Configuration for El-Spice -*- lexical-binding: t -*-
2 | ;;; Author: Vedang Manerikar
3 | ;;; Created on: 27 Oct 2013
4 | ;;; Copyright (c) 2013 Vedang Manerikar
5 |
6 | ;; This file is not part of GNU Emacs.
7 |
8 | ;;; License:
9 |
10 | ;; This program is free software; you can redistribute it and/or
11 | ;; modify it under the terms of the Do What The Fuck You Want to
12 | ;; Public License, Version 2, which is included with this distribution.
13 | ;; See the file LICENSE.txt
14 |
15 | ;;; Code:
16 |
17 | (add-hook 'emacs-lisp-mode-hook 'el-spice-mode)
18 | (add-hook 'lisp-interaction-mode-hook 'el-spice-mode)
19 | (add-hook 'ielm-mode-hook 'el-spice-mode)
20 | (setq-default el-spice-lighter nil)
21 | (provide 'init-el-spice)
22 |
--------------------------------------------------------------------------------
/el-get-init-files/init-exec-path-from-shell.el:
--------------------------------------------------------------------------------
1 | ;;; init-exec-path-from-shell.el - Manage paths correctly on OSX and -*- lexical-binding: t -*-
2 | ;;; other non-conformist systems
3 | ;;; Author: Vedang Manerikar
4 | ;;; Created on: 08 Aug 2014
5 | ;;; Copyright (c) 2014 Vedang Manerikar
6 |
7 | ;; This file is not part of GNU Emacs.
8 |
9 | ;;; License:
10 |
11 | ;; This program is free software; you can redistribute it and/or
12 | ;; modify it under the terms of the Do What The Fuck You Want to
13 | ;; Public License, Version 2, which is included with this distribution.
14 | ;; See the file LICENSE.txt
15 |
16 | ;;; Code:
17 | (progn (exec-path-from-shell-initialize)
18 | (exec-path-from-shell-copy-env "PYTHONPATH")
19 | (exec-path-from-shell-copy-env "GOPATH"))
20 |
21 | (provide 'init-exec-path-from-shell)
22 |
--------------------------------------------------------------------------------
/el-get-init-files/init-es-mode.el:
--------------------------------------------------------------------------------
1 | ;;; init-es-mode.el --- Configuration for es-mode -*- lexical-binding: t -*-
2 | ;;; Commentary:
3 | ;;; Author: Vedang Manerikar
4 | ;;; Created on: 9 Jul 2016
5 | ;;; Copyright (c) 2016 Vedang Manerikar
6 |
7 | ;; This file is not part of GNU Emacs.
8 |
9 | ;;; License:
10 |
11 | ;; This program is free software; you can redistribute it and/or
12 | ;; modify it under the terms of the Do What The Fuck You Want to
13 | ;; Public License, Version 2, which is included with this distribution.
14 | ;; See the file LICENSE.txt
15 |
16 | ;;; Code:
17 |
18 | (add-to-list 'auto-mode-alist '("\\.es$" . es-mode))
19 | (setq es-always-pretty-print t)
20 | (with-eval-after-load 'es-cc
21 | (setq es-cc-endpoint "http://shiva.local:9202"))
22 |
23 | (provide 'init-es-mode)
24 | ;;; init-es-mode.el ends here
25 |
--------------------------------------------------------------------------------
/el-get-init-files/personal-recipes/plantuml-mode.rcp:
--------------------------------------------------------------------------------
1 | (:name plantuml-mode
2 | :description "Major mode for PlantUML."
3 | :type github
4 | :pkgname "skuro/plantuml-mode"
5 | ;; I'm removing the default post-init etc steps as I want the
6 | ;; executable to be in a different place.
7 | ;; :post-init
8 | ;; (let
9 | ;; ((plantuml-url "http://sourceforge.net/projects/plantuml/files/plantuml.jar/download")
10 | ;; (plantuml-jar
11 | ;; (expand-file-name "plantuml.jar" default-directory)))
12 | ;; (when
13 | ;; (not
14 | ;; (file-exists-p plantuml-jar))
15 | ;; (url-copy-file plantuml-url plantuml-jar)))
16 | ;; :prepare
17 | ;; (setq plantuml-jar-path
18 | ;; (expand-file-name "plantuml.jar" default-directory))
19 | )
20 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
2 | Version 2, December 2004
3 |
4 | Copyright (C) 2010-2014 Vedang Manerikar
5 |
6 | Everyone is permitted to copy and distribute verbatim or modified
7 | copies of this license document, and changing it is allowed as long
8 | as the name is changed.
9 |
10 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
11 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
12 |
13 | 0. You just DO WHAT THE FUCK YOU WANT TO.
14 |
15 | /* This program is free software. It comes without any warranty, to
16 | * the extent permitted by applicable law. You can redistribute it
17 | * and/or modify it under the terms of the Do What The Fuck You Want
18 | * To Public License, Version 2, as published by Sam Hocevar. See
19 | * http://sam.zoy.org/wtfpl/COPYING for more details. */
20 |
--------------------------------------------------------------------------------
/el-get-init-files/init-elpy.el:
--------------------------------------------------------------------------------
1 | ;;; init-elpy.el - Configuration for ElPy -*- lexical-binding: t -*-
2 | ;;; Author: Vedang Manerikar
3 | ;;; Created on: 28 Apr 2014
4 | ;;; Copyright (c) 2013 Vedang Manerikar
5 |
6 | ;; This file is not part of GNU Emacs.
7 |
8 | ;;; License:
9 |
10 | ;; This program is free software; you can redistribute it and/or
11 | ;; modify it under the terms of the Do What The Fuck You Want to
12 | ;; Public License, Version 2, which is included with this distribution.
13 | ;; See the file LICENSE.txt
14 |
15 | ;;; Code:
16 |
17 | (elpy-enable)
18 |
19 | (setq python-shell-interpreter "jupyter"
20 | python-shell-interpreter-args "console --simple-prompt"
21 | python-shell-prompt-detect-failure-warning nil)
22 | (add-to-list 'python-shell-completion-native-disabled-interpreters
23 | "jupyter")
24 |
25 |
26 | (provide 'init-elpy)
27 |
--------------------------------------------------------------------------------
/el-get-init-files/init-multiple-cursors.el:
--------------------------------------------------------------------------------
1 | ;;; init-multiple-cursors.el -*- lexical-binding: t -*-
2 | ;;; Author: Vedang Manerikar
3 | ;;; Created on: 08 Jan 2012
4 | ;;; Copyright (c) 2012, 2013 Vedang Manerikar
5 |
6 | ;; This file is not part of GNU Emacs.
7 |
8 | ;;; License:
9 |
10 | ;; This program is free software; you can redistribute it and/or
11 | ;; modify it under the terms of the Do What The Fuck You Want to
12 | ;; Public License, Version 2, which is included with this distribution.
13 | ;; See the file LICENSE.txt
14 |
15 | ;;; Code:
16 |
17 |
18 | (global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines)
19 | (global-set-key (kbd "C->") 'mc/mark-next-like-this)
20 | (global-set-key (kbd "C-c >") 'mc/mark-next-word-like-this)
21 | (global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
22 | (global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)
23 |
24 | (provide 'init-multiple-cursors)
25 |
--------------------------------------------------------------------------------
/el-get-init-files/personal-recipes/swiper.rcp:
--------------------------------------------------------------------------------
1 | (:name swiper
2 | :description "Gives you an overview as you search for a regex."
3 | :type github
4 | :depends (cl-lib avy)
5 | :pkgname "abo-abo/swiper"
6 | :build
7 | `(("make" ,(format "emacs=%s -L %s" el-get-emacs
8 | (concat
9 | (file-name-as-directory el-get-dir)
10 | "avy"))
11 | "compile")
12 | ;; ("makeinfo" "-o" "doc/ivy.info" "doc/ivy.texi")
13 | )
14 | :build/berkeley-unix
15 | `(("gmake" ,(format "emacs=%s -L %s" el-get-emacs
16 | (concat
17 | (file-name-as-directory el-get-dir)
18 | "avy"))
19 | "compile")
20 | ;; ("gmakeinfo" "-o" "doc/ivy.info" "doc/ivy.texi")
21 | )
22 | ;; :info "doc/ivy.info"
23 | )
24 |
--------------------------------------------------------------------------------
/snippets/org-mode/reference_note:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: A template for creating Reference Notes (books, videos)
3 | # key: reference
4 | # --
5 | * Meta Information :noexport:
6 | :PROPERTIES:
7 | :Author: ${1:Name of the Author}
8 | :URL: ${2:No URL Provided}
9 | :END:
10 |
11 | Capture information about the book here, and your thoughts about the quality of the writing. This is not a book review, it's just rough thoughts. Also use this heading for your clocking purposes.
12 |
13 | * Table of Contents :noexport:TOC_3_org:
14 | This will be autogenerated using ~toc-org~, you can ignore this heading.
15 |
16 | * Executive Summary
17 | This is where you summarize the main points of the book, on later reflection.
18 |
19 | * $0Chapter heading or Notes from the Video
20 | - List of items which look like (below). Note: the YaSnippet =rq= makes this easy.
21 |
22 | # Local Variables:
23 | # eval: (toc-org-mode 1)
24 | # End:
25 |
--------------------------------------------------------------------------------
/snippets/org-mode/fullblog:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: fullblog
3 | # key: fullblog
4 | # --
5 |
6 | #+category: $3
7 | #+options: toc:nil
8 | #+og_image: assets/images/$1.jpg
9 | #+og_description: $2
10 | # #+export_file_name: $1
11 |
12 | $0
13 |
14 | #+TOC: headlines 1
15 |
16 | * Meta Information: $1 :noexport:
17 | #+begin_comment
18 | Clock the writing time against this entry.
19 | #+end_comment
20 |
21 | ** Sketch / Outline of the post
22 |
23 | ** Announcing on social media
24 |
25 | Vedang.me website link, published at : https://vedang.me/$1/
26 |
27 | Posted to:
28 | - [ ] Fosstodon
29 | - [ ] Twitter
30 | - [ ] Bluesky
31 | - [ ] Linkedin
32 | - [ ] Substack Notes
33 | - [ ] Chaitimers Discord
34 | - [ ] Unravel Discord
35 | - [ ] TEO Discord
36 | - [ ] REPL Discord
37 | - [ ] Links blog
38 | - [ ] ELD Whatsapp Group
39 | - [ ] XShift Whatsapp Group
40 | - [ ] Recurse Whatsapp Group
41 | - [ ] Recurse Zulip
42 | - [ ] Clojure Slack
43 | - [ ] Nilenso Slack
44 |
--------------------------------------------------------------------------------
/snippets/org-mode/emotion:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: The Emotions Check-in Template
3 | # key: emotion
4 | # --
5 | `(let* ((emotions '(("grateful for" . ":gratitude:")
6 | ("happy about" . ":happiness:")
7 | ("angry about" . ":anger:")
8 | ("unhappy about" . ":unhappiness:")
9 | ("excited for" . ":excitement:")))
10 | (emotion (yas-choose-value (mapcar #'car emotions))))
11 | (setq yas-chosen-emotion emotion)
12 | "")`
13 | #+filetags: ${1:$$(cdr (assoc yas-chosen-emotion '(("grateful for" . ":gratitude:")
14 | ("happy about" . ":happiness:")
15 | ("angry about" . ":anger:")
16 | ("unhappy about" . ":unhappiness:")
17 | ("excited for" . ":excitement:"))))}
18 |
19 | I'm feeling ${1:$$(identity yas-chosen-emotion)} $0
20 |
--------------------------------------------------------------------------------
/snippets/org-mode/an_nginx:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: HS Ansible: nginx_cluster.yml Update nginx configuration
3 | # key: an_nginx
4 | # --
5 | * Update the nginx_cluster configuration
6 | ** Command to execute on Bastion
7 | #+begin_example
8 | ansible-playbook2 ansible2/nginx_cluster.yml -e 'cli_cloud_provider=ec2 cli_enable_ssl=false cli_env_tag=prod cli_hosts="cl_nginx${1:$$(yas-choose-value '(01 02))}" cli_cluster_type=nginx_haproxy_bionic cli_ec2_dc_switch=${2:$$(yas-choose-value '(n-virginia n-california beijing))}' --vault-password-file ~/.vault -t nginx_update_conf -CD
9 | #+end_example
10 | ** Checklist
11 | - Our prod nginx cluster is behind ALB and SSL offloading happens at ALB level. Our stage nginx node has public IP and not behind any LB. This is the reason we need to pass ~cli_enable_ssl=true~ for staging but not for prod. Make sure you have checked the value of the flag above.
12 | - Review the diff printed by the -CD flag to ensure that *only* the change you want to push is changing in the nginx configuration.
13 | - Run the command without -CD once you are sure
--------------------------------------------------------------------------------
/el-get-init-files/init-ledger-mode.el:
--------------------------------------------------------------------------------
1 | ;;; init-ledger-mode.el --- Configuration for Ledger Mode -*- lexical-binding: t -*-
2 | ;;; Author: Vedang Manerikar
3 | ;;; Created on: 06 July 2015
4 | ;;; Copyright (c) 2015 Vedang Manerikar
5 |
6 | ;; This file is not part of GNU Emacs.
7 |
8 | ;;; License:
9 |
10 | ;; This program is free software; you can redistribute it and/or
11 | ;; modify it under the terms of the Do What The Fuck You Want to
12 | ;; Public License, Version 2, which is included with this distribution.
13 | ;; See the file LICENSE.txt
14 |
15 | ;;; Code:
16 |
17 | (setq ledger-reconcile-default-commodity "Rs"
18 | ledger-reports
19 | '(("balablc" "gpg --no-tty -d %(ledger-file) | ledger -f - bal assets:bank liabilities:card")
20 | ("bal" "gpg --no-tty -d %(ledger-file) | ledger -f - bal")
21 | ("reg" "gpg --no-tty -d %(ledger-file) | ledger -f - reg")
22 | ("payee" "gpg --no-tty -d %(ledger-file) ledger -f - reg @%(payee)")
23 | ("account" "gpg --no-tty -d %(ledger-file) | ledger -f - reg %(account)")))
24 |
25 | (provide 'init-ledger-mode)
26 |
27 | ;;; init-ledger-mode ends here
28 |
--------------------------------------------------------------------------------
/snippets/org-mode/onepager:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: onepager
3 | # key: onepager
4 | # --
5 |
6 | #+title: $1
7 | #+date: `(format-time-string (car org-time-stamp-formats))`
8 | #+author: Vedang Manerikar
9 |
10 | * Introduction (Vision)
11 | - Purpose of this document, brief introduction to the problem and possibly solution.
12 | - Business Goal covered by this document.
13 | $0
14 |
15 | * Background (Why are we here)
16 | - Framework for understanding the system and the problem.
17 |
18 | * Details of the problem (Why do we have this problem)
19 |
20 | * Details of the possible solutions (Methods)
21 |
22 | * A clear recommended solution / first step (Methods)
23 |
24 | * Plan of action (Methods)
25 | ** One Year Roadmap
26 | | *Effort Estimate* | *Action* | *Impact* |
27 | |-------------------+----------+----------|
28 | | | | |
29 |
30 | ** Three year Roadmap
31 | | *Effort Estimate* | *Action* | *Impact* |
32 | |-------------------+----------+----------|
33 | | | | |
34 |
35 | * Risks (Obstacles)
36 |
37 | * Opportunities unblocked (Measures)
--------------------------------------------------------------------------------
/el-get-init-files/init-helm-cider.el:
--------------------------------------------------------------------------------
1 | ;;; init-helm-cider.el --- Configuration for helm Cider. -*- lexical-binding: t -*-
2 | ;;; Commentary:
3 | ;;; Author: Vedang Manerikar
4 | ;;; Created on: 24 Oct 2016
5 | ;;; Copyright (c) 2013, 2014, 2015, 2016 Vedang Manerikar
6 |
7 | ;; This file is not part of GNU Emacs.
8 |
9 | ;;; License:
10 |
11 | ;; This program is free software; you can redistribute it and/or
12 | ;; modify it under the terms of the Do What The Fuck You Want to
13 | ;; Public License, Version 2, which is included with this distribution.
14 | ;; See the file LICENSE.txt
15 |
16 | ;;; Code:
17 |
18 |
19 | (with-eval-after-load 'cider-mode
20 | (helm-cider-mode 1)
21 | (setq helm-cider-apropos-actions
22 | '(("Find definition" lambda
23 | (candidate)
24 | (cider-find-var nil candidate))
25 | ("CiderDoc" . cider-doc-lookup)
26 | ("lookup-on-clojuredocs" . cider-clojuredocs-lookup)))
27 | ;; define keys for apropos that follow helm conventions
28 | (define-key cider-mode-map (kbd "C-x c d n") 'cider-browse-ns)
29 | (define-key cider-mode-map (kbd "C-x c d a") 'cider-apropos)
30 | (define-key cider-mode-map (kbd "C-x c d e") 'cider-apropos-documentation))
31 |
32 | (provide 'init-helm-cider)
33 | ;;; init-helm-cider ends here
34 |
--------------------------------------------------------------------------------
/snippets/org-mode/weekly_report:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: weekly_report
3 | # key: weekrpt
4 | # --
5 | *** ${1:$(ts-format "End of Week %W: %F %a" (car (this-week-range (string-to-number yas-text))))} -- ${1:$(ts-format "%F %a" (cdr (this-week-range (string-to-number yas-text))))} :checkin:weekly:
6 | Week Number: ${1:`(string-to-number (ts-format "%W" (car (this-week-range))))`}
7 | ${1:$(ts-format "<%F %a>" (car (this-week-range (string-to-number yas-text))))}--${1:$(ts-format "<%F %a>" (cdr (this-week-range (string-to-number yas-text))))}
8 |
9 | **** Work done in this week:
10 | #+BEGIN: clocktable :scope agenda :maxlevel 6 :block ${1:$(ts-format "%Y" (car (this-week-range (string-to-number yas-text))))}-W${1:$(ts-format "%W" (car (this-week-range (string-to-number yas-text))))} :emphasize nil :fileskip0 t :match "-noclockreport" :hidefiles nil :tags t :link t :tcolumns 2$0
11 | #+END:
12 |
13 | **** Weekly Update:
14 | - [ ] Review the work done to see what was accomplished.
15 | - [ ] Review the Agenda to see what was planned, but not met.
16 | - [ ] Review notes to identify planned work for the next week.
17 | - [ ] Capture updated plans and tasks in Agenda.
18 |
19 | ***** What was accomplished in the week
20 |
21 | ***** Interesting interactions and takeaways
22 |
23 | ***** What was planned but not met
24 |
25 | ***** What is planned for the next week
26 |
27 | ***** Questions / Blockers / Action Items
28 |
--------------------------------------------------------------------------------
/el-get-init-files/init-ibuffer-vc.el:
--------------------------------------------------------------------------------
1 | ;;; init-ibuffer-vc.el - Configuration for ibuffer-vc mode -*- lexical-binding: t -*-
2 | ;;; Author: Vedang Manerikar
3 | ;;; Created on: 21 Oct 2013
4 | ;;; Copyright (c) 2013 Vedang Manerikar
5 |
6 | ;; This file is not part of GNU Emacs.
7 |
8 | ;;; License:
9 |
10 | ;; This program is free software; you can redistribute it and/or
11 | ;; modify it under the terms of the Do What The Fuck You Want to
12 | ;; Public License, Version 2, which is included with this distribution.
13 | ;; See the file LICENSE.txt
14 |
15 | ;;; Code:;;;
16 |
17 |
18 | (autoload 'ibuffer-vc-set-filter-groups-by-vc-root "ibuffer-vc"
19 | "Set ibuffer filter roots by vc root" t)
20 |
21 |
22 | (with-eval-after-load 'ibuffer
23 | (require 'ibuffer-vc)
24 | (setq ibuffer-default-sorting-mode 'major-mode
25 | ibuffer-always-show-last-buffer t)
26 | (define-key ibuffer-mode-map (kbd "C-c C-z")
27 | 'ibuffer-vc-set-filter-groups-by-vc-root)
28 | (setq ibuffer-formats
29 | '((mark modified read-only vc-status-mini " "
30 | (name 18 18 :left :elide)
31 | " "
32 | (size 9 -1 :right)
33 | " "
34 | (mode 16 16 :left :elide)
35 | " "
36 | (vc-status 16 16 :left)
37 | " "
38 | filename-and-process))))
39 |
40 |
41 | (provide 'init-ibuffer-vc)
42 |
--------------------------------------------------------------------------------
/el-get-init-files/init-flycheck-clj-kondo.el:
--------------------------------------------------------------------------------
1 | ;;; init-flycheck-clj-kondo.el --- Configuration for clj-kondo checkers -*- lexical-binding: t -*-
2 | ;;; Commentary:
3 | ;;; Author: Vedang Manerikar
4 | ;;; Created on: 8th Oct 2019
5 | ;;; Copyright (c) 2019 Vedang Manerikar
6 |
7 | ;; This file is not part of GNU Emacs.
8 |
9 | ;;; License:
10 |
11 | ;; This program is free software; you can redistribute it and/or
12 | ;; modify it under the terms of the Do What The Fuck You Want to
13 | ;; Public License, Version 2, which is included with this distribution.
14 | ;; See the file LICENSE.txt
15 |
16 | ;;; Code:
17 |
18 | ;; This ensures that the clj-kondo checkers are the first ones in the
19 | ;; `flycheck-checkers` list. This is needed to make the chain work. To
20 | ;; create the chain, also add the following code:
21 |
22 | (with-eval-after-load 'flycheck-joker
23 | (progn
24 | (dolist (checker '(clj-kondo-clj clj-kondo-cljs clj-kondo-cljc clj-kondo-edn))
25 | (setq flycheck-checkers
26 | (cons checker (delq checker flycheck-checkers))))
27 |
28 | (dolist (checkers '((clj-kondo-clj . clojure-joker)
29 | (clj-kondo-cljs . clojurescript-joker)
30 | (clj-kondo-cljc . clojure-joker)
31 | (clj-kondo-edn . edn-joker)))
32 | (flycheck-add-next-checker (car checkers) (cons 'error (cdr checkers))))))
33 |
34 | ;;; init-flycheck-clj-kondo.el ends here
35 |
--------------------------------------------------------------------------------
/snippets/org-mode/an_prov:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: HS Ansible: Spawn New Nodes for a Cluster in Virginia
3 | # key: an_prov
4 | # --
5 | * Add a new node for Cluster ${1:Service Name}
6 | ** Command to execute on Bastion
7 | #+begin_example
8 | ansible-playbook2 ansible2/spawn_service_nodes.yml -e 'cli_cloud_provider=ec2 cli_env_tag=preprod ${2:$$(yas-choose-value '(cli_tag cli_sha))}=${3:Tag or SHA value to deploy} cli_service=$1 cli_cluster_size=${4:500} cli_ec2_dc_switch=${5:$$(yas-choose-value '(n-virginia n-california beijing))} cli_count=${6:1}' --vault-password-file ~/.vault -CD -vv
9 | #+end_example
10 | ** Checklist post command execution
11 | SSH into the new node and check the following: (Note: If you cannot see the node name, run a ~refresh_inventory~ command.
12 | - [ ] Is haproxy config correctly set?
13 | #+begin_example
14 | less /etc/haproxy/haproxy.cfg
15 | #+end_example
16 | - [ ] Are the environment variables correctly set for $1 (Note that sometimes the service name as provided in command is not the same as the service name ~ dashes tend to be converted to underscores)
17 | #+begin_example
18 | less /etc/default/$1
19 | #+end_example
20 | - [ ] Review logs (above step will give you log location) to make sure that the service is working correctly.
21 | - [ ] Telnet all the host+ports that $1 needs to ensure that it has access. The haproxy config will give you all the details of the services it needs. You can also see this information in ~sudo hatop -s /run/haproxy_op.soc~ .
--------------------------------------------------------------------------------
/docs/20181101T111110--04-emacs-and-clojure.org:
--------------------------------------------------------------------------------
1 | #+title: 04 Emacs and Clojure
2 | #+author: Vedang Manerikar
3 | #+email: vedang.manerikar@gmail.com
4 | #+date: [2018-11-01 Thu 11:11]
5 | #+identifier: 20181101T111110
6 |
7 | * Basic Emacs Operations
8 |
9 | - C-x C-f :: Opens a file for editing. (~find-file~)
10 | - C-x C-s :: Saves changes to disk. (~save-buffer~)
11 | - C-x C-c :: Exits Emacs. (~save-buffers-kill-terminal~)
12 | - C-x k :: Close a file. (~kill-buffer~)
13 |
14 | * Basic Clojure Operations
15 |
16 | - C-c M-c :: Connect to a Clojure Repl. (~cider-connect-clj~)
17 | - C-c C-z :: Switch to the Repl from inside a clj file (and vice-versa). (~cider-switch-to-repl-buffer~)
18 | - M-. :: Jump to the definition of the symbol that the cursor is on. (~cider-find-var~)
19 | - C-c C-c :: Compile the function that you are working in (in a clj file). (~cider-eval-defun-at-point~)
20 |
21 | * Namespace related operations
22 |
23 | - C-c C-k :: Compile the entire namespace. (~cider-load-buffer~)
24 | - C-c M-n M-n :: Switch to the namespace on the REPL. (~cider-repl-set-ns~)
25 |
26 | * Test related operations
27 |
28 | - C-c C-t C-n :: Run all the tests in this namespace. (~cider-test-run-ns-tests~)
29 |
30 | * TODO [3/10] Add sections explaining how to do the following things
31 |
32 | - [X] paredit
33 | - [X] jumping (Emacs)
34 | - [X] searching in project / directory
35 | - [ ] find-usages
36 | - [ ] rename-symbols
37 | - [ ] import / require
38 | - [ ] clean namespaces
39 | - [ ] linting
40 | - [ ] debugging
41 |
--------------------------------------------------------------------------------
/el-get-init-files/init-clj-refactor.el:
--------------------------------------------------------------------------------
1 | ;;; init-clj-refactor.el --- Magic refactoring for Clojure. -*- lexical-binding: t -*-
2 | ;;; Commentary:
3 | ;;; Author: Vedang Manerikar
4 | ;;; Created on: 27 Oct 2013
5 | ;;; Copyright (c) 2013 Vedang Manerikar
6 |
7 | ;; This file is not part of GNU Emacs.
8 |
9 | ;;; License:
10 |
11 | ;; This program is free software; you can redistribute it and/or
12 | ;; modify it under the terms of the Do What The Fuck You Want to
13 | ;; Public License, Version 2, which is included with this distribution.
14 | ;; See the file LICENSE.txt
15 |
16 | ;;; Code:
17 |
18 | (defun turn-on-clj-refactor ()
19 | "Helper function to add to `clojure-mode-hook'."
20 | (clj-refactor-mode 1)
21 | (cljr-add-keybindings-with-prefix "C-c m"))
22 |
23 | (setq cljr-favor-prefix-notation nil ; don't mess up namespaces on cleanup
24 | ;; build asts on starup
25 | cljr-eagerly-build-asts-on-startup t
26 | cljr-warn-on-eval nil
27 | ;; don't stop on analyzer failures. examples: not finding a
28 | ;; data-reader.
29 | cljr-ignore-analyzer-errors t
30 | ;; Don't magically add stuff to the namespace requires form
31 | ;; (because for big projects this operation is slow) it's easier
32 | ;; to do this by hand (=add-missing= operation) after you've
33 | ;; typed out what you wanted to.
34 | cljr-magic-requires nil)
35 |
36 | (with-eval-after-load 'clojure-mode
37 | (add-hook 'clojure-mode-hook 'turn-on-clj-refactor))
38 |
39 |
40 | (provide 'init-clj-refactor)
41 | ;;; init-clj-refactor.el ends here
42 |
--------------------------------------------------------------------------------
/site-lisp/init-ido.el:
--------------------------------------------------------------------------------
1 | ;;; init-ido.el --- Configuration for ido mode -*- lexical-binding: t -*-
2 | ;;; Commentary:
3 | ;;; Author: Vedang Manerikar
4 | ;;; Created on: 18 Oct 2013
5 | ;;; Copyright (c) 2013 Vedang Manerikar
6 |
7 | ;; This file is not part of GNU Emacs.
8 |
9 | ;;; License:
10 |
11 | ;; This program is free software; you can redistribute it and/or
12 | ;; modify it under the terms of the Do What The Fuck You Want to
13 | ;; Public License, Version 2, which is included with this distribution.
14 | ;; See the file LICENSE.txt
15 |
16 | ;;; Code:
17 |
18 |
19 | (require 'ido-completing-read+)
20 |
21 | (defun ido-config ()
22 | "Function encapsulating all ido configuration that I'm not running (in favor of helm)."
23 | (ido-mode 'both)
24 | (ido-everywhere)
25 | (ido-ubiquitous-mode 1))
26 |
27 | (setq ido-enable-flex-matching t
28 | ido-create-new-buffer 'always
29 | ido-use-filename-at-point 'guess
30 | ido-use-virtual-buffers t)
31 |
32 |
33 | (add-hook 'ido-make-buffer-list-hook 'ido-summary-buffers-to-end)
34 |
35 | ;;; My old and excellent IDO completion hack. keeping it around for
36 | ;;; reference.
37 | ;; (defadvice completing-read
38 | ;; (around ido-steroids activate)
39 | ;; "ido on steroids :D from EmacsWiki"
40 | ;; (if (boundp 'ido-cur-list)
41 | ;; ad-do-it
42 | ;; (setq ad-return-value
43 | ;; (ido-completing-read
44 | ;; prompt
45 | ;; (all-completions "" collection predicate)
46 | ;; nil require-match initial-input hist def))))
47 |
48 |
49 | (provide 'init-ido)
50 | ;;; init-ido.el ends here
51 |
--------------------------------------------------------------------------------
/early-init.el:
--------------------------------------------------------------------------------
1 | ;;; early-init.el --- The first bits of initialization -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2021 Vedang Manerikar
4 |
5 | ;; Author: Vedang Manerikar
6 | ;; Keywords: convenience
7 |
8 | ;; This program is free software; you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 |
23 | ;; Emacs 27.1 introduced early-init.el, which is run before init.el, before
24 | ;; package and UI initialization happens, and before site files are loaded.
25 |
26 | ;;; Code:
27 |
28 | ;; A big contributor to startup times is garbage collection. We up the gc
29 | ;; threshold to temporarily prevent it from running, then reset it later by
30 | ;; enabling `gcmh-mode'. Not resetting it will cause stuttering/freezes.
31 |
32 | (setq gc-cons-threshold most-positive-fixnum)
33 | (setq load-prefer-newer t)
34 |
35 | ;;; No GUI
36 | (dolist (mode '(menu-bar-mode tool-bar-mode scroll-bar-mode))
37 | (when (fboundp mode) (funcall mode -1)))
38 |
39 | (setq package-enable-at-startup nil)
40 |
41 | (provide 'early-init)
42 | ;;; early-init.el ends here
43 |
--------------------------------------------------------------------------------
/snippets/org-mode/proposal:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: proposal
3 | # key: proposal
4 | # --
5 |
6 | #+title: "Proposal: ${1:Name of the project}"
7 | #+author: Unravel.tech
8 | #+date: `(format-time-string "[%Y-%m-%d %a]")`
9 |
10 | ** 1. Name of the Project, and Duration
11 | - Name: $1
12 | - Duration: $2
13 |
14 | ** 2. Approach for $1
15 |
16 | 1. What we will build, overview:
17 |
18 | 2. System components, architecture:
19 |
20 | 3. Technologies:
21 |
22 | ** 3. Deliverables
23 |
24 | The milestone delivery schedule (as mutually agreed between the Parties) for the Services shall be as follows:
25 |
26 | | Milestone Number | Brief Description of Deliverable(s) | Due Date of Deliverables |
27 | |------------------+-------------------------------------+--------------------------|
28 | | <25> | <25> | <10> |
29 | | 1 | (Code and Demo) | Week 2 |
30 | | 2 | (Code and Demo) | Week 3 |
31 | | 3 | (Code and Demo) | Week 4 |
32 |
33 | For all Deliverables, we will provide:
34 | - Detailed technical documentation
35 | - Deployment guidelines and procedures
36 | - System architecture documentation
37 |
38 | Note: We will not provide:
39 |
40 | ** 4. Fees:
41 | As complete and final payment for performance of Services by Service Provider to Client, Client shall pay to Service Provider as under:
42 |
43 | 1. Advance Fees: $xxxxx USD
44 | 2. Milestone Fees: $xxxxx USD ($xxxxx per completed milestone)
45 | 3. Total Fees: $xxxxx USD
46 | 4. Tooling and Infrastructure charges: To be submitted as Invoices, payable by Client
47 |
--------------------------------------------------------------------------------
/snippets/org-mode/tocprt:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: Prerequisite Tree
3 | # key: tocprt
4 | # --
5 |
6 | * PRT: ${1:Prerequisite Tree Title} :prt:
7 | - Date and Time: `(ts-format "<%Y-%m-%d %a %H:%M>" (ts-now))`
8 | - Thinking Process: Necessary Condition
9 | - Starting Point: Major objectives and the obstacles to overcoming them
10 | - End Result: Milestones that overcome all obstacles
11 | - Orientation: Bottom to Top,
12 | - Bias: Top
13 | - Entity Junctor: Fuzzy AND
14 | - Default Junctor: Fuzzy OR
15 | - Entities used in the PRT: Objective, Overcome, Milestone
16 | $0
17 | ** Step 1: Identify the Objective
18 | Often, the wording of the objective is drawn from an injection you used in creating a FRT.
19 |
20 | ** Step 2: Identify obstacles to Overcome
21 | Create a set of Overcome entities that represent the nonexistent necessary conditions for achieving your Objective. The point here is not to list everything you will need to do to achieve your Objectives, but to identify the things you still lack. Connect each Overcome entity as a predecessor of your Objective.
22 |
23 | ** Step 3: Brainstorm milestones
24 | Brainstorm one or more Milestone entities that will negate the obstacles. Be creative: go around, over, under, the obstacle.
25 |
26 | ** Step 4: Continue to deepen the tree
27 | What are obstacles to implementing your milestones? Identify them and continue to create new Overcome and Milestone entites. Do this until you reach milestones that do not have any significant obstacles.
28 |
29 | ** Step 5: Read and Verify the Tree
30 | Apply the [[brain:86DECB26-DCC2-4314-90F9-6507A18B5388][Categories of Legitimate Reservation]] and clean up the tree.
31 |
32 | ** Step 6: Trim and finalize the tree
33 | Place the rejected milestones in a collapsed group.
34 |
--------------------------------------------------------------------------------
/snippets/org-mode/am_onepager:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: am_onepager
3 | # key: am1p
4 | # --
5 |
6 | #+title: ${1:Project Name}
7 | #+description: ${2:one-line description}
8 | #+date: `(format-time-string (car org-time-stamp-formats))`
9 | #+author: Vedang Manerikar
10 | #+comment: Shared by Arindham Mukherjee on LinkedIn
11 |
12 | * Problem Alignment:
13 | $0
14 | Write in 4-5 sentences. Readers should be able to read this and understand the value and communicate their thoughts around risks.
15 |
16 | - What is the problem?
17 | - Who is facing the problem?
18 | - What is the business value that will be unlocked by solving the problem?
19 | - How will the target users benefit if the problem is solved?
20 | - Why is it urgent to solve this problem now?
21 |
22 | * Goals:
23 | Describe the high level goals and ideally in priority order.
24 | - List out the measurable metrics here
25 | - Why are these metrics important
26 |
27 | * Non-Goals:
28 | List out areas that you don’t plan to address. Define the scope clearly.
29 |
30 | * Solution Alignment:
31 | Describe briefly the approach you will be taking. Reading this should give the reader an understanding of the possible solution directions and enable you to solicit feedback on the chosen direction.
32 | - *Hypothesis*: If we , then leading to positive metrics Z. Include guesses for size of the win on specific metrics, using learnings from past experiments/launches.
33 | - *User Flow diagram*: Include a high level sketch of the user flow/system diagram which helps to understand the solution direction.
34 |
35 | * Next Steps:
36 | - Outline the next actionable steps, if there’s alignment with the stakeholders
37 | - What are the resource requirements?
38 | - What would the rough timelines for the next steps look like?
39 |
--------------------------------------------------------------------------------
/enhance/extra-hooks.el:
--------------------------------------------------------------------------------
1 | ;;; extra-hooks.el --- functions that hook into stuff for the greater good. -*- lexical-binding: t -*-
2 | ;;; Author: Vedang Manerikar
3 | ;;; Created on: 13 Oct 2013
4 | ;;; Copyright (c) 2013 -- 2021 Vedang Manerikar
5 | ;;; Commentary:
6 | ;; No commentary at this point in time.
7 |
8 | ;; This file is not part of GNU Emacs.
9 |
10 | ;;; License:
11 |
12 | ;; This program is free software; you can redistribute it and/or
13 | ;; modify it under the terms of the Do What The Fuck You Want to
14 | ;; Public License, Version 2, which is included with this distribution.
15 | ;; See the file LICENSE.txt
16 |
17 | ;;; Code:
18 |
19 |
20 | (defun eh/prog-mode-settings ()
21 | "special settings for programming modes."
22 | (when (memq major-mode vedang/programming-major-modes)
23 | (flyspell-prog-mode) ;; Flyspell mode for comments and strings
24 | (when (not (equal major-mode 'objc-mode))
25 | (uf/turn-on-whitespace-mode)) ;; tell me if lines exceed 80 columns
26 | ))
27 | (add-hook 'find-file-hook 'eh/prog-mode-settings)
28 |
29 |
30 | ;; Indentation hook for C/C++ mode
31 | ;; As defined in Documentation/CodingStyle
32 | (defun eh/linux-c-indent ()
33 | "adjusted defaults for C/C++ mode use with the Linux kernel."
34 | (interactive)
35 | (setq tab-width 8)
36 | (setq indent-tabs-mode nil) ;; force spaces, to work with dumber editors
37 | (setq c-basic-offset 8))
38 |
39 | (defun eh/knr () (c-set-style "K&R"))
40 |
41 | (add-hook 'c-mode-hook 'eh/linux-c-indent)
42 | (add-hook 'c-mode-hook 'eh/knr)
43 | (add-hook 'c++-mode-hook 'eh/linux-c-indent)
44 |
45 |
46 | (defun eh/server-edit ()
47 | "Close emacsclient buffers using C-x k"
48 | (when (current-local-map)
49 | (use-local-map (copy-keymap (current-local-map))))
50 | (when server-buffer-clients
51 | (local-set-key (kbd "C-x k") 'server-edit)))
52 | (add-hook 'server-switch-hook 'eh/server-edit)
53 |
54 |
55 | (provide 'extra-hooks)
56 |
--------------------------------------------------------------------------------
/snippets/org-mode/tocfrt:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: Future Reality Tree
3 | # key: tocfrt
4 | # --
5 |
6 | * FRT: ${1:Future Reality Tree Title} :frt:
7 | - Date and Time: `(ts-format "<%Y-%m-%d %a %H:%M>" (ts-now))`
8 | - Thinking Process: Sufficient Cause
9 | - Starting Point: Start with a proposed solution (injection), and build upwards to a set of Desirable Effects.
10 | - End Result: Necessary changes that implement the solution and avoid new problems
11 | - Entities used in FRT: Undesirable Effect, Desirable Effect, Intermediate Effect, Precondition, Action. Solution class is used for the initial injections.
12 | - Orientation: Bottom to Top
13 | - Bias: Top
14 | - Entity Junctor: Fuzzy OR
15 | - Default Junctor: Fuzzy AND
16 | $0
17 | ** Step 1: State the proposed solution and desired effects
18 | ** Step 2: Add other elements already developed
19 | - Do you have preconditions already identified in the CRT? If so, bring them over.
20 | - Same for Common Objective from EC
21 |
22 | ** Step 3: Fill in the gaps
23 | Add entites that represent the direct, inevitable consequences (DE, UDE, IE) of the proposed solutions. Use the [[brain:86DECB26-DCC2-4314-90F9-6507A18B5388][Categories of Legitimate Reservation]] to check and add to your causal connections
24 |
25 | ** Step 4: Read and verify the tree
26 | Remember that FRT uses Sufficient Cause thinking, so the way to read it is "If cause A then effect B"
27 |
28 | ** Step 5: Build in Positive Reinforcement Loops
29 | Look for Desirable Effects that may intensify effects lower in the tree that lead back to one or more Desirable Effects.
30 |
31 | ** Step 6: Seek and address the negative branches
32 | This is a critical step, you have to make sure that all the UDE are mitigated. There are two ways to deal with Negative Branches: Reactive and Proactive. Reactive: let the UDE occur and then inject new action entities that mitigate the problem. Proactive: find an alternative injection to achieve the next stage of IE that are on path to our DE, without causing the UDE.
33 |
--------------------------------------------------------------------------------
/snippets/org-mode/toctrt:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: Transition Tree
3 | # key: toctrt
4 | # --
5 |
6 | * TRT: ${1:Transition Tree Title} :trt:
7 | - Date and Time: `(ts-format "<%Y-%m-%d %a %H:%M>" (ts-now))`
8 | - Thinking Process: Sufficient Cause
9 | - Starting Point: A set of goals
10 | - End Result: Detailed actions to achieve the goals
11 | - The Transition Tree (TRT) is an effective tool for creating an execution plan that creates a transition from the current reality to a future reality.
12 | - Orientation: Bottom to Top
13 | - Bias: Top
14 | - Entity Junctor: Fuzzy OR
15 | - Default Junctor: Fuzzy AND
16 | - Entities used in the TRT: Goal, Precondition, Intermediate Effect, Action. Desirable Effect and Undesirable Effect, when more effects than just the Goal show up.
17 | $0
18 | ** Step 1: Identify the Goal
19 | A TRT generally contains a single Goal entity (can contain more than one if the Goals are related). The Goal should be a clear, present-tense statement of the desired reality. The Goal can be taken from one of the injections in the FRT or from one of the Objectives of the PRT.
20 |
21 | ** Step 2: Identify the Intermediate Effects
22 | For example, these are the set of Milestone entites from your PRT
23 |
24 | ** Step 3: Define a complete step
25 | A complete step is:
26 | 1. The outcome you want to achieve (Milestone or Intermediate Effect. Or Goal)
27 | 2. A statement of the current reality. (a Precondition, or an Intermediate Effect / Milestone that was the outcome of a previous step)
28 | 3. An Action (something within your control, with clear criteria for determining that it has been carried out successfully)
29 |
30 | The Precondition and Action must logically combine as necessary and sufficient causes to achieve the outcome.
31 |
32 | ** Step 4: Continue Building the Tree
33 |
34 | ** Step 5: Seek and Address the Negative Branches
35 | A complete plan will terminate only with Goals and Desirable Effects
36 |
37 | ** Step 6: Read and Verify the Tree
38 | Check if the flow of the tree makes sense with the Confidence Spinners
39 |
--------------------------------------------------------------------------------
/el-get-init-files/init-go-mode.el:
--------------------------------------------------------------------------------
1 | ;;; init-go-mode.el --- configuration for go-mode -*- lexical-binding: t -*-
2 | ;;; Author: Vedang Manerikar
3 | ;;; Created on: 8 Aug 2014
4 | ;;; Copyright (c) 2014 Vedang Manerikar
5 |
6 | ;; This file is not part of GNU Emacs.
7 |
8 | ;;; Commentary:
9 |
10 | ;;; License:
11 |
12 | ;; This program is free software; you can redistribute it and/or
13 | ;; modify it under the terms of the Do What The Fuck You Want to
14 | ;; Public License, Version 2, which is included with this distribution.
15 | ;; See the file LICENSE.txt
16 |
17 | ;;; Code:
18 |
19 | (with-eval-after-load 'go-mode
20 | (add-hook 'before-save-hook 'gofmt-before-save)
21 |
22 | ;; Add functions to jump back. This will be merged into
23 | ;; go-mode master soon hopefully.
24 | (defvar godef--marker-list nil)
25 |
26 | (defun godef-jump (point &optional other-window)
27 | "Jump to the definition of the expression at POINT."
28 | (interactive "d")
29 | (condition-case nil
30 | (let ((file (car (godef--call point))))
31 | (if (not (godef--successful-p file))
32 | (message "%s" (godef--error file))
33 | (push (point-marker) godef--marker-list)
34 | (ring-insert find-tag-marker-ring (point-marker))
35 | (godef--find-file-line-column file other-window)))
36 | (file-error (message "Could not run godef binary"))))
37 |
38 | (defun godef-jump-back ()
39 | "Pop back to where `godef-jump' was last invoked"
40 | (interactive)
41 | (when (null godef--marker-list)
42 | (error "Marker list is empty. Can't pop back"))
43 | (let ((marker (pop godef--marker-list)))
44 | (switch-to-buffer (or (marker-buffer marker)
45 | (error "Buffer has been deleted")))
46 | (goto-char (marker-position marker))
47 | ;; Cleanup the marker so as to avoid them piling up.
48 | (set-marker marker nil nil)))
49 |
50 | (define-key go-mode-map (kbd "M-.") 'godef-jump)
51 | (define-key go-mode-map (kbd "M-,") 'godef-jump-back))
52 |
53 |
54 | (provide 'init-go-mode)
55 |
--------------------------------------------------------------------------------
/snippets/org-mode/hsperfreview:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: hsperfreview
3 | # key: hsperfreview
4 | # --
5 | #+title: ${1:First Name} ${2:Last Name}'s Performance review for the period ${3:Q2, 2020 -- Q3, 2020}
6 | #+date: `(current-time-string)`
7 | * Manager's Review
8 | - Manager: ${4:Full Name}
9 | - Candidate: $1 $2
10 | - Current Role: $5
11 | - Performance Rating: $6
12 | - Potential Next Role: $7
13 | - Timeline to the next promotion: $8
14 |
15 | ** What did $1 do well? (Accomplishments)
16 | - List of Concrete Accomplishments over $3
17 | These should be significant accomplishments
18 | - Peer feedback
19 | Praise. Refer to Officevibe, Small Improvements, Slack etc. Try and keep it relevant to list of accomplishments (and significant).
20 |
21 | *** What does $1 do best?
22 | Describe their biggest strength and how they can improve further on it.
23 | $0
24 | *** High level feedback (Summary) for $1
25 | Short para setting up a story arc of how far the person has come, sentence or two of how they did in this cycle, end on a high-level overview of what is next.
26 |
27 | ** What can $1 improve on?
28 | What is *most* holding $1 back from the next level? Use the levels document for guidance. What is the opinion of other managers?
29 |
30 | *** Area 1
31 | Should contain:
32 | + Concrete examples and peer feedback
33 | + Concrete suggestions
34 |
35 | **** What fully achieving this looks like:
36 | Add concrete examples of how $1 can perform at "fully exceeding expectations" in this area. This is inspirational stuff and should focus on leveraging $1's strengths to deliver a superb performance / making this area a strong strength.
37 |
38 | *** Area 2
39 | Should contain:
40 | + Concrete examples and peer feedback
41 | + Concrete suggestions
42 |
43 | **** What fully achieving this looks like:
44 | Add concrete examples of how $1 can perform at "fully exceeding expectations" in this area. This is inspirational stuff and should focus on leveraging $1's strengths to deliver a superb performance / making this area a strong strength.
45 |
46 | * $1 $2's Self Review
47 | - Author: $1 $2
48 | - Performance Rating:
49 | ** What did I do well?
50 | ** What can I improve on?
51 |
52 | * Follow up between $4 and $1 $2
53 | - Action Items on $1 $2:
54 | - Action Items on $4:
--------------------------------------------------------------------------------
/el-get-init-files/init-paredit.el:
--------------------------------------------------------------------------------
1 | ;;; init-paredit.el --- Paredit goodness everywhere -*- lexical-binding: t -*-
2 | ;;; Commentary:
3 | ;;; Author: Vedang Manerikar
4 | ;;; Created on: 01 Apr 2014
5 | ;;; Copyright (c) 2013, 2014 Vedang Manerikar
6 |
7 | ;; This file is not part of GNU Emacs.
8 |
9 | ;;; License:
10 |
11 | ;; This program is free software; you can redistribute it and/or
12 | ;; modify it under the terms of the Do What The Fuck You Want to
13 | ;; Public License, Version 2, which is included with this distribution.
14 | ;; See the file LICENSE.txt
15 |
16 | ;;; Code:
17 |
18 |
19 | (defvar paredit-major-modes
20 | '(emacs-lisp-mode lisp-mode clojure-mode cider-repl-mode
21 | scheme-mode ielm-mode es-mode)
22 | "List of modes where I want paredit to always work.")
23 |
24 | ;;; hideshow.el does not have anything to do with paredit, but I want
25 | ;;; the minor-mode to be loaded in exactly the same places as paredit.
26 | ;;; Hence adding the coniguration here.
27 |
28 | (load-library "hideshow")
29 | (require 'hideshow)
30 | (load-library "paren")
31 | (require 'paren)
32 | (require 'paredit)
33 |
34 | (defun turn-on-paredit ()
35 | "Utility function to turn on Paredit."
36 | (paredit-mode 1)
37 | (show-paren-mode 1)
38 | (hs-minor-mode 1))
39 |
40 | (setq show-paren-style 'mixed)
41 |
42 | (dolist (m paredit-major-modes)
43 | (add-hook `,(intern (concat (symbol-name m) "-hook")) 'turn-on-paredit))
44 |
45 | (with-eval-after-load 'paredit
46 | (define-key paredit-mode-map (kbd "C-o") 'paredit-open-round)
47 | ;; Unbind `M-s' because it's bound to some handy occur related
48 | ;; functions by default
49 | (define-key paredit-mode-map (kbd "M-s") nil)
50 | ;; Unbind `M-?' because `xref-find-references` uses it.
51 | (define-key paredit-mode-map (kbd "M-?") nil)
52 | (define-key paredit-mode-map (kbd "M-D") 'paredit-splice-sexp)
53 | (define-key paredit-mode-map (kbd "C-A-d") 'paredit-forward-down)
54 | (define-key paredit-mode-map (kbd "C-A-u") 'paredit-backward-up))
55 |
56 | (with-eval-after-load 'hideshow
57 | ;; Unbind `C-h' this should only be used for help.
58 | (define-key hs-minor-mode-map (kbd "C-c @ C-h") nil)
59 | (define-key hs-minor-mode-map (kbd "C-c @ @") 'hs-toggle-hiding)
60 | (define-key hs-minor-mode-map (kbd "C-c @ 2") 'hs-toggle-hiding))
61 |
62 | (provide 'init-paredit)
63 | ;;; init-paredit.el ends here
64 |
--------------------------------------------------------------------------------
/snippets/org-mode/weekly_intentions:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: weekly_intentions
3 | # key: weekint
4 | # --
5 | *** ${1:$(ts-format "Start of Week %W: %F %a" (car (this-week-range (string-to-number yas-text))))} -- ${1:$(ts-format "%F %a" (cdr (this-week-range (string-to-number yas-text))))} :checkin:weekly:
6 | Week Number: ${1:`(string-to-number (ts-format "%W" (car (this-week-range))))`}
7 | ${1:$(ts-format "<%F %a>" (car (this-week-range (string-to-number yas-text))))}--${1:$(ts-format "<%F %a>" (cdr (this-week-range (string-to-number yas-text))))}
8 | $0
9 | Review:
10 | + [ ] Last Week's progress (Weekly Report)
11 | - Reflect and celebrate my achievements in the last week!
12 | - Did you actually do what you had planned in last week's Weekly Intentions?
13 | + [ ] Yearly Goals
14 | + [ ] Monthly Goals
15 | + [ ] 31-day challenge
16 |
17 | Stacking your Habits
18 | #+begin_comment
19 | + eg: Meditation cushion right next to the morning bathroom
20 | + What visible cue will remind me to stretch and meditate?
21 | + What visible cue will get me to wake up for deep work?
22 | #+end_comment
23 |
24 | **** What goals do I need to achieve by the end of the week?
25 |
26 | #+begin_comment
27 | - Setup smart goals for the end of this week
28 | - Create tasks to track these goals
29 | #+end_comment
30 | Goals I need to achieve by ${1:$(ts-format "<%F %a>" (cdr (this-week-range (string-to-number yas-text))))}:
31 |
32 | **** What are the important events I need to attend this week? (and why)
33 |
34 | **** What is one external stimulus that is likely to trigger you?
35 |
36 | Remember to center yourself before responding to this trigger
37 |
38 | **** What concrete, straightforward things can I fall back on during the week
39 |
40 | This is a list of good to do tasks if I get too frustrated or stuck on my current project
41 |
42 | 1. (tutorials, reading a paper, etc)
43 |
44 | **** Minimize regrets.
45 | #+begin_comment
46 | This section comes from great advise captured here: [[denote:20240629T192741::#h:6749B557-03BD-4A63-BF7B-D99B3CC3E372][Luca Dellanna on Twitter: Minimizing regret in life]]
47 | #+end_comment
48 |
49 | How does the current week fit into my long-term planning?
50 | #+begin_comment
51 | – Do something that makes sense if I die next month
52 | – Do something that makes sense if I live until 60
53 | – Do something that makes sense if I live until 100
54 | – None of the above which compromises the other time horizons
55 | #+end_comment
56 |
--------------------------------------------------------------------------------
/enhance/extra-bindings.el:
--------------------------------------------------------------------------------
1 | ;;; extra-bindings.el --- convenience bindings for various things. -*- lexical-binding: t -*-
2 | ;;; Author: Vedang Manerikar
3 | ;;; Created on: 13 Oct 2013
4 | ;;; Copyright (c) 2013 -- 2021 Vedang Manerikar
5 | ;;; Commentary:
6 | ;; No commentary at the moment
7 |
8 | ;; This file is not part of GNU Emacs.
9 |
10 | ;;; License:
11 |
12 | ;; This program is free software; you can redistribute it and/or
13 | ;; modify it under the terms of the Do What The Fuck You Want to
14 | ;; Public License, Version 2, which is included with this distribution.
15 | ;; See the file LICENSE.txt
16 |
17 | ;;; Code:
18 |
19 | (require 'utility-functions)
20 | (global-set-key (kbd "C-w") 'uf/backward-kill-word-or-kill-region)
21 | (global-set-key (kbd "C-M-y") #'uf/reverse-transpose-sexps)
22 | (global-set-key (kbd "C-x M-s") 'uf/transpose-windows)
23 |
24 | (global-set-key (kbd "A-q") 'uf/unfill-paragraph)
25 |
26 | (require 'presenting)
27 | (global-set-key (kbd "") 'pr/jump-to-prev-slide)
28 | (global-set-key (kbd "") 'pr/jump-to-next-slide)
29 |
30 | ;; Custom 'apropos' key bindings
31 | ;; http://www.masteringemacs.org/articles/2011/08/04/full-text-searching-info-mode-apropos/#comment-1409
32 | (global-set-key (kbd "C-h a") 'Apropos-Prefix)
33 | (define-prefix-command 'Apropos-Prefix nil "Apropos (a,d,f,i,l,v,C-v)")
34 | (define-key Apropos-Prefix (kbd "a") 'apropos)
35 | (define-key Apropos-Prefix (kbd "d") 'apropos-documentation)
36 | (define-key Apropos-Prefix (kbd "f") 'apropos-command)
37 | (define-key Apropos-Prefix (kbd "c") 'apropos-command)
38 | (define-key Apropos-Prefix (kbd "i") 'info-apropos)
39 | (define-key Apropos-Prefix (kbd "l") 'apropos-library)
40 | (define-key Apropos-Prefix (kbd "v") 'apropos-variable)
41 | (define-key Apropos-Prefix (kbd "C-v") 'apropos-value)
42 |
43 |
44 | ;; Stop IELM from being stupid
45 | (with-eval-after-load 'ielm
46 | (define-key ielm-map (kbd "C-j") 'newline-and-indent))
47 |
48 | ;; Keybindings for notmuch
49 | (global-set-key (kbd "") 'notmuch)
50 |
51 | ;;; Use ~C-c C-o~ as binding for `goto-address-at-point' to mimic
52 | ;;; org-mode behaviour for opening links.
53 | (with-eval-after-load 'goto-addr
54 | (define-key goto-address-highlight-keymap (kbd "C-c C-o")
55 | 'goto-address-at-point))
56 |
57 | (with-eval-after-load 'shr
58 | (define-key shr-map (kbd "C-c C-o") 'shr-browse-url))
59 |
60 | (provide 'extra-bindings)
61 |
--------------------------------------------------------------------------------
/enhance/osx.el:
--------------------------------------------------------------------------------
1 | ;;; osx.el --- emacs configuration for OS X -*- lexical-binding: t -*-
2 | ;;; Author: Vedang Manerikar
3 | ;;; Created on: 12 Jul 2012
4 | ;;; Copyright (c) 2012, 2013 Vedang Manerikar
5 |
6 | ;; This file is not part of GNU Emacs.
7 |
8 | ;;; License:
9 |
10 | ;; This program is free software; you can redistribute it and/or
11 | ;; modify it under the terms of the Do What The Fuck You Want to
12 | ;; Public License, Version 2, which is included with this distribution.
13 | ;; See the file LICENSE.txt
14 |
15 | ;;; Code:
16 |
17 |
18 | (defun copy-from-osx ()
19 | "Make cut and paste work with the OS X clipboard"
20 | (shell-command-to-string "pbpaste"))
21 |
22 | (defun paste-to-osx (text &optional push)
23 | "Make cut and paste work with the OS X clipboard"
24 | (let ((process-connection-type nil))
25 | (let ((proc (start-process "pbcopy" "*Messages*" "pbcopy")))
26 | (process-send-string proc text)
27 | (process-send-eof proc))))
28 |
29 |
30 | (setq mac-command-modifier 'meta
31 | mac-option-modifier 'alt
32 | interprogram-cut-function 'paste-to-osx
33 | interprogram-paste-function 'copy-from-osx
34 | ;; Work around a bug on OS X where system-name is a fully
35 | ;; qualified domain name
36 | system-name (car (split-string system-name "\\."))
37 | initial-frame-alist '((top . 0) (left . 0) (width . 155) (height . 45))
38 | frame-title-format "%b"
39 | icon-title-format "%b"
40 | ;; Binaries
41 | magit-git-executable (or (executable-find "git") "/usr/local/bin/git")
42 | vc-git-program (or (executable-find "git") "/usr/local/bin/git")
43 | ispell-program-name (or (executable-find "aspell") "/usr/local/bin/aspell")
44 | ispell-local-dictionary "british"
45 | epg-gpg-program (or (executable-find "gpg") "/usr/local/bin/gpg")
46 | ;; source dirs
47 | ;; Note: These are hard-coded to my machine.
48 | source-directory (expand-file-name "~/src/emacs/src/")
49 | find-function-C-source-directory (expand-file-name "~/src/emacs/src/"))
50 |
51 |
52 | ;; full screen toggle, will only work if emacs is installed from
53 | ;; source, and the source is patched with this patch:
54 | ;; https://gist.github.com/scotchi/7209145/
55 | (when (fboundp 'toggle-frame-fullscreen)
56 | (global-set-key (kbd "") 'toggle-frame-fullscreen))
57 |
58 | ;;; Bind `frame.el' commands for easier access
59 | (global-set-key (kbd "A-`") 'other-frame)
60 |
61 | (provide 'osx)
62 |
--------------------------------------------------------------------------------
/snippets/org-mode/tocec:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: Evaporating Cloud
3 | # key: tocec
4 | # --
5 | * EC: ${1:Evaporating Cloud Title} :ec:
6 | - Date and Time: `(ts-format "<%Y-%m-%d %a %H:%M>" (ts-now))`
7 | - Thinking Process: Necessary Condition
8 | - Starting Point: A perceived conflict underlying a constraint
9 | - End Result: Possible win-win situations
10 | - Entities that are part of the EC: Want, Need, Common Objective, Conflict, Solution
11 | - EC are used to find solutions that "evaporate" a conflict.
12 | + A conflict is defined as two mutually exclusive wants.
13 | - Clouds are read from left to right, against the flow of the edges, using the pattern:
14 | + In order to *satisfy the need* we must *obtain our want* because *of our assumptions*.
15 | - Remember that EC is just a tool for brainstorming a new set of options. Solidifying the solutions is the job of the FRT.
16 | $0
17 | ** Step 1: Identify the Wants
18 | ** Step 2: Identify the Conflict
19 | Make sure to set the weight on one of the edges to Negative. This accurately reflects the mutually exclusive nature of the two wants.
20 | ** Step 3: Identify the underlying Needs
21 | Remember that Needs are conditions which are necessary to fulfil to meet the Common Objective. Wants are actions we are taking to meet the Need.
22 | ** Step 4: Identify the Common Objective
23 | There has to be a Common Objective that both sides agree on. There can be no conflict resolution without a common objective.
24 | ** Step 5: Ensure Clarity by reading the diagram
25 | ** Step 6: Identify and Validate Assumptions
26 | Finding erroneous assumptions is the key to breaking the conflict. Assumptions hide underneath the Want -> Need edges, Need -> Objective edges and in the Conflict itself -- why we believe we cannot have both Wants simultaneously.
27 |
28 | Write the assumptions as edge annotations. Write down all the valid assumptions that you can think of. Start each assumption with "Because ..."
29 | ** Step 7: Propose Solutions
30 | Eliminate Assumptions:
31 | - Eliminating all assumptions on an edge eliminates the necessary condition relationship between two of the entities.
32 | - Eliminating all assumptions on the Conflict entity eliminates the perception of conflict itself.
33 |
34 | In either of the above cases, the cloud has "evaporated", there is no conflict. If the cloud is still intact, we need to inject a Solution into it.
35 |
36 | Questions:
37 | - How can we satisfy Need without obtaining Want?
38 | - How can we accomplish Common Objective without satisfying Need?
39 | - How can we obtain both First Want as well as Second Want?
40 |
--------------------------------------------------------------------------------
/enhance/presenting.el:
--------------------------------------------------------------------------------
1 | ;;; presenting.el --- tools for a simple text-based presentation through -*- lexical-binding: t -*-
2 | ;;; Emacs.
3 | ;;; Author: Vedang Manerikar
4 | ;;; Created on: 13 Oct 2013
5 | ;;; Copyright (c) 2013 Vedang Manerikar
6 |
7 | ;; This file is not part of GNU Emacs.
8 |
9 | ;;; License:
10 |
11 | ;; This program is free software; you can redistribute it and/or
12 | ;; modify it under the terms of the Do What The Fuck You Want to
13 | ;; Public License, Version 2, which is included with this distribution.
14 | ;; See the file LICENSE.txt
15 |
16 | ;; Usage:
17 |
18 | ;; Each slide should be a seperate file in a single folder. The file
19 | ;; names should be 1-Title.whatever, 2-Hello.txt and so on. Start in
20 | ;; any file and use the functions `pr/jump-to-next-slide',
21 | ;; `pr/jump-to-prev-slide' as needed.
22 |
23 | ;;; Code:
24 |
25 |
26 | (defun incs (s &optional num)
27 | (number-to-string (+ (or num 1) (string-to-number s))))
28 |
29 | (defun decs (s &optional num)
30 | (number-to-string (- (string-to-number s) (or num 1))))
31 |
32 |
33 | (defun pr/jump-to-next-slide ()
34 | "Jump to the next slide of the presentation"
35 | (interactive)
36 | (condition-case ex
37 | (find-file (car (file-expand-wildcards (concat
38 | (unhandled-file-name-directory (buffer-file-name))
39 | (incs (car (split-string (file-name-nondirectory (buffer-file-name))
40 | "-")))
41 | "-*"))))
42 | ('error (progn
43 | (message "Rewinding...")
44 | (find-file (car (file-expand-wildcards (concat
45 | (unhandled-file-name-directory (buffer-file-name))
46 | "1-*"))))))))
47 |
48 |
49 | (defun pr/jump-to-prev-slide ()
50 | "Jump to the previous slide of the presentation"
51 | (interactive)
52 | (condition-case ex
53 | (find-file (car (file-expand-wildcards (concat
54 | (unhandled-file-name-directory (buffer-file-name))
55 | (decs (car (split-string (file-name-nondirectory (buffer-file-name))
56 | "-")))
57 | "-*"))))
58 | ('error (message "You've reached the beginning of the presentation"))))
59 |
60 |
61 | (provide 'presenting)
62 |
--------------------------------------------------------------------------------
/snippets/org-mode/toccrt:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: Current Reality Tree
3 | # key: toccrt
4 | # --
5 |
6 | * CRT: ${1:Current Reality Tree Title} :crt:
7 | - Date and Time: `(ts-format "<%Y-%m-%d %a %H:%M>" (ts-now))`
8 | - Thinking Process: Sufficient Cause
9 | - Starting Point: A set of undesirable symptoms
10 | - End Result: The core cause of the symptoms (the constraint)
11 | - Entities that are part of the CRT: Undesirable Effect, Precondition, Intermediate Effect.
12 | - CRTs are used to pinpoint problems.
13 | - Orientation: Bottom to Top
14 | - Bias: Top
15 | - Entity Junctor: Fuzzy OR
16 | - Default Junctor: Fuzzy AND
17 | $0
18 | ** Step 1: Understand the scope of the CRT you are building
19 | - What is your system's goal?
20 | - What are the necessary conditions for knowing that your goal is being achieved?
21 | - What measures do you use to know how well the necessary conditions of the goal are being met?
22 | - Where do the boundaries of your system lie?
23 | - What greater system is your system a part of?
24 | - What systems does your system interact with?
25 | - What are your system's inputs and outputs?
26 |
27 | ** Step 2: List the symptoms (un-desirable effects) that you are seeing right now
28 | Give each UDE a simple present-tense title that is intended to be clear to any stakeholder.
29 |
30 | ** Step 3: Connect the Symptoms that are directly or indirectly related to others already in your list
31 | Do not be too concerned about direct / indirect at this stage. We will add other entities to the picture as we grow the tree.
32 |
33 | ** Step 4: Apply the Categories of Legitimate Reservation of your rough diagram
34 | This process will help you add additional entities and causal relationships to your diagram, helping you create a true picture of the situation.
35 |
36 | ** Step 5: Continue adding underlying causes for the effects in your diagram
37 | ** Step 6: Consider Negative Reinforcing Loops in your diagram
38 | Are any of your UDEs aggravating the UDEs at a lower level
39 | ** Step 7: Identify Root Causes: Entities with no predecessors
40 | Note: Preconditions are by definition out of your control.
41 |
42 | Question:
43 | - Have you uncovered the deepest causes over which you have some control or influence?
44 | - Are your root preconditions actually intermediate effects with other underlying causes?
45 | ** Step 8: Trim the tree and remove unrelated entity clusters
46 | ** Step 9: Identify the core driver constraint
47 | If you identify a root cause such that eliminating it causes a chain reaction of other problems being eliminated, then you have arrived at your core constraint.
48 |
49 | Questions for classifying root cause into core driver:
50 | - How many UDEs do they cause?
51 | - How severe are the UDEs they cause?
52 | - How much control or influence do you have other them?
53 |
--------------------------------------------------------------------------------
/site-lisp/init-flyspell.el:
--------------------------------------------------------------------------------
1 | ;;; init-flyspell.el --- Configuration for flyspell -*- lexical-binding: t -*-
2 | ;;; Commentary:
3 | ;;; Author: Vedang Manerikar
4 | ;;; Created on: 16 Jan 2012
5 | ;;; Copyright (c) 2013 Vedang Manerikar
6 |
7 | ;; This file is not part of GNU Emacs.
8 |
9 | ;;; License:
10 |
11 | ;; This program is free software; you can redistribute it and/or
12 | ;; modify it under the terms of the Do What The Fuck You Want to
13 | ;; Public License, Version 2, which is included with this distribution.
14 | ;; See the file LICENSE.txt
15 |
16 | ;;; Code:
17 |
18 | (require 'flyspell)
19 |
20 | ;; move point to previous error
21 | ;; based on code by hatschipuh at
22 | ;; http://emacs.stackexchange.com/a/14912/2017
23 | (defun flyspell-goto-previous-error (arg)
24 | "Go to ARG previous spelling error."
25 | (interactive "p")
26 | (while (not (= 0 arg))
27 | (let ((pos (point))
28 | (min (point-min)))
29 | (if (and (eq (current-buffer) flyspell-old-buffer-error)
30 | (eq pos flyspell-old-pos-error))
31 | (progn
32 | (if (= flyspell-old-pos-error min)
33 | ;; goto beginning of buffer
34 | (progn
35 | (message "Restarting from end of buffer")
36 | (goto-char (point-max)))
37 | (backward-word 1))
38 | (setq pos (point))))
39 | ;; seek the next error
40 | (while (and (> pos min)
41 | (let ((ovs (overlays-at pos))
42 | (r '()))
43 | (while (and (not r) (consp ovs))
44 | (if (flyspell-overlay-p (car ovs))
45 | (setq r t)
46 | (setq ovs (cdr ovs))))
47 | (not r)))
48 | (backward-word 1)
49 | (setq pos (point)))
50 | ;; save the current location for next invocation
51 | (setq arg (1- arg))
52 | (setq flyspell-old-pos-error pos)
53 | (setq flyspell-old-buffer-error (current-buffer))
54 | (goto-char pos)
55 | (if (= pos min)
56 | (progn
57 | (message "No more miss-spelled word!")
58 | (setq arg 0))
59 | (forward-word)))))
60 |
61 | (setq flyspell-issue-welcome-flag nil)
62 |
63 | ;;; Handy key for jumping to the last spelling error.
64 | (define-key flyspell-mode-map (kbd "C-,") #'flyspell-goto-previous-error)
65 | ;; I want this for `iedit-mode', so unsetting it here and replacing it
66 | (define-key flyspell-mode-map (kbd "C-;") nil)
67 | (define-key flyspell-mode-map (kbd "C-:") #'flyspell-auto-correct-previous-word)
68 |
69 | (add-hook 'text-mode-hook 'turn-on-flyspell)
70 | (add-hook 'fundamental-mode-hook 'turn-on-flyspell)
71 |
72 | (provide 'init-flyspell)
73 | ;;; init-flyspell.el ends here
74 |
--------------------------------------------------------------------------------
/el-get-init-files/init-cider.el:
--------------------------------------------------------------------------------
1 | ;;; init-cider.el --- Configuration for Cider. -*- lexical-binding: t -*-
2 | ;;; Commentary:
3 | ;;; Author: Vedang Manerikar
4 | ;;; Created on: 27 Oct 2013
5 | ;;; Copyright (c) 2013 Vedang Manerikar
6 |
7 | ;; This file is not part of GNU Emacs.
8 |
9 | ;;; License:
10 |
11 | ;; This program is free software; you can redistribute it and/or
12 | ;; modify it under the terms of the Do What The Fuck You Want to
13 | ;; Public License, Version 2, which is included with this distribution.
14 | ;; See the file LICENSE.txt
15 |
16 | ;;; Code:
17 |
18 | (defun cider-repl-prompt-on-newline (ns)
19 | "Return a prompt string with newline.
20 | NS is the namespace information passed into the function by cider."
21 | (concat ns ">\n"))
22 |
23 | (defun vineet/cider-load-open-buffers ()
24 | "Load all open clojure buffers in the project."
25 | (interactive)
26 | (dolist (buf (project-root (project-current t)))
27 | (let ((buf-file-path (buffer-file-name buf)))
28 | (when (and buf-file-path
29 | (string= (file-name-extension buf-file-path) "clj")
30 | (not (string= (file-name-nondirectory buf-file-path)
31 | "project.clj")))
32 | (cider-load-buffer buf)))))
33 |
34 | (with-eval-after-load 'cider-mode
35 | (add-hook 'cider-mode-hook 'eldoc-mode)
36 | (define-key cider-mode-map (kbd "C-c z") 'cider-selector)
37 | (setq cider-repl-history-size most-positive-fixnum
38 | cider-repl-wrap-history t
39 | cider-repl-prompt-function 'cider-repl-prompt-on-newline
40 | cider-repl-use-pretty-printing nil
41 | nrepl-buffer-name-separator "-"
42 | nrepl-buffer-name-show-port t
43 | nrepl-log-messages t
44 | cider-mode-line nil
45 | cider-annotate-completion-candidates t
46 | cider-completion-annotations-include-ns 'always
47 | cider-show-error-buffer 'always
48 | cider-prompt-for-symbol nil
49 | cider-auto-jump-to-error 'errors-only
50 | cider-apropos-actions
51 | '(("find-def" . cider--find-var)
52 | ("display-doc" . cider-doc-lookup)
53 | ("lookup-on-clojuredocs" . cider-clojuredocs-lookup))))
54 |
55 | (with-eval-after-load 'cider-repl
56 | (add-hook 'cider-repl-mode-hook 'subword-mode)
57 | (define-key cider-repl-mode-map (kbd "C-M-q") 'prog-indent-sexp)
58 | (define-key cider-repl-mode-map (kbd "C-c M-o") 'cider-repl-clear-buffer))
59 |
60 | (defun clerk-show ()
61 | "Show the current-file using Clerk."
62 | (interactive)
63 | (when-let ((filename (buffer-file-name)))
64 | (save-buffer)
65 | (cider-interactive-eval
66 | (concat "(nextjournal.clerk/show! \"" filename "\")"))))
67 |
68 | (with-eval-after-load 'clojure-mode
69 | (define-key clojure-mode-map (kbd "") 'clerk-show))
70 |
71 | (provide 'init-cider)
72 | ;;; init-cider ends here
73 |
--------------------------------------------------------------------------------
/site-lisp/init-isearch.el:
--------------------------------------------------------------------------------
1 | ;;; init-isearch.el --- Configuring built-in isearch the way I like it -*- lexical-binding: t -*-
2 | ;;; Author: Vedang Manerikar
3 | ;;; Created on: 16 Jan 2012
4 | ;;; Copyright (c) 2013 Vedang Manerikar
5 |
6 | ;; This file is not part of GNU Emacs.
7 |
8 | ;;; License:
9 |
10 | ;; This program is free software; you can redistribute it and/or
11 | ;; modify it under the terms of the Do What The Fuck You Want to
12 | ;; Public License, Version 2, which is included with this distribution.
13 | ;; See the file LICENSE.txt
14 |
15 | ;;; Commentary:
16 | ;; From EmacsWiki
17 | ;; Move to beginning of word before yanking word in isearch-mode.
18 | ;; Make C-s C-w and C-r C-w act like Vim's g* and g#, keeping Emacs'
19 | ;; C-s C-w [C-w] [C-w]... behaviour.
20 |
21 | ;;; Code:
22 |
23 | (require 'thingatpt)
24 |
25 | (defun is/subst-isearch-yank-word-or-char (&optional use-default?)
26 | "Activate my customized Isearch word yank command. or
27 | vice-versa. depending on the `use-default?' arg."
28 | (if use-default?
29 | (substitute-key-definition 'is/isearch-yank-word-or-char-from-beginning
30 | 'isearch-yank-word-or-char
31 | isearch-mode-map)
32 | (substitute-key-definition 'isearch-yank-word-or-char
33 | 'is/isearch-yank-word-or-char-from-beginning
34 | isearch-mode-map)))
35 |
36 | (defun is/isearch-yank-word-or-char-from-beginning (&optional arg)
37 | "Move to beginning of word before yanking word in isearch-mode."
38 | (interactive)
39 | ;; Making this work after a search string is entered by user
40 | ;; is too hard to do, so work only when search string is empty.
41 | (if (= 0 (length isearch-string))
42 | (beginning-of-thing 'word))
43 | (isearch-yank-word-or-char)
44 | ;; Revert to 'isearch-yank-word-or-char for subsequent calls
45 | (is/subst-isearch-yank-word-or-char t))
46 |
47 | ;; (add-hook 'isearch-mode-hook 'is/subst-isearch-yank-word-or-char)
48 |
49 | (defun is/activate-occur ()
50 | (interactive)
51 | (let ((case-fold-search isearch-case-fold-search))
52 | (occur (if isearch-regexp
53 | isearch-string
54 | (regexp-quote isearch-string)))))
55 |
56 | ;; Activate occur easily inside isearch
57 | (with-eval-after-load 'helm-occur
58 | (define-key isearch-mode-map (kbd "C-o")
59 | 'helm-occur-from-isearch))
60 |
61 | ;; Use regex searches by default.
62 | (global-set-key (kbd "C-s") 'isearch-forward-regexp)
63 | (global-set-key (kbd "C-r") 'isearch-backward-regexp)
64 | (global-set-key (kbd "C-M-s") 'isearch-forward)
65 | (global-set-key (kbd "C-M-r") 'isearch-backward)
66 |
67 | (setq-default isearch-lazy-count t ; Show total count when searching
68 | isearch-yank-on-move t ; copy char into search on moving
69 | )
70 | ;; Yanking Tips and Tricks
71 | ;; C-M-y : Yank one char at a time
72 | ;; C-M-z : Yank upto given char
73 | ;; M-s C-e: Yank to the end of the line
74 |
75 | (provide 'init-isearch)
76 |
--------------------------------------------------------------------------------
/snippets/org-mode/selfreview:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: selfreview
3 | # key: selfreview
4 | # --
5 |
6 | * TODO Self Performance Review, ${1:Your Name}, for the period ${2:Q2, 2020 -- Q3, 2020} :childless:
7 | - Date: `(current-time-string)`
8 | - Current Role: $3
9 | - Performance Rating: ${4:Give yourself an appropriate self-rating. Go slightly higher than how you think you did, but not ridiculously higher.}
10 | - Potential Next Role: ${5:What is the next step on the ladder / pendulum?}
11 | - Timeline to the next promotion: ${6:When do you see this happening?}
12 |
13 | $0** TODO [#A] Write a performance review for myself, $2 :important:
14 | SCHEDULED: `(ts-format "<%Y-%m-%d %a>" (ts-now))` DEADLINE: `(ts-format "<%Y-%m-%d %a>" (ts-adjust 'day +7 (ts-now)))`
15 |
16 | This task tracks when my performance review should be completed by, and shows up at the top of my agenda to remind me to work on it.
17 | *** TODO Review and capture details from 1:1 meeting notes
18 | *** TODO Review and capture details from status updates
19 | *** TODO Review and capture details from personal notes
20 | *** TODO Review the engineering levels document
21 |
22 | ** Rough Notes: Things that I have accomplished, $2
23 |
24 | This is an unsorted list of things that I have done in the last six months. It is built by looking at all my status updates and all the feedback I have captured in 1:1 meetings and peer interactions. This is the rough material I will use to write my performance review. Once I have this list, I will sort the items into themes and impact and fill out my performance review above. Once that is complete, I will rewrite / copy the content into whatever format the current review system needs.
25 |
26 | ** $1's Performance Review, $2
27 | This is where I write the actual performance review, which is then exported / reformatted for the appropriate HR tool.
28 |
29 | *** What were my goals for the 6 months?
30 |
31 | *** What projects did I work on?
32 | Organize so that high impact work comes first. Make sure to highlight who the stakeholders were and what the impact of the project was for the company. How did the stakeholders benefit? For each project:
33 |
34 | **** What was my contribution to the project?
35 |
36 | **** What was the result of the project?
37 | (Only if enough time has passed and results are observable)
38 |
39 | **** What are the lessons learnt from this project?
40 | What could have gone better?
41 |
42 | *** How did I improve the performance of / mentor my team?
43 | Capture initiatives run for improving the performance of the team, any challenging situations that were faced and what the course of action was in those situations. The definition of team here is loose. This also encompasses any cross-team efforts or org-wide efforts at improving process / outcomes.
44 |
45 | **** What initiatives have not panned out / could not be completed / did not get enough attention?
46 | Why? Do I have a plan to change that?
47 |
48 | *** How have I grown personally?
49 |
50 | **** What new things did I learn?
51 | Is the knowledge useful / applicable to others and did I take efforts to propagate that knowledge? How?
52 |
53 | **** What areas have I not made progress on, but should have?
54 | These are things I know I should do, or I want to do, but I don't make time for. Why?
55 |
--------------------------------------------------------------------------------
/site-lisp/init-ibuffer.el:
--------------------------------------------------------------------------------
1 | ;;; init-ibuffer.el --- Configuration for ibuffer -*- lexical-binding: t -*-
2 | ;;; Author: Vedang Manerikar
3 | ;;; Created on: 16 Jan 2012
4 | ;;; Copyright (c) 2013 Vedang Manerikar
5 |
6 | ;; This file is not part of GNU Emacs.
7 |
8 | ;;; License:
9 |
10 | ;; This program is free software; you can redistribute it and/or
11 | ;; modify it under the terms of the Do What The Fuck You Want to
12 | ;; Public License, Version 2, which is included with this distribution.
13 | ;; See the file LICENSE.txt
14 |
15 | ;;; Code:
16 |
17 |
18 | (autoload 'ibuffer "ibuffer" "List buffers." t)
19 |
20 |
21 | (defun ii/turn-on-ibuffer ()
22 | (interactive)
23 | (ibuffer)
24 | (ibuffer-switch-to-saved-filter-groups "default"))
25 |
26 | (global-set-key (kbd "C-x C-b") 'ii/turn-on-ibuffer)
27 |
28 |
29 | (setq ibuffer-saved-filter-groups
30 | (quote (("default"
31 | ("Shell"
32 | (or (mode . shell-mode)
33 | (mode . sh-mode)
34 | (mode . conf-space-mode)
35 | (mode . Man-mode)
36 | (mode . dired-mode)
37 | (mode . bat-mode)
38 | (mode . vterm-mode)))
39 | ("Programming"
40 | (or
41 | (mode . c-mode)
42 | (mode . c++-mode)
43 | (mode . dockerfile-mode)
44 | (mode . erlang-mode)
45 | (mode . perl-mode)
46 | (mode . python-mode)
47 | (mode . emacs-lisp-mode)
48 | (mode . clojure-mode)
49 | (mode . clojurescript-mode)
50 | (mode . clojurec-mode)
51 | (mode . nrepl-repl-mode)
52 | (mode . cider-stacktrace-mode)
53 | (name . "cider-repl")
54 | (mode . inferior-emacs-lisp-mode)
55 | (mode . go-mode)
56 | (mode . objc-mode)
57 | (mode . mhtml-mode)
58 | (mode . css-mode)
59 | (mode . scss-mode)
60 | (mode . java-mode)
61 | (mode . rjsx-mode)
62 | (mode . makefile-gmake-mode)
63 | (mode . makefile-bsdmake-mode)
64 | (mode . sql-interactive-mode)
65 | (mode . sql-mode)
66 | (mode . yaml-mode)))
67 | ("Writing"
68 | (or
69 | (mode . org-mode)
70 | (derived-mode . org-mode)
71 | (mode . org-agenda-mode)
72 | (mode . org-brain-visualize-mode)
73 | (mode . markdown-mode)
74 | (mode . notmuch-message-mode)
75 | (mode . LaTeX-mode)
76 | (mode . fundamental-mode)
77 | (mode . text-mode)
78 | (mode . pdf-view-mode)))
79 | ("Magit"
80 | (or
81 | (derived-mode . magit-mode)
82 | (name . "magit")))
83 | ("Helm"
84 | (mode . helm-major-mode))
85 | ("IRC"
86 | (mode . rcirc-mode))))))
87 |
88 |
89 | (provide 'init-ibuffer)
90 | ;;; init-ibuffer ends here
91 |
--------------------------------------------------------------------------------
/snippets/org-mode/hsproject:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: hsproject
3 | # key: hsproject
4 | # This is the developer version of tracking a hsproject
5 | # --
6 | * TODO $1 [[${2:$$(yas-choose-value '(fdn: jira:))}${3:Ticket Number}]] :childless:
7 | :PROPERTIES:
8 | :ORDERED: t
9 | :END:
10 | - Goal:
11 | - Project Page:
12 | - Advanced Roadmap:
13 | ** TODO Create a goal, project page and roadmap for $1.
14 | ** TODO Identify all the User Stories for $1
15 | - Note: User stories need to be built with all stakeholders and should have an ACK from all stakeholders.
16 | - Work should start in parallel while specs are under discussion, but scope cannot be frozen until the User Stories for the release are frozen
17 | ** TODO Create a Business Outcomes page for $1
18 | ** TODO Create a User Story Map for $1
19 | - [ ] Identify the MVP release.
20 | - [ ] Work with devs + focus group to estimate story points for tasks in $1 devspec
21 | ** TODO Create a Rough Plan for $1
22 | - [ ] The rough plan should be an end-to-end plan of ballpark estimates for all work (as we see it now). The aim is to clarify the amount of work and the points at which we will see business outcomes.
23 | ** TODO Identify involvement of other teams for $1
24 | - Integration, Dev / Testing work.
25 | - Think about change in contracts and regression testing.
26 | + Do we need manual testing or will automated test suites cover everything?
27 | - Think about dependencies on other teams: What order of modules makes collaboration easy and unblock other teams fastest? List all teams in a checklist here and check them off to ensure you have not missed anything:
28 | + [ ] Team 1
29 | ** TODO Communicate contract freeze dates for $1
30 | - Think about contracts with teams identified above. List all teams in a checklist here and check them off to ensure you have not missed anything:
31 | + [ ] Contract freeze date with Team 1
32 | ** TODO Communicate that $1 contract is frozen and ask for ACK.
33 | ** TODO Contract mocks are ready for $1
34 | ** TODO Fill out pre-dev Plat Review for $1
35 | ** TODO Share the link for the $1 devspec
36 | - With the team and with all engineers across teams working on this project.
37 | ** TODO Share the link for the $1 qaspec
38 | - With the team and with all engineers across teams working on this project.
39 | ** TODO Communicate start of integration testing dates $1
40 | Think about contracts with all impacted teams. List all teams in a checklist here and check them off to ensure you have not missed anything:
41 | - [ ] Team 1 Integration testing
42 | ** TODO [0/5] Communicate final dates for $1 with team and EM/PM
43 | - [ ] Dev Complete date
44 | - [ ] Cross-team Integration Testing date
45 | - [ ] Dev Sandbox date
46 | - [ ] Test Complete date
47 | - [ ] Product Sandbox date
48 | ** TODO Dev is complete for $1, ask for Ack
49 | ** TODO Fill out post-dev Plat Review for $1
50 | ** TODO Cross team Integration testing is complete for $1, ask for ACK
51 | ** TODO Benchmarking / Perf testing is complete for $1, ask for ACK
52 | ** TODO Dev Sandbox is ready for $1, share details
53 | ** TODO Dev Testing on Sandbox is done for $1
54 | ** TODO Polished Sandbox is ready for $1, ask for ACK
55 | ** TODO Share the release checklist for $1, ask for ACK
56 | ** TODO Share the DEP and CM tickets for $1, ask for ACK
57 | ** $1 Misc Tasks and Notes
58 | $0
59 |
--------------------------------------------------------------------------------
/site-lisp/init-rcirc.el:
--------------------------------------------------------------------------------
1 | ;;; init-rcirc.el --- Configuration for RCIRC -*- lexical-binding: t -*-
2 | ;;; Author: Vedang Manerikar
3 | ;;; Created on: 04 Mar 2012
4 | ;;; Copyright (c) 2012, 2013 Vedang Manerikar
5 |
6 | ;; This file is not part of GNU Emacs.
7 |
8 | ;;; License:
9 |
10 | ;; This program is free software; you can redistribute it and/or
11 | ;; modify it under the terms of the Do What The Fuck You Want to
12 | ;; Public License, Version 2, which is included with this distribution.
13 | ;; See the file LICENSE.txt
14 |
15 | ;;; Code:
16 |
17 |
18 | ;; Set these variables as per your personal requirement:
19 | ;; `rcirc-default-nick', `rcirc-default-user-name' `rcirc-default-full-name'
20 | ;; `rcirc-keywords' `rcirc-server-alist'
21 | (setq rcirc-debug-flag t
22 | rcirc-log-flag t
23 | rcirc-time-format "%Y-%m-%d %H:%M ")
24 |
25 |
26 | ;; Don't print /away messages.
27 | ;; This does not require rcirc to be loaded already,
28 | ;; since rcirc doesn't define a 301 handler (yet).
29 | (defun rcirc-handler-301 (process cmd sender args)
30 | "/away message handler.")
31 |
32 |
33 | ;; Turn on spell checking.
34 | (add-hook 'rcirc-mode-hook 'turn-on-flyspell)
35 |
36 |
37 | ;; Keep input line at bottom.
38 | (add-hook 'rcirc-mode-hook
39 | (lambda ()
40 | (set (make-local-variable 'scroll-conservatively)
41 | 8192)))
42 |
43 |
44 | ;; Adjust the colours of one of the faces.
45 | (set-face-foreground 'rcirc-my-nick "red" nil)
46 |
47 |
48 |
49 | (with-eval-after-load 'rcirc
50 | (defun-rcirc-command reconnect (arg)
51 | "Reconnect the server process."
52 | (interactive "i")
53 | (unless process
54 | (error "There's no process for this target"))
55 | (let* ((server (car (process-contact process)))
56 | (port (process-contact process :service))
57 | (nick (rcirc-nick process))
58 | channels query-buffers)
59 | (dolist (buf (buffer-list))
60 | (with-current-buffer buf
61 | (when (eq process (rcirc-buffer-process))
62 | (remove-hook 'change-major-mode-hook
63 | 'rcirc-change-major-mode-hook)
64 | (if (rcirc-channel-p rcirc-target)
65 | (setq channels (cons rcirc-target channels))
66 | (setq query-buffers (cons buf query-buffers))))))
67 | (delete-process process)
68 | (rcirc-connect server port nick
69 | rcirc-default-user-name
70 | rcirc-default-full-name
71 | channels)))
72 | ;;; track activity when I'm in another buffer
73 | (rcirc-track-minor-mode)
74 | ;; Integrate with `terminal-notifier' to show IRC notification growls
75 | ;; Code taken from
76 | ;; https://raw.githubusercontent.com/nicferrier/rcirc-notify/master/rcirc-notify.el
77 | (require 'rcirc-notify)
78 | (rcirc-notify-add-hooks))
79 |
80 |
81 | (provide 'init-rcirc)
82 |
--------------------------------------------------------------------------------
/enhance/autoload-defuns.el:
--------------------------------------------------------------------------------
1 | ;;; autoload-defuns.el - Autoloading and byte-compilation related functions -*- lexical-binding: t -*-
2 | ;;; Author: Vedang Manerikar
3 | ;;; Created on: 13 Oct 2013
4 | ;;; Copyright (c) 2013 Vedang Manerikar
5 |
6 | ;; This file is not part of GNU Emacs.
7 |
8 | ;;; License:
9 |
10 | ;; This program is free software; you can redistribute it and/or
11 | ;; modify it under the terms of the Do What The Fuck You Want to
12 | ;; Public License, Version 2, which is included with this distribution.
13 | ;; See the file LICENSE.txt
14 |
15 | ;;; Code:;;;
16 |
17 |
18 | ;;;###autoload
19 | (defun ad/recompile-init (&optional force)
20 | "Byte-compile all your dotfiles again."
21 | (interactive "P")
22 | (byte-recompile-directory dotfiles-dirname 0 force))
23 |
24 |
25 | (defun ad/el-files-in-dir (directory)
26 | "List the .el files in DIRECTORY and in it's sub-directories."
27 | (let* ((current-directory-list (directory-files-and-attributes directory t))
28 | (el-files-list (delq nil (mapcar (lambda (lst)
29 | (and (or (equal ".el" (substring (car lst) -3))
30 | (equal ".el.gz" (substring (car lst) -6)))
31 | (car lst)))
32 | current-directory-list)))
33 | (dirs-list (delq nil (mapcar (lambda (lst)
34 | (and (car (cdr lst))
35 | (not (equal "." (substring (car lst) -1)))
36 | (not (equal ".git" (substring (car lst) -4)))
37 | (car lst)))
38 | current-directory-list))))
39 | (apply #'append el-files-list
40 | (mapcar (lambda (d)
41 | (ad/el-files-in-dir d))
42 | dirs-list))))
43 |
44 |
45 | (defun ad/byte-recompile-files (file-dir &optional force arg load)
46 | "Recompile all el files in this dir and all dirs below it. Like
47 | `byte-recompile-file', but better."
48 | (dolist (el-file (ad/el-files-in-dir file-dir))
49 | (byte-recompile-file el-file force arg load)))
50 |
51 |
52 | (defun ad/update-directory-autoloads (autoload-dir)
53 | "Update directory autoloads, but better"
54 | (dolist (el-file (ad/el-files-in-dir autoload-dir))
55 | (update-file-autoloads el-file t)))
56 |
57 |
58 | ;;;###autoload
59 | (defun ad/regen-autoloads (&optional force-regen)
60 | "Regenerate the autoload definitions file if necessary and load it."
61 | (interactive "P")
62 | (let ((generated-autoload-file autoload-file))
63 | (when (or force-regen
64 | (not (file-exists-p generated-autoload-file)))
65 | (when (not (file-exists-p generated-autoload-file))
66 | (with-current-buffer (find-file-noselect generated-autoload-file)
67 | (insert ";;") ;; create the file with non-zero size to appease autoload
68 | (save-buffer)))
69 | (message "Updating autoloads...")
70 | (dolist (autoload-dir (list plugins-dirname config-dirname elpa-dirname))
71 | (let (emacs-lisp-mode-hook)
72 | (ad/update-directory-autoloads autoload-dir)))))
73 | (load autoload-file))
74 |
75 |
76 | (provide 'autoload-defuns)
77 |
--------------------------------------------------------------------------------
/el-get-init-files/init-smartparens.el:
--------------------------------------------------------------------------------
1 | ;;; init-smartparens.el - Configuration for smartparens mode -*- lexical-binding: t -*-
2 | ;;; Author: Vedang Manerikar
3 | ;;; Created on: 13 Oct 2013
4 | ;;; Copyright (c) 2013 Vedang Manerikar
5 |
6 | ;; This file is not part of GNU Emacs.
7 |
8 | ;;; License:
9 |
10 | ;; This program is free software; you can redistribute it and/or
11 | ;; modify it under the terms of the Do What The Fuck You Want to
12 | ;; Public License, Version 2, which is included with this distribution.
13 | ;; See the file LICENSE.txt
14 |
15 | ;;; Code:
16 |
17 |
18 | (require 'smartparens-config)
19 |
20 | (smartparens-global-strict-mode)
21 | (show-smartparens-global-mode)
22 | (sp-use-paredit-bindings)
23 |
24 | (defun vm/wrap-or-insert-with-pair (p)
25 | "Allow for behavior like `paredit'. Wrap around the sexp by
26 | providing an argument."
27 | `(lambda (&optional arg)
28 | (interactive "P")
29 | (if arg
30 | (sp-wrap-with-pair ,p)
31 | (sp-insert-pair ,p))))
32 |
33 | (define-key sp-keymap (kbd "C-o") (vm/wrap-or-insert-with-pair "("))
34 | (define-key sp-keymap (kbd "(") (vm/wrap-or-insert-with-pair "("))
35 | (define-key sp-keymap (kbd "{") (vm/wrap-or-insert-with-pair "{"))
36 | (define-key sp-keymap (kbd "[") (vm/wrap-or-insert-with-pair "["))
37 |
38 | (setq sp-hybrid-kill-entire-symbol nil
39 | blink-matching-paren nil)
40 |
41 |
42 | ;; Keybindings
43 |
44 | ;; Unbind `M-s' (set by paredit keybindings above) because it's bound
45 | ;; to some handy occur related functions
46 | (define-key sp-keymap (kbd "M-s") nil)
47 |
48 | ;; Other key-bindings - apart from paredit key-bindings.
49 | ;; Taken from the Smartparens wiki page.
50 | (define-key sp-keymap (kbd "C-M-a") 'sp-backward-down-sexp)
51 | (define-key sp-keymap (kbd "C-S-a") 'sp-beginning-of-sexp)
52 | (define-key sp-keymap (kbd "C-S-d") 'sp-end-of-sexp)
53 |
54 | (define-key sp-keymap (kbd "C-M-e") 'sp-up-sexp)
55 | (define-key emacs-lisp-mode-map (kbd ")") 'sp-up-sexp)
56 | (define-key sp-keymap (kbd "C-M-t") 'sp-transpose-sexp)
57 |
58 | (define-key sp-keymap (kbd "C-M-n") 'sp-next-sexp)
59 | (define-key sp-keymap (kbd "C-M-p") 'sp-previous-sexp)
60 |
61 | (define-key sp-keymap (kbd "C-M-k") 'sp-kill-sexp)
62 | (define-key sp-keymap (kbd "C-M-w") 'sp-copy-sexp)
63 |
64 | (define-key sp-keymap (kbd "M-") 'sp-unwrap-sexp)
65 | (define-key sp-keymap (kbd "M-") 'sp-backward-unwrap-sexp)
66 |
67 | (define-key sp-keymap (kbd "M-D") 'sp-splice-sexp)
68 | (define-key sp-keymap (kbd "C-M-]") 'sp-select-next-thing-exchange)
69 | (define-key sp-keymap (kbd "C-]") 'sp-select-next-thing)
70 |
71 | (define-key sp-keymap (kbd "M-F") 'sp-forward-symbol)
72 | (define-key sp-keymap (kbd "M-B") 'sp-backward-symbol)
73 |
74 | (define-key sp-keymap (kbd "s-t") 'sp-prefix-tag-object)
75 | (define-key sp-keymap (kbd "s-p") 'sp-prefix-pair-object)
76 | (define-key sp-keymap (kbd "s-s c") 'sp-convolute-sexp)
77 | (define-key sp-keymap (kbd "s-s a") 'sp-absorb-sexp)
78 | (define-key sp-keymap (kbd "s-s e") 'sp-emit-sexp)
79 | (define-key sp-keymap (kbd "s-s p") 'sp-add-to-previous-sexp)
80 | (define-key sp-keymap (kbd "s-s n") 'sp-add-to-next-sexp)
81 | (define-key sp-keymap (kbd "s-s j") 'sp-join-sexp)
82 | (define-key sp-keymap (kbd "s-s s") 'sp-split-sexp)
83 |
84 |
85 | ;; SP config for other modes.
86 | (with-eval-after-load 'cider-repl
87 | (define-key cider-repl-mode-map (kbd ")") 'sp-up-sexp)
88 | (define-key cider-repl-mode-map (kbd "]") 'sp-up-sexp)
89 | (define-key cider-repl-mode-map (kbd "}") 'sp-up-sexp))
90 |
91 | (with-eval-after-load 'clojure-mode
92 | (define-key clojure-mode-map (kbd ")") 'sp-up-sexp)
93 | (define-key clojure-mode-map (kbd "]") 'sp-up-sexp)
94 | (define-key clojure-mode-map (kbd "}") 'sp-up-sexp))
95 |
96 |
97 | (provide 'init-smartparens)
98 |
--------------------------------------------------------------------------------
/enhance/org-crate-config.el:
--------------------------------------------------------------------------------
1 | ;;; org-crate-config.el --- Configuration for org-mode -*- lexical-binding: t -*-
2 | ;;; Author: Vedang Manerikar
3 | ;;; Created on: 18 Dec 2012
4 | ;;; Copyright (c) 2012, 2013 Vedang Manerikar
5 |
6 | ;; This file is not part of GNU Emacs.
7 |
8 | ;;; License:
9 |
10 | ;; This program is free software; you can redistribute it and/or
11 | ;; modify it under the terms of the Do What The Fuck You Want to
12 | ;; Public License, Version 2, which is included with this distribution.
13 | ;; See the file LICENSE.txt
14 |
15 | ;;; Commentary:
16 |
17 | ;; Expects `org-directory', `org-work-directory',
18 | ;; `org-personal-directory' and `org-agenda-files' to be defined
19 | ;; before this file is loaded. (for example, in `personal.el' file)
20 | ;; Personal Config:
21 | ;; Expects `org-journal-file' to be defined (for example, in `personal.el' file)
22 | ;;; Code:
23 |
24 | (require 'org)
25 | (require 'org-id)
26 | (require 'org-clock)
27 | (require 'org-agenda)
28 | (setq org-default-notes-file (expand-file-name "brain/daily.org" org-directory)
29 | org-id-track-globally t
30 | ;; Don't dim anything in the Agenda. If I want dimming, I will
31 | ;; ask for it explicitly with the # key-binding in the Agenda.
32 | org-agenda-dim-blocked-tasks nil)
33 |
34 | (defvar vm/org-updates-heading-id "6a134484-7349-49b7-b580-3045bc87358f")
35 |
36 | (with-eval-after-load 'org-super-agenda
37 | (defvar org-super-agenda-groups)
38 | (setq org-super-agenda-groups
39 | '((:name "These are your IMPORTANT Tasks"
40 | :tag "important"
41 | :order 0)
42 | (:name "Your Meetings today"
43 | :and (:date today :not (:habit t :deadline t :scheduled t))
44 | :order 1)
45 | (:name "These are your URGENT Tasks"
46 | :not (:habit t :deadline future :scheduled future)
47 | :order 2)
48 | (:name "Habits"
49 | :habit t
50 | :order 3)
51 | (:name "Upcoming Tasks"
52 | :scheduled t
53 | :deadline t
54 | :order 4)
55 | (:name "Clocked today"
56 | :log t
57 | :order 5)
58 | ;; After the last group, the agenda will display items that didn't
59 | ;; match any of these groups, with the default order position of 99
60 | )))
61 |
62 | ;;; Use `terminal-notifier' to push notifications on osx, if this
63 | ;;; program is not installed, ignore notifications.
64 | (defun vm/org-notify-message (msg)
65 | "Push MSG as a notification via `terminal-notifier'."
66 | (when (executable-find "terminal-notifier")
67 | (start-process "page-me"
68 | "*debug*"
69 | "terminal-notifier"
70 | "-activate" "org.gnu.Emacs"
71 | "-message" msg
72 | "-title" "Org Mode")))
73 |
74 | ;;; Settings for org-capture
75 | (require 'org-protocol)
76 | (require 'org-capture)
77 | (defvar org-mode-crate-dir
78 | (concat user-emacs-directory "el-get/org-mode-crate"))
79 |
80 | ;;; Add my personal targets for org-capture
81 |
82 | ;; A capture template to create a task for improving Emacs.
83 | (push `("te" "Improve Emacs Immediate Finish" entry
84 | (id "B751DE04-D5BD-4CA3-B6F7-7C3943CF8F76")
85 | (file ,(expand-file-name "capture-templates/todo.org" org-mode-crate-dir))
86 | :clock-in t
87 | :clock-resume t
88 | :immediate-finish t)
89 | org-capture-templates)
90 |
91 | (setq org-show-notification-handler 'vm/org-notify-message)
92 |
93 | ;;; Use Plantuml for diagrams
94 | ;; This value is set in my personal.el file
95 | ;; (setq org-plantuml-jar-path "")
96 |
97 | (provide 'org-crate-config)
98 | ;;; org-crate-config.el ends here.
99 |
--------------------------------------------------------------------------------
/enhance/scroll-other-window.el:
--------------------------------------------------------------------------------
1 | ;;; scroll-other-window.el --- Variable commands for scrolling the other window. -*- lexical-binding: t -*-
2 |
3 | ;; Copyright (C) 2016 Andreas Politz
4 |
5 | ;; Author: Andreas Politz
6 | ;; Keywords: extensions, frames
7 |
8 | ;; This program is free software; you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 |
23 | ;;
24 |
25 | ;;; Code:
26 |
27 |
28 | (defvar-local sow-scroll-up-command nil)
29 |
30 | (defvar-local sow-scroll-down-command nil)
31 |
32 | (defvar sow-mode-map
33 | (let ((km (make-sparse-keymap)))
34 | (define-key km [remap scroll-other-window]
35 | 'sow-scroll-other-window)
36 | (define-key km [remap scroll-other-window-down]
37 | 'sow-scroll-other-window-down)
38 | km)
39 | "Keymap used for `sow-mode'.")
40 |
41 | (define-minor-mode sow-mode
42 | "Provide a decent way to scroll the other window.
43 |
44 | A way that does not use the default C function for scrolling."
45 | :group 'sow
46 | :global t)
47 |
48 | (defun sow-scroll-other-window (&optional arg)
49 | "Scroll the other window up by ARG lines.
50 |
51 | If ARG is not provided, scroll a near full screen. A near full
52 | screen is `next-screen-context-lines' less than a full screen."
53 | (interactive "P")
54 | (sow--scroll-other-window-1 arg))
55 |
56 | (defun sow-scroll-other-window-down (&optional arg)
57 | "Scroll the other window down by ARG lines.
58 |
59 | If ARG is not provided, scroll a near full screen. A near full
60 | screen is `next-screen-context-lines' less than a full screen."
61 | (interactive "P")
62 | (sow--scroll-other-window-1 arg t))
63 |
64 | (defun sow--scroll-other-window-1 (n &optional down-p)
65 | "Scroll the other window up/down by N lines, depending on DOWN-P.
66 |
67 | If N is not provided, scroll a near full screen. A near full
68 | screen is `next-screen-context-lines' less than a full screen."
69 | (let* ((win (other-window-for-scrolling))
70 | (cmd (with-current-buffer (window-buffer win)
71 | (if down-p
72 | (or sow-scroll-down-command #'scroll-down-command)
73 | (or sow-scroll-up-command #'scroll-up-command)))))
74 | (with-current-buffer (window-buffer win)
75 | (save-excursion
76 | (goto-char (window-point win))
77 | (with-selected-window win
78 | (funcall cmd n))
79 | (set-window-point win (point))))))
80 |
81 | (add-hook 'Info-mode-hook
82 | (lambda nil
83 | (setq sow-scroll-up-command
84 | (lambda (_) (Info-scroll-up))
85 | sow-scroll-down-command
86 | (lambda (_) (Info-scroll-down)))))
87 |
88 | (add-hook 'doc-view-mode-hook
89 | (lambda nil
90 | (setq sow-scroll-up-command
91 | 'doc-view-scroll-up-or-next-page
92 | sow-scroll-down-command
93 | 'doc-view-scroll-down-or-previous-page)))
94 |
95 | (add-hook 'pdf-view-mode-hook
96 | (lambda nil
97 | (setq sow-scroll-up-command
98 | 'pdf-view-scroll-up-or-next-page
99 | sow-scroll-down-command
100 | 'pdf-view-scroll-down-or-previous-page)))
101 |
102 | (provide 'scroll-other-window)
103 | ;;; scroll-other-window.el ends here
104 |
--------------------------------------------------------------------------------
/site-lisp/site-lisp.el:
--------------------------------------------------------------------------------
1 | ;;; site-lisp.el --- Change the behavior of things that come built -*- lexical-binding: t -*-
2 | ;;; into Emacs
3 | ;;; Commentary:
4 | ;;; Author: Vedang Manerikar
5 | ;;; Created on: 22 Sep 2013
6 | ;;; Copyright (c) 2013 Vedang Manerikar
7 |
8 | ;; This file is not part of GNU Emacs.
9 |
10 | ;;; License:
11 |
12 | ;; This program is free software; you can redistribute it and/or
13 | ;; modify it under the terms of the Do What The Fuck You Want to
14 | ;; Public License, Version 2, which is included with this distribution.
15 | ;; See the file LICENSE.txt
16 |
17 | ;;; Code:
18 |
19 | (require 'cl-lib)
20 |
21 | (require 'uniquify)
22 | (setq uniquify-buffer-name-style 'reverse
23 | uniquify-separator "|"
24 | uniquify-after-kill-buffer-p t
25 | uniquify-ignore-buffers-re "^\\*")
26 |
27 | (require 'saveplace)
28 |
29 | (add-hook 'occur-mode-hook 'next-error-follow-minor-mode)
30 |
31 | (require 'dired)
32 | (require 'dired-x)
33 | (require 'wdired)
34 | (setq wdired-allow-to-change-permissions t
35 | wdired-use-interactive-rename nil
36 | wdired-confirm-overwrite t)
37 | (define-key dired-mode-map (kbd "e")
38 | (lambda ()
39 | (interactive)
40 | (eww-open-file (dired-get-file-for-visit))))
41 | (add-hook 'dired-mode-hook #'dired-hide-details-mode)
42 | (global-set-key (kbd "C-x D") #'find-dired)
43 |
44 | ;;; commented out to see if this is causing problems in Emacs 29
45 | ;; (require 'dired+)
46 |
47 | ;; Bindings
48 | (global-set-key (kbd "M-j") #'pop-to-mark-command)
49 | (global-set-key (kbd "RET") #'reindent-then-newline-and-indent)
50 | (global-set-key (kbd "A-l") #'goto-line)
51 | (global-set-key (kbd "C-x n r") #'narrow-to-region)
52 | (global-set-key (kbd "C-x \\") #'align-regexp)
53 | (global-set-key (kbd "M-/") #'hippie-expand)
54 | (global-set-key (kbd "C-c y") #'bury-buffer)
55 | (global-set-key (kbd "") #'revert-buffer)
56 | (global-set-key (kbd "C-x m") #'eshell)
57 | (global-set-key (kbd "C-c a") #'org-agenda)
58 | (global-set-key (kbd "C-+") #'text-scale-increase)
59 | (global-set-key (kbd "C--") #'text-scale-decrease)
60 | (global-set-key (kbd "C-S-t") #'transpose-sexps)
61 | ;; M-q is eaten inside VirtualBox on Mac.
62 | ;; Re-mapping some important functions which depend on M-q
63 | (global-set-key (kbd "C-c q") #'fill-paragraph)
64 | (global-set-key (kbd "C-s-q") #'prog-indent-sexp)
65 |
66 |
67 | ;; Aliases for common functions
68 | (defalias 'rvt 'revert-buffer)
69 | (defalias 'dtw 'delete-trailing-whitespace)
70 | (defalias 'yes-or-no-p 'y-or-n-p)
71 |
72 |
73 | ;; Require other site-lisp configuration
74 |
75 | (require 'init-ido)
76 | (require 'init-ibuffer)
77 | (require 'init-isearch)
78 | (require 'init-recentf)
79 | (require 'init-flyspell)
80 | (require 'init-sql)
81 | (save-place-mode 1)
82 | (savehist-mode 1)
83 |
84 |
85 | (with-eval-after-load 'rcirc
86 | (require 'init-rcirc))
87 | (with-eval-after-load 'eldoc
88 | (setq eldoc-minor-mode-string nil
89 | eldoc-idle-delay 0.75))
90 |
91 | (require 'eshell)
92 | (require 'em-smart)
93 | (setq eshell-where-to-jump 'begin)
94 | (setq eshell-review-quick-commands nil)
95 | (setq eshell-smart-space-goes-to-end t)
96 |
97 | ;;; Configuration for Flymake
98 | (with-eval-after-load 'flymake
99 | (define-key flymake-mode-map (kbd "C-c # n") 'flymake-goto-next-error)
100 | (define-key flymake-mode-map (kbd "C-c # p") 'flymake-goto-prev-error)
101 | (define-key flymake-mode-map (kbd "C-c # l") 'flymake-show-buffer-diagnostics)
102 | (define-key flymake-mode-map (kbd "C-c # L") 'flymake-show-project-diagnostics)
103 | (setq flymake-no-changes-timeout 0.75))
104 |
105 | ;;; Configuration for Eglot
106 | (with-eval-after-load 'eglot
107 | (define-key eglot-mode-map (kbd "C-c e r") 'eglot-rename)
108 | (define-key eglot-mode-map (kbd "C-c e o") 'eglot-code-action-organize-imports)
109 | (define-key eglot-mode-map (kbd "C-c e h") 'eldoc)
110 | (define-key eglot-mode-map (kbd "C-c e c") 'eglot-code-actions)
111 | (define-key eglot-mode-map (kbd "C-c e f") 'eglot-format)
112 | (setq eglot-extend-to-xref t))
113 |
114 | ;;; Macros for rejister
115 | (defalias 'idbi-txn-date
116 | (kmacro "M-f M-f C-f C-SPC M-f C-w M-b M-b C-y - M-f C-f C-SPC M-f C-w M-b C-y - M-f C-d C-d C-n C-a C-s / C-b C-b C-b"))
117 |
118 | (provide 'site-lisp)
119 | ;;; site-lisp.el ends here
120 |
--------------------------------------------------------------------------------
/snippets/org-mode/daily:
--------------------------------------------------------------------------------
1 | # -*- mode: snippet -*-
2 | # name: daily_planner
3 | # key: daily
4 | # --
5 | **** TODO My Top Priority / Highlight today
6 | - The way to do this:
7 | + First write whatever comes to the top of your mind. This is what you are thinking of, so write it down.
8 | + Now review your (custom/normal) Org Agenda and see if anything on it changes the plans you have made. Update the plan you have written down here.
9 | + Actually updating your Agenda happens in the next step
10 | - Ideally, I'll pick only one. If I'm feeling ambitious, I'll pick two or three. Pick based on the following:
11 | - What is truly important? (important for my goals, urgently needs attention)
12 | - What will give me satisfaction for a job well done? (goal driven)
13 | - What will give me joy?
14 |
15 | **** TODO Today's message to myself :checkin:
16 |
17 | **** TODO [0/3] The whole day plan for today :checkin:
18 | - [ ] Review your calendar and plan out your day to the best of your knowledge
19 | - [ ] Create time for tasks that absolutely must be done
20 | - [ ] Make sure you mark distracting tasks as "I will NOT DO these today"
21 | - [ ] Create time for your priority task
22 |
23 | **** TODO Persons I need to lead or connect with today, and how to do it well :checkin:
24 |
25 | **** TODO [0/8] Evening Journal :checkin:
26 | - [ ] Did I spend time aligned to my highlight and goals for today?
27 | - [ ] Tactics I tried today for improving productivity (and how they went):
28 | - [ ] A moment that I really appreciated today was:
29 | - [ ] A situation or task that I handled well today was:
30 | - [ ] Something I realized or learned today was:
31 | - [ ] I could have made today even better if:
32 | - [ ] Something that would have made me feel more connected to others today would have been:
33 | - [ ] If I was my own high performance coach, I would tell myself this statement about today:
34 |
35 | **** TODO Daily Habits Scorecard :checkin:
36 | - Notes:
37 | - CLARITY can be thought of also as LASER. How focussed was I today?
38 |
39 | | Field | Description | Score (1: bad, 5: great) |
40 | |--------------+------------------------------------------------------------------------+--------------------------|
41 | | CLARITY | I knew my "why" and lived intentionally today. | |
42 | |--------------+------------------------------------------------------------------------+--------------------------|
43 | | PRODUCTIVITY | I worked on the things that mattered the most today. | |
44 | |--------------+------------------------------------------------------------------------+--------------------------|
45 | | ENERGY | I managed my mental and physical energy well today. | |
46 | |--------------+------------------------------------------------------------------------+--------------------------|
47 | | INFLUENCE | I guided or treated others well today. | |
48 | |--------------+------------------------------------------------------------------------+--------------------------|
49 | | NECESSITY | I felt it was necessary to be my best and made success "a must" today. | |
50 | |--------------+------------------------------------------------------------------------+--------------------------|
51 | | COURAGE | I shared my real self, thoughts and feelings today. | |
52 | |--------------+------------------------------------------------------------------------+--------------------------|
53 | | | | |
54 |
55 | **** TODO [0/10] Next Day Morning Mindset :checkin:
56 | - [ ] One thing I can get excited about tomorrow is: $0
57 | - [ ] If one word can describe the kind of person I want to be tomorrow, that word is: (and why)
58 | - [ ] Someone who needs me on my A game tomorrow is:
59 | - [ ] A situation that might stress me out or trip me up tomorrow is:
60 | - [ ] The situation is:
61 | - [ ] The way my best self would deal with it is:
62 | - [ ] Someone I could surprise with a note, a gift or a sign of appreciation is:
63 | - [ ] One action I could take tomorrow to demonstrate excellence or real value is:
64 | - [ ] One thing I could do tomorrow that is a little outside my comfort zone is:
65 | - [ ] If I was a high performance coach looking at my life from a high level, I would tell myself to remember that:
66 | - [ ] The big projects I have to keep in mind, that I want to take on, even if I cannot act on them tomorrow are:
67 | - [ ] I would know tomorrow was a great success if at the end of the day I did, said or felt this:
68 |
--------------------------------------------------------------------------------
/site-lisp/init-recentf.el:
--------------------------------------------------------------------------------
1 | ;;; init-recentf.el --- Configuration for recentf -*- lexical-binding: t -*-
2 | ;;; Author: Vedang Manerikar
3 | ;;; Created on: 16 Jan 2012
4 | ;;; Copyright (c) 2013 Vedang Manerikar
5 |
6 | ;; This file is not part of GNU Emacs.
7 |
8 | ;;; License:
9 |
10 | ;; This program is free software; you can redistribute it and/or
11 | ;; modify it under the terms of the Do What The Fuck You Want to
12 | ;; Public License, Version 2, which is included with this distribution.
13 | ;; See the file LICENSE.txt
14 |
15 | ;;; Code:
16 |
17 |
18 | (require 'recentf)
19 |
20 | (setq recentf-max-saved-items 1000
21 | recentf-max-menu-items 1000
22 | recentf-menu-filter 'recentf-show-basenames)
23 |
24 | (recentf-mode 1)
25 |
26 |
27 | ;; Implement functionality similar to uniquify to make recentf results bearable
28 | ;; Requires s.el and dash.el - awesome libraries from Magnar Sven
29 | ;; Hat-tip : Baishampayan Ghose for the clojure implementation at
30 | ;; https://gist.github.com/ghoseb/8432086
31 | (require 's)
32 | (require 'dash)
33 |
34 |
35 | (defun explode (d)
36 | "Explode a directory name to its subcomponents."
37 | (s-split "/" d))
38 |
39 |
40 | (defun tails* (coll acc)
41 | "Return successive tails of a collection."
42 | (if (cdr coll)
43 | (tails* (cdr coll) (cons coll acc))
44 | (cons coll acc)))
45 |
46 |
47 | (defun tails (coll)
48 | "Return successive tails of a collection."
49 | (tails* coll '()))
50 |
51 |
52 | (defun paths (d)
53 | "Given a single directory, return all the possible sub-paths / name
54 | representations for it."
55 | (mapcar (lambda (xs) (s-join "/" xs)) (tails (explode d))))
56 |
57 |
58 | (defun index-coll (tab coll)
59 | "Given a table and a collection, add each entry of the
60 | collection into the table. If the key already exists, inc it's
61 | value by 1"
62 | (mapcar (lambda (x) (puthash x (+ 1 (gethash x tab 0)) tab)) coll)
63 | tab)
64 |
65 |
66 | (defun vm-uniquify (filenames)
67 | "Given a bunch of filenames (as returned by `recentf-list'),
68 | simplify the names to make them more easily readable."
69 | (let* ((expanded-paths (mapcar 'paths filenames))
70 | (tab (make-hash-table :test 'equal))
71 | (freqs (mapcar (apply-partially 'index-coll tab) expanded-paths)))
72 | (mapcar (apply-partially '-first (lambda (x) (= 1 (gethash x tab 0))))
73 | expanded-paths)))
74 |
75 |
76 | ;; Mastering Emacs + some of my own elisp
77 | (defun ido-recentf-open ()
78 | "Use `ido-completing-read' to \\[find-file] a recent file"
79 | (interactive)
80 | (let* ((unique-filenames (vm-uniquify recentf-list))
81 | (filename-map (-partition 2 (-interleave unique-filenames
82 | recentf-list)))
83 | (short-filename (ido-completing-read "Choose recent file: "
84 | unique-filenames
85 | nil
86 | t)))
87 | (if short-filename
88 | (find-file (cadr (assoc short-filename filename-map)))
89 | (message "Aborting"))))
90 |
91 | (global-set-key (kbd "C-x C-r") 'ido-recentf-open)
92 |
93 |
94 | ;; Emacswiki
95 | (defsubst file-was-visible-p (file)
96 | "Return non-nil if FILE's buffer exists and has been displayed."
97 | (let ((buf (find-buffer-visiting file)))
98 | (if buf
99 | (let ((display-count (buffer-local-value 'buffer-display-count buf)))
100 | (if (> display-count 0) display-count nil)))))
101 |
102 | (defsubst keep-default-and-visible-recentf-p (file)
103 | "Return non-nil if recentf would, by default, keep FILE, and
104 | FILE has been displayed."
105 | (if (recentf-keep-default-predicate file)
106 | (file-was-visible-p file)))
107 |
108 | ;; When a buffer is closed, remove the associated file from the recentf
109 | ;; list if (1) recentf would have, by default, removed the file, or
110 | ;; (2) the buffer was never displayed. This is useful because, for
111 | ;; example, CEDET opens a lot of files in the background to generate
112 | ;; its tags database, etc.
113 | (setq recentf-keep '(keep-default-and-visible-recentf-p))
114 |
115 |
116 | (defun undo-kill-buffer (arg)
117 | "Re-open the last buffer killed. With ARG, re-open the nth buffer."
118 | (interactive "p")
119 | (let ((recently-killed-list (copy-sequence recentf-list))
120 | (buffer-files-list
121 | (delq nil (mapcar (lambda (buf)
122 | (when (buffer-file-name buf)
123 | (expand-file-name (buffer-file-name buf)))) (buffer-list)))))
124 | (mapc
125 | (lambda (buf-file)
126 | (setq recently-killed-list
127 | (delq buf-file recently-killed-list)))
128 | buffer-files-list)
129 | (find-file
130 | (if arg (nth arg recently-killed-list)
131 | (car recently-killed-list)))))
132 |
133 | (provide 'init-recentf)
134 |
--------------------------------------------------------------------------------
/el-get-init-files/init-clojure-mode.el:
--------------------------------------------------------------------------------
1 | ;;; init-clojure-mode.el --- Configuration for Clojure Mode -*- lexical-binding: t -*-
2 | ;;; Author: Vedang Manerikar
3 | ;;; Created on: 27 Oct 2013
4 | ;;; Copyright (c) 2013 Vedang Manerikar
5 |
6 | ;; This file is not part of GNU Emacs.
7 |
8 | ;;; License:
9 |
10 | ;; This program is free software; you can redistribute it and/or
11 | ;; modify it under the terms of the Do What The Fuck You Want to
12 | ;; Public License, Version 2, which is included with this distribution.
13 | ;; See the file LICENSE.txt
14 |
15 | ;;; Code:
16 |
17 | ;;; Re-implementation of clojure-test-mode functions for Midje
18 | ;;; Hat-tip : Kapil Reddy
19 | ;;; https://github.com/kapilreddy/dotemacs/blob/5d6cfc2215b8f1eb2dd0ca14d871478fee053db3/configurations/clojure-config.el
20 |
21 | (defun icl/clojure-underscores-for-hyphens (namespace)
22 | "Replace all hyphens in NAMESPACE with underscores."
23 | (replace-regexp-in-string "-" "_" namespace))
24 |
25 |
26 | (defun icl/midje-test-for (namespace)
27 | (let* ((namespace (icl/clojure-underscores-for-hyphens namespace))
28 | (segments (split-string namespace "\\."))
29 | (test-segments (append (list "test") segments)))
30 | (mapconcat 'identity test-segments "/")))
31 |
32 |
33 | (defun icl/midje-jump-to-test ()
34 | "Jump from implementation file to test."
35 | (interactive)
36 | (find-file (format "%s/%s_test.clj"
37 | (file-name-as-directory
38 | (locate-dominating-file buffer-file-name "src/"))
39 | (icl/midje-test-for (clojure-find-ns)))))
40 |
41 |
42 | (defun icl/midje-implementation-for (namespace)
43 | (let* ((namespace (icl/clojure-underscores-for-hyphens namespace))
44 | (segments (split-string (replace-regexp-in-string "_test"
45 | ""
46 | namespace)
47 | "\\.")))
48 | (mapconcat 'identity segments "/")))
49 |
50 |
51 | (defun icl/midje-jump-to-implementation ()
52 | "Jump from midje test file to implementation."
53 | (interactive)
54 | (find-file (format "%s/src/%s.clj"
55 | (locate-dominating-file buffer-file-name "src/")
56 | (icl/midje-implementation-for (clojure-find-ns)))))
57 |
58 |
59 | (defun icl/clojure-in-tests-p ()
60 | "Check whether the current file is a test file.
61 | Two checks are made - whether the namespace of the file has the
62 | word test in it and whether the file lives under the test/
63 | directory."
64 | (or (string-match-p "test\." (clojure-find-ns))
65 | (string-match-p "/test" (buffer-file-name))))
66 |
67 |
68 | (defun icl/midje-jump-between-tests-and-code ()
69 | (interactive)
70 | (if (icl/clojure-in-tests-p)
71 | (icl/midje-jump-to-implementation)
72 | (icl/midje-jump-to-test)))
73 |
74 |
75 | ;; *** DEPRECATED ***
76 | (defun icl/midje-test-maybe-enable ()
77 | "Stop clojure-test-mode from loading, instead use my midje functions
78 |
79 | Deprecation Notice: `clojure-test-mode' no longer exists,
80 | making this function unnecessary. It will be removed in a
81 | future version."
82 | (let ((ns (clojure-find-ns)))
83 | (when (and ns (string-match "test\\(\\.\\|$\\)" ns))
84 | (when (and (listp clojure-mode-hook)
85 | (memq 'clojure-test-maybe-enable clojure-mode-hook))
86 | (remove-hook 'clojure-mode-hook 'clojure-test-maybe-enable)))))
87 |
88 |
89 | (with-eval-after-load 'clojure-mode
90 | (require 'clojure-mode-extra-font-locking)
91 | (put-clojure-indent 'describe 'defun)
92 | (put-clojure-indent 'given 'defun)
93 | (put-clojure-indent 'using 'defun)
94 | ;; *** DEPRECATED ***
95 | ;; Adding the `icl/midje-test-maybe-enable' hook is unnecessary,
96 | ;; since `clojure-test-mode' no longer exists. The call and
97 | ;; associated function will be deleted in a future commit
98 | (add-hook 'clojure-mode-hook 'icl/midje-test-maybe-enable)
99 | (add-hook 'clojure-mode-hook 'subword-mode)
100 | (define-key clojure-mode-map (kbd "C-c t")
101 | 'icl/midje-jump-between-tests-and-code)
102 | (require 'flycheck-clj-kondo))
103 |
104 | ;;; From:
105 | ;;; https://gist.github.com/jackrusher/e628abb653429c22bc6330752b3e49a5,
106 | ;;; with minor modifications from myself.
107 | (defun json->edn ()
108 | "Convert the selected region, or entire file, from JSON to EDN."
109 | (interactive)
110 | (let ((b (if mark-active (region-beginning) (point-min)))
111 | (e (if mark-active (region-end) (point-max)))
112 | (jet (when (executable-find "jet")
113 | "jet --pretty --keywordize keyword --from json --to edn")))
114 | (if jet
115 | (let ((p (point)))
116 | (shell-command-on-region b e jet (current-buffer) t)
117 | (goto-char p))
118 | (user-error "Could not find jet installed"))))
119 |
120 | (provide 'init-clojure-mode)
121 |
122 | ;;; init-clojure-mode ends here
123 |
--------------------------------------------------------------------------------
/el-get-init-files/init-helm.el:
--------------------------------------------------------------------------------
1 | ;;; init-helm.el --- Configuration for Helm mode -*- lexical-binding: t -*-
2 | ;;; Commentary:
3 | ;;; Author: Vedang Manerikar
4 | ;;; Created on: 15 Mar 2016
5 | ;;; Copyright (c) 2016 Vedang Manerikar
6 |
7 | ;; This file is not part of GNU Emacs.
8 |
9 | ;;; License:
10 |
11 | ;; This program is free software; you can redistribute it and/or
12 | ;; modify it under the terms of the Do What The Fuck You Want to
13 | ;; Public License, Version 2, which is included with this distribution.
14 | ;; See the file LICENSE.txt
15 |
16 | ;;; Code:
17 |
18 | ;;; I have moved the following to custom.el. Capturing their previous
19 | ;;; values here, in case I want to go back to them later
20 | ;; (setq helm-reuse-last-window-split-state t
21 | ;; helm-ff-file-name-history-use-recentf t
22 | ;; helm-buffers-fuzzy-matching t
23 | ;; helm-recentf-fuzzy-match t
24 | ;; helm-mini-default-sources '(helm-source-buffers-list
25 | ;; helm-source-recentf
26 | ;; helm-source-bookmarks
27 | ;; helm-source-buffer-not-found)
28 | ;; helm-grep-ag-command
29 | ;; "rg --color=always --colors 'match:style:underline' --colors 'match:bg:black' --colors 'match:fg:white' --smart-case --no-heading --line-number %s -- %s %s"
30 | ;; helm-locate-recursive-dirs-command "fd --hidden --type d .*%s.*$ %s"
31 | ;; helm-ff-auto-update-initial-value t
32 |
33 | ;;; Fancy UI follows, turned off by default.
34 | ;;; `helm-show-action-window-other-window' only takes effect if
35 | ;;; `helm-always-two-windows' is non-nil
36 | ;;; Note: `helm-commands-using-frame' is for fancy UI where the
37 | ;;; search bar pops up and out for running searches. Enable this
38 | ;;; if you want to show off fancy UX to someone.
39 |
40 | ;; helm-always-two-windows nil
41 | ;; helm-show-action-window-other-window 'left
42 | ;;; Uncomment this and set stuff below to t
43 | ;;; helm-commands-using-frame '(completion-at-point
44 | ;;; helm-apropos
45 | ;;; helm-eshell-prompts
46 | ;;; helm-imenu
47 | ;;; helm-imenu-in-all-buffers)
48 | ;; helm-use-frame-when-more-than-two-windows nil
49 | ;; helm-use-frame-when-no-suitable-window nil
50 | ;; )
51 |
52 | (helm-define-key-with-subkeys global-map (kbd "C-c n") ?n 'helm-cycle-resume)
53 |
54 | (helm-mode +1)
55 |
56 | ;;; Add ido-completing-read functions for things that don't have
57 | ;;; default values in `helm-completing-read-handlers-alist'.
58 |
59 | (push '(describe-function . ido-completing-read)
60 | helm-completing-read-handlers-alist)
61 | (push '(describe-variable . ido-completing-read)
62 | helm-completing-read-handlers-alist)
63 | (push '(describe-symbol . ido-completing-read)
64 | helm-completing-read-handlers-alist)
65 | ;; (push '(debug-on-entry . ido-completing-read)
66 | ;; helm-completing-read-handlers-alist)
67 | ;; (push '(find-function . ido-completing-read)
68 | ;; helm-completing-read-handlers-alist)
69 | ;; (push '(disassemble . ido-completing-read)
70 | ;; helm-completing-read-handlers-alist)
71 | ;; (push '(trace-function . ido-completing-read)
72 | ;; helm-completing-read-handlers-alist)
73 | ;; (push '(trace-function-foreground . ido-completing-read)
74 | ;; helm-completing-read-handlers-alist)
75 | ;; (push '(trace-function-background . ido-completing-read)
76 | ;; helm-completing-read-handlers-alist)
77 |
78 | (require 'helm-adaptive)
79 | (helm-adaptive-mode +1)
80 |
81 | (require 'helm-utils)
82 | (helm-popup-tip-mode +1)
83 | (setq helm-highlight-matches-around-point-max-lines '(30 . 30)
84 | helm-window-show-buffers-function #'helm-window-mosaic-fn)
85 | (add-hook 'find-file-hook #'helm-save-current-pos-to-mark-ring)
86 |
87 | (require 'helm-info)
88 | (global-set-key (kbd "C-h r") #'helm-info-emacs)
89 | (require 'helm-command)
90 | (global-set-key (kbd "M-x") #'helm-M-x)
91 | ;; I want to use `helm-mini' and `helm-find-files' as my primary entry
92 | ;; point into helm.
93 | (global-set-key (kbd "C-x b") #'helm-mini)
94 | (global-set-key (kbd "C-x C-f") #'helm-find-files)
95 |
96 | (global-set-key (kbd "C-x c r") nil) ; unset this because I plan to
97 | ; use it as a prefix key.
98 | (global-set-key (kbd "C-x c r b") #'helm-filtered-bookmarks)
99 | (global-set-key (kbd "C-x c r r") #'helm-regexp)
100 | (global-set-key (kbd "M-y") #'helm-show-kill-ring)
101 | (global-set-key (kbd "C-x c SPC") #'helm-all-mark-rings)
102 | (global-set-key (kbd "C-h SPC") #'helm-all-mark-rings)
103 | (global-set-key (kbd "C-x c r i") #'helm-register)
104 |
105 | (when (executable-find "curl")
106 | (setq helm-net-prefer-curl t))
107 |
108 | (defun helm-do-grep-project-root (&optional with-types)
109 | "Search in current project with.
110 |
111 | With WITH-TYPES, ask for file types to search in."
112 | (interactive "P")
113 | (let ((default-directory (project-root (project-current t))))
114 | (call-interactively 'helm-do-grep-ag)))
115 |
116 | (global-set-key (kbd "C-x c g a") 'helm-do-grep-project-root)
117 | (global-set-key (kbd "C-c s") 'helm-do-grep-project-root)
118 |
119 | (defun helm-do-grep-ag-with-directory (dir)
120 | "Do `helm-do-grep-ag' with `default-directory' set to DIR."
121 | (interactive "DDirectory to search in: ")
122 | (let ((default-directory dir))
123 | (call-interactively 'helm-do-grep-ag)))
124 |
125 | (global-set-key (kbd "C-x c g s") 'helm-do-grep-ag)
126 | (global-set-key (kbd "C-x c g g") 'helm-do-grep-ag-with-directory)
127 |
128 | (provide 'init-helm)
129 | ;;; init-helm.el ends here
130 |
--------------------------------------------------------------------------------
/docs/20161111T202810--02-what-a-programming-editor-should-do.org:
--------------------------------------------------------------------------------
1 | :PROPERTIES:
2 | :ID: 20161111T202810
3 | :CREATED: [2016-11-11 Fri 20:28]
4 | :END:
5 | #+title: 02 What your programming editor should be able to do.
6 | #+subtitle: And how I do them in Emacs.
7 | #+author: Vedang Manerikar
8 | #+email: vedang.manerikar@gmail.com
9 | #+filetags:
10 | #+date: [2016-11-11 Fri 20:28]
11 | #+identifier: 20161111T202810
12 |
13 | This is an incomplete list, please help me make it better by suggesting functionality that you find indispensable in your editor. I have tried to arrange it in decreasing order of importance. I consider all this functionality table stakes, but if you must prioritise then start from the top.
14 |
15 | * company, capf, eldoc: Complete Anything
16 |
17 | Your editor should be able to show you completions for anything you are currently typing. This list includes, but is not restricted to:
18 |
19 | - completion of functions, variables, types, namespaces, classes, plain-text.
20 | - completion of arguments, with doc-strings
21 |
22 | * xref, dump-jump, eglot: Jump to source and back
23 |
24 | Your editor should be able to jump to the definition of something on demand. This can be symbol at point (meaning word under the cursor) or can be anything I choose to enter
25 |
26 | - M-. :: Jump to the source of something
27 | - M-, :: Jump back from the source of something
28 |
29 | * flycheck, flymake: Check your syntax as you type
30 |
31 | Your editor must be able to integrate with a linter program. As you are typing code, it should be able to point out all the problems in your code without getting in your way or slowing you down.
32 |
33 | - C-c ! l :: List all errors
34 | - C-c ! n :: Go to the next error
35 | - C-c ! p :: Go to the previous error
36 | - M-g M-n :: Go to the next error
37 | - M-g M-p :: Go to the previous error
38 |
39 | * project.el: Understand and manipulate your project structure
40 |
41 | Your editor should have an understanding of the current project you are working in, as a whole. You should be able to quickly search for occurrences of certain words / phrases / symbols across the project. You should be able to pull up any file you wish in the project quickly, without needing to know exactly how the project is structured on disk
42 |
43 | - C-x p p :: Switch to a project on disk
44 | - C-x p f :: Find a file in the current project
45 | - C-x p G :: Search for something in the current project
46 |
47 | * magit: Use Git from the editor
48 |
49 | Your editor should be able to give you the full power of your version control system in your editor. This includes, but is not limited to: creating new commits, listing changes made in a certain file(s), jumping to different versions of the code in the VCS.
50 |
51 | - C-x g :: Access the magit-status buffer for your project.
52 | - C-c C-c :: Access the full set of possible actions in your buffer
53 | - M-x magit-blame-addition :: For each line of the current buffer, show the revision which it was added in
54 |
55 | * paredit: Edit code as a structured entity
56 |
57 | Your editor should be able to understand the semantics of your programming language. It should be able to recognise and move quickly between functions and expressions. It should be able to manipulate entire expressions in one go.
58 |
59 | - C-a :: ~beginning-of-line~
60 | - C-e :: ~end-of-line~
61 | - M-a :: ~backward-sentence~
62 | - M-e :: ~forward-sentence~
63 | - C-M-f :: ~forward-sexp~
64 | - C-M-b :: ~backward-sexp~
65 | - C-M-a :: ~beginning-of-defun~
66 | - C-M-e :: ~end-of-defun~
67 | - M-m :: ~back-to-indentation~
68 | - C-) :: ~paredit-forward-slurp-sexp~
69 | - C-( :: ~paredit-backward-slurp-sexp~
70 | - C-} :: ~paredit-forward-barf-sexp~
71 | - C-{ :: ~paredit-backward-barf-sexp~
72 |
73 | * helm, imenu and avy: Jump to important points in your code quickly
74 |
75 | Your editor should be able to jump to all the important points of your code in the least number of keystrokes (i.e. quickly). You should be able to quickly see all function names, type declarations, variable declarations in a given file and ideally in a given project as well. You should be able to jump to any word on the screen quickly.
76 |
77 | - C-x c i :: Show all the function, type, variable declaration names and be able to jump to any of them with a few keystrokes
78 | - C-x c b, C-c n :: Cycle through all the "sessions" and resume any you wish. A session here is a search of any kind that you have done before: for a file name, symbol name, variable listing, bookmarks etc
79 | - M-g SPC :: Jump to a word on screen by typing the starting character
80 |
81 | * eglot, cider, clj-refactor: Understand and refactor your programming language
82 |
83 | Your editor should have a clear understanding of the code you are writing, and should be able to help you change it faster. This includes, but is not limited to:
84 |
85 | - Refactoring support:
86 | + Being able to rename symbols across the project
87 | + Being able to suggest code clean up
88 | + Being able to quickly import / clean-up dependencies
89 |
90 | - Finding usages of code:
91 | + Being able to find all the places where a certain function is being used
92 |
93 | * cider-debug, gud: Debug your code using a powerful debugger
94 |
95 | Your editor should integrate with and start a debugger on demand. At least the basics of debugging (set breakpoints, step-in, step-out, see local variables) should be supported
96 |
97 | * yasnippet, org-capture: Support templates and expansion
98 |
99 | Your editor should support creation and fast usage of templates (snippets) for common boiler-plate functionality. This speeds up development and documentation tremendously.
100 |
101 | * kmacro-start-macro, multiple-cursors: Support automating fast edits
102 |
103 | Your editor should be able to help you with one-off weird edits, eg: automatically numbering every new line with an incrementing counter.
104 |
--------------------------------------------------------------------------------
/enhance/init-sql.el:
--------------------------------------------------------------------------------
1 | ;;; init-sql.el --- convenience functions for working with SQL. -*- lexical-binding: t -*-
2 | ;;; Author: Vedang Manerikar
3 | ;;; Created on: 19 Jul 2020
4 | ;;; Copyright (c) 2020 Vedang Manerikar
5 |
6 | ;; This file is not part of GNU Emacs.
7 |
8 | ;;; License:
9 |
10 | ;; This program is free software; you can redistribute it and/or
11 | ;; modify it under the terms of the Do What The Fuck You Want to
12 | ;; Public License, Version 2, which is included with this distribution.
13 | ;; See the file LICENSE.txt
14 |
15 | ;;; Commentary:
16 |
17 | ;;; To start a SQLi buffer + work against a database:
18 | ;; 1. M-x sql- (`sql-postgres'). If you have the dir-locals
19 | ;; file (see below), values will be auto filled in. This will start
20 | ;; an interactive SQL buffer.
21 | ;; 2. Open a .sql file to write SQL in.
22 | ;; 3. In this file, M-x `sql-set-product', followed by M-x
23 | ;; `sql-set-sqli-buffer'.
24 |
25 | ;;; To speed up connection to an SQL database, add the following to a
26 | ;;; `.dir-locals.el' file:
27 |
28 | ;; ((sql-mode . ((sql-product . postgres)
29 | ;; (sql-user . "pgw")
30 | ;; (sql-password . "")
31 | ;; (sql-port . 5432)
32 | ;; (sql-server . "192.168.33.10")
33 | ;; (sql-database . "pgw-main"))))
34 |
35 | ;;; Code:
36 |
37 | (defvar sql-history-folder
38 | (expand-file-name "temp-files/sql/" user-emacs-directory))
39 |
40 | (defun emacswiki/sql-save-history-hook ()
41 | "Save the command history from SQLi buffers."
42 | (let ((lval 'sql-input-ring-file-name)
43 | (rval 'sql-product))
44 | (if (symbol-value rval)
45 | (let ((filename
46 | (concat sql-history-folder
47 | (symbol-name (symbol-value rval))
48 | "-history.sql")))
49 | (set (make-local-variable lval) filename))
50 | (error
51 | (format "SQL history will not be saved because %s is nil"
52 | (symbol-name rval))))))
53 |
54 | (add-hook 'sql-interactive-mode-hook 'emacswiki/sql-save-history-hook)
55 |
56 | ;;; From:
57 | ;;; https://fluca1978.github.io/2022/04/13/EmacsPgFormatter.html, with
58 | ;;; minor modifications to add the function to a `before-save-hook`
59 | ;;; pg_format can be installed from: https://github.com/darold/pgFormatter
60 | (defun pgformatter-on-region ()
61 | "A function to invoke pgFormatter as an external program."
62 | (interactive)
63 | (let ((b (if mark-active (region-beginning) (point-min)))
64 | (e (if mark-active (region-end) (point-max)))
65 | (pgfrm (executable-find "pg_format")))
66 | (if pgfrm
67 | (let ((p (point)))
68 | (shell-command-on-region b e pgfrm (current-buffer) t)
69 | (goto-char p))
70 | (user-error "Could not find pg_format installed"))))
71 |
72 | (defun sql-format-buffer-on-save ()
73 | "When saving an SQL buffer, format it with pg_format."
74 | (add-hook 'before-save-hook #'pgformatter-on-region -10 t))
75 |
76 | (add-hook 'sql-mode-hook #'sql-format-buffer-on-save)
77 |
78 | (defun upcase-sql-keywords ()
79 | "Convert all SQL keywords to uppercase."
80 | (interactive)
81 | (save-excursion
82 | (dolist (keywords sql-mode-postgres-font-lock-keywords)
83 | (goto-char (point-min))
84 | (while (re-search-forward (car keywords) nil t)
85 | (goto-char (+ 1 (match-beginning 0)))
86 | (when (eql font-lock-keyword-face (face-at-point))
87 | (backward-char)
88 | (upcase-word 1)
89 | (forward-char))))))
90 |
91 | ;;; Taken from Stack overflow to deal with misaligned printing in the
92 | ;;; sqli buffer.
93 | ;; https://emacs.stackexchange.com/a/18403
94 |
95 | ;; Silence compiler warnings
96 | (defvar sql-product)
97 | (defvar sql-prompt-regexp)
98 | (defvar sql-prompt-cont-regexp)
99 |
100 | (defun emacswiki/sql-interactive-mode-hook ()
101 | "Custom interactive SQL mode behaviours. See `sql-interactive-mode-hook'."
102 | (when (eq sql-product 'postgres)
103 | ;; Allow symbol chars in database names in prompt.
104 | ;; Default postgres pattern was: (see `sql-product-alist').
105 | ;; :prompt-regexp "^[[:alnum:]_]*=[#>] "
106 | ;; :prompt-cont-regexp "^[[:alnum:]_]*[-(][#>] "
107 | (setq sql-prompt-regexp "^\\(?:\\sw\\|\\s_\\)*=[#>] ")
108 | (setq sql-prompt-cont-regexp "^\\(?:\\sw\\|\\s_\\)*[-(][#>] "))
109 |
110 | ;; Deal with inline prompts in query output.
111 | ;; Runs after `sql-interactive-remove-continuation-prompt'.
112 | (add-hook 'comint-preoutput-filter-functions
113 | 'emacswiki/sql-comint-preoutput-filter
114 | :append :local))
115 |
116 | (defun emacswiki/sql-comint-preoutput-filter (output)
117 | "Filter prompts out of SQL query OUTPUT.
118 |
119 | Runs after `sql-interactive-remove-continuation-prompt' in
120 | `comint-preoutput-filter-functions'."
121 | ;; If the entire output is simply the main prompt, return that.
122 | ;; (i.e. When simply typing RET at the sqli prompt.)
123 | (if (string-match (concat "\\`\\(" sql-prompt-regexp "\\)\\'") output)
124 | output
125 | ;; Otherwise filter all leading prompts from the output.
126 | ;; Store the buffer-local prompt patterns before changing buffers.
127 | (let ((main-prompt sql-prompt-regexp)
128 | (any-prompt comint-prompt-regexp) ;; see `sql-interactive-mode'
129 | (prefix-newline nil))
130 | (with-temp-buffer
131 | (insert output)
132 | (goto-char (point-min))
133 | (when (looking-at main-prompt)
134 | (setq prefix-newline t))
135 | (while (looking-at any-prompt)
136 | (replace-match ""))
137 | ;; Prepend a newline to the output, if necessary.
138 | (when prefix-newline
139 | (goto-char (point-min))
140 | (unless (looking-at "\n")
141 | (insert "\n")))
142 | ;; Return the filtered output.
143 | (buffer-substring-no-properties (point-min) (point-max))))))
144 |
145 | (add-hook 'sql-interactive-mode-hook 'emacswiki/sql-interactive-mode-hook)
146 |
147 | (defadvice sql-send-string (before my-prefix-newline-to-sql-string)
148 | "Force all `sql-send-*' commands to include an initial newline.
149 |
150 | This is a trivial solution to single-line queries tripping up my
151 | custom output filter. (See `emacswiki/sql-comint-preoutput-filter'.)"
152 | (ad-set-arg 0 (concat "\n" (ad-get-arg 0))))
153 |
154 | (ad-activate 'sql-send-string)
155 |
156 | (provide 'init-sql)
157 | ;;; init-sql.el ends here
158 |
--------------------------------------------------------------------------------
/init.el:
--------------------------------------------------------------------------------
1 | ;;; init.el --- Root emacs configuration file. -*- lexical-binding: t -*-
2 | ;;; Commentary:
3 | ;;; Author: Vedang Manerikar
4 | ;;; Created on: 08 Jan 2012
5 | ;;; Copyright (c) 2012 Vedang Manerikar
6 |
7 | ;; This file is not part of GNU Emacs.
8 |
9 | ;;; License:
10 |
11 | ;; This program is free software; you can redistribute it and/or
12 | ;; modify it under the terms of the Do What The Fuck You Want to
13 | ;; Public License, Version 2, which is included with this distribution.
14 | ;; See the file LICENSE.txt
15 |
16 | ;;; Code:
17 |
18 | ;;; To debug problems with packages (example org), a great technique
19 | ;;; is to drop into the debugger immediately after the problematic
20 | ;;; package loads:
21 | ;; (with-eval-after-load 'org (debug))
22 |
23 | (when (version< emacs-version "25")
24 | (error "Unsupported Emacs Version! Please upgrade to Emacs 25 or above. Emacs installation instructions: https://www.gnu.org/software/emacs/download.html"))
25 |
26 | (defvar *emacs-load-start* (current-time))
27 | (server-start)
28 | ;; ninja
29 | ;; master
30 | ;; humble
31 | ;; meditating
32 | (defvar on-my-mac-machine (string-match "raagitkombdi" (system-name)))
33 | (defvar on-my-linux-machine (string-match "zenkombda" (system-name)))
34 | (defvar on-my-machine (or on-my-mac-machine on-my-linux-machine))
35 |
36 | (defvar emacs-up--version "v3.1.0"
37 | "The current version of the Emacs Up Starter Kit.")
38 |
39 | (defun emacs-up-version ()
40 | "Return the current version of the Emacs Up Starter Kit."
41 | (interactive)
42 | (message "Emacs Up %s" emacs-up--version))
43 |
44 | ;;; Some global defs
45 |
46 | ;; Set a directory for temporary/state related files.
47 | (defvar dotfiles-dirname
48 | (file-name-directory (or load-file-name (buffer-file-name)))
49 | "The directory where this code is running from.
50 | Ideally, this will be ~/.emacs.d.")
51 | (defvar autoload-file
52 | (concat dotfiles-dirname "loaddefs.el")
53 | "File to generate and store autoload forms in.")
54 | (defvar personal-file
55 | (concat dotfiles-dirname "personal.el")
56 | "File to hold personal configuration - config outside of VCS control.")
57 | (defvar el-get-config-file
58 | (concat dotfiles-dirname "init-el-get.el")
59 | "File to load packages via el-get and to load associated configuration.")
60 |
61 | (defvar site-lisp-dirname
62 | (concat dotfiles-dirname "site-lisp/")
63 | "Extra configuration for packages that are built into Emacs.")
64 | (defvar enhance-dirname
65 | (concat dotfiles-dirname "enhance/")
66 | "Extra bits on Emacs Lisp to enhance to user experience.")
67 |
68 | (setq custom-file ; File to hold configuration written by Emacs itself
69 | (concat dotfiles-dirname "custom.el"))
70 |
71 | ;; Create temp directories if necessary
72 | (make-directory (concat user-emacs-directory "temp-files") t)
73 |
74 | (load custom-file nil nil t t)
75 | (load personal-file nil nil t t)
76 | (add-to-list 'load-path site-lisp-dirname)
77 | (add-to-list 'load-path enhance-dirname)
78 |
79 | ;;; El-Get for great good
80 | (load el-get-config-file nil nil t t)
81 | (when (eq system-type 'darwin)
82 | (require 'osx))
83 |
84 | ;;; Define my programming modes.
85 | (defvar vedang/programming-major-modes
86 | '(js2-mode c-mode c++-mode conf-mode clojure-mode erlang-mode
87 | emacs-lisp-mode lisp-mode scheme-mode python-mode)
88 | "List of programming modes that I use.")
89 |
90 |
91 | ;; The order of loading is important. Often times, the next package
92 | ;; presumes that the previous one has been loaded.
93 | (require 'core)
94 | (require 'site-lisp)
95 | (require 'utility-functions)
96 |
97 | (require 'extra-hooks)
98 | (require 'extra-bindings)
99 | (when on-my-machine
100 | ;; notmuch Emacs support should be installed alongwith notmuch. On
101 | ;; OSX, this can be done with:
102 |
103 | ;; $ brew install notmuch
104 | (add-to-list 'load-path "/usr/local/share/emacs/site-lisp/")
105 | (setq notmuch-init-file (concat enhance-dirname "init-notmuch.el"))
106 | (autoload 'notmuch "notmuch" "notmuch mail" t)
107 | (with-eval-after-load 'notmuch
108 | (require 'init-notmuch)))
109 |
110 | ;;; NOTE: Personal Experience: Theme stuff needs to load after
111 | ;;; everything else has loaded for the least number of surprises.
112 | ;;; Hence creating a function to capture this configuration and adding
113 | ;;; it as a hook to run post init.
114 | (defun vedang/theme-config (curr-theme)
115 | "All the configuration for the Emacs Themes I like.
116 |
117 | CURR-THEME is the theme that gets loaded. Available values:
118 | 'idea-darkula
119 | 'billw
120 | 'leuven
121 | 'poet
122 | 'moe
123 | 'modus"
124 | (cond
125 | ;;; Config for Darkula
126 | ((equal curr-theme 'idea-darkula)
127 | (progn
128 | (load-theme 'idea-darkula t)))
129 | ;;; Config for Billw
130 | ((equal curr-theme 'billw)
131 | (progn
132 | (color-theme-billw)))
133 | ;;; config for leuven
134 | ((equal curr-theme 'leuven)
135 | (progn
136 | (load-theme 'leuven-dark t)))
137 | ;;; Config for Poet
138 | ((equal curr-theme 'poet)
139 | (progn
140 | (load-theme 'poet-dark t)))
141 | ;;; Config for Moe
142 | ((equal curr-theme 'moe)
143 | (progn
144 | ;; Resize titles (optional).
145 | ;; Markdown and rst should have 6 elements, org should have 9 elements
146 | (setq moe-theme-resize-title-markdown
147 | '(2.0 1.7 1.5 1.3 1.0 1.0))
148 | ;; (setq moe-theme-resize-title-org
149 | ;; '(2.2 1.8 1.6 1.4 1.2 1.0 1.0 1.0 1.0))
150 | (setq moe-theme-resize-title-org nil)
151 | (setq moe-theme-resize-title-rst
152 | '(2.0 1.7 1.5 1.3 1.1 1.0))
153 | (setq moe-theme-highlight-buffer-id t)
154 | (require 'moe-theme)
155 | ;; Pune Lat Long: 18.5N, 73.8E
156 | (setq calendar-latitude +18)
157 | (setq calendar-longitude +73)
158 | ;; To enable automatic switching between day and night (based on
159 | ;; `calendar-latitude' and `calendar-longitude'), uncomment:
160 | ;; (require 'moe-theme-switcher)
161 | ;; To disable automatic switching once you have enabled it:
162 | ;; (moe-theme-switcher-disable)
163 | (moe-dark)
164 | ;; Note: The following lines have
165 | ;; to be after the theme is loaded
166 | ;; (via `moe-dark' or `moe-light')
167 | (powerline-moe-theme)
168 | (moe-theme-apply-color 'purple)
169 | ;; Available colors: blue, orange, green ,magenta, yellow,
170 | ;; purple, red, cyan, w/b.
171 |
172 | ;; To choose a color randomly:
173 | ;; (moe-theme-random-color)
174 | ))
175 |
176 | ((equal curr-theme 'default-dark)
177 | (progn
178 | ;;; dark on light default
179 | (set-background-color "grey15")
180 | (set-foreground-color "white")
181 | (spaceline-all-the-icons-theme)))
182 |
183 | ((equal curr-theme 'default-light)
184 | (progn
185 | ;;; light on dark default
186 | (set-background-color "white")
187 | (set-foreground-color "black")))
188 |
189 | ;; Config for Modus themes
190 | ((equal curr-theme 'modus)
191 | (progn
192 | (require-theme 'modus-themes)
193 | ;; Add all your customizations prior to loading the themes.
194 | ;; (setq modus-themes-italic-constructs t
195 | ;; modus-themes-bold-constructs nil)
196 | (load-theme 'modus-vivendi)))))
197 |
198 | ;;; NOTE: We also have theme configuration in `init-el-get.el', search
199 | ;;; for calls to `load-theme' in that file. Those are all turned off
200 | ;;; when the line below is turned on.
201 | ;; (add-hook 'after-init-hook (lambda () (vedang/theme-config 'modus)))
202 |
203 | (message "My .emacs loaded in %ds"
204 | (cl-destructuring-bind (hi lo ms psec) (current-time)
205 | (- (+ hi lo)
206 | (+ (first *emacs-load-start*)
207 | (second *emacs-load-start*)))))
208 | ;; (uf/totd)
209 |
210 | ;; Added by Package.el. This must come before configurations of
211 | ;; installed packages. Don't delete this line. If you don't want it,
212 | ;; just comment it out by adding a semicolon to the start of the line.
213 | ;; You may delete these explanatory comments.
214 | ;; (package-initialize)
215 |
216 | (provide 'init)
217 | ;;; init.el ends here
218 |
--------------------------------------------------------------------------------
/README.org:
--------------------------------------------------------------------------------
1 | #+title: Emacs Up: My personal El-get based Emacs configuration
2 | #+author: Vedang Manerikar
3 | #+last_updated: <2023-05-28 Sun>
4 |
5 | * This starter kit provides:
6 |
7 | 1. Working and well-tuned configurations for:
8 | - Clojure Programming (CIDER + other minor modes)
9 | - Emacs Lisp Programming (ElSpice + other minor modes)
10 | - Note-taking and Task-tracking through Org Mode
11 | - Email through Emacs (Notmuch + mbsync + msmtp)
12 |
13 | 2. Other minor but important additions:
14 | - Avy Mode (Jumping and Navigation)
15 | - Company Mode (Completion)
16 | - Helm Mode (Navigation)
17 | - Magit (Git Interface)
18 | - Multiple Cursors (Editing)
19 | - Paredit (Editing Lispy things)
20 | - YASnippets (Templating and Boiler Plate)
21 | - Correct path manipulation on OS X (System)
22 |
23 | 3. Better defaults than "pure" Emacs. And a number of other small but beautiful packages.
24 |
25 | * Pre-requisites
26 | :PROPERTIES:
27 | :CREATED: [2023-05-28 Sun 20:09]
28 | :ID: 492CBC79-1DF1-46CC-A9F9-604C6AE8AD2E
29 | :END:
30 |
31 | The following tools should be installed and available on the system:
32 | - [[http://git-scm.com/][git]]
33 | - [[http://mercurial.selenic.com/][mercurial]]
34 | - [[https://subversion.apache.org/][subversion]]
35 | - [[http://aspell.net/][aspell]]
36 | - [[https://www.gnu.org/software/automake/][automake]]
37 | - [[https://www.gnu.org/software/texinfo/][Texinfo]]
38 | - [[https://github.com/koalaman/shellcheck][Shellcheck]]
39 |
40 | Make sure that they are on $PATH.
41 |
42 | 1. On a Mac, these can all be installed through Homebrew as follows:
43 | #+begin_src sh
44 | brew install git mercurial aspell automake texinfo subversion shellcheck
45 | #+end_src
46 |
47 | 2. On Ubuntu, these can all be installed through Apt as follows:
48 | #+begin_src sh
49 | apt install git mercurial aspell automake texinfo subversion shellcheck
50 | #+end_src
51 |
52 | The following tools are optional, but recommended / needed for particular modes to work correctly.
53 | - [[https://notmuchmail.org/][notmuch]]: My preferred email client.
54 | - [[https://github.com/prettier/prettier-emacs][prettier]]: Provides formatting of JS code on save.
55 | - [[https://github.com/dandavison/delta][delta]]: Beautiful and fast diff tool.
56 | - [[https://github.com/ajeetdsouza/zoxide][zoxide]]: A smarter cd command
57 | - [[https://github.com/clj-kondo/clj-kondo][clj-kondo]]: A linter for Clojure code that sparks joy.
58 | - [[https://github.com/greglook/cljstyle][cljstyle]]: A tool for formatting Clojure code.
59 |
60 | * First-time installation instructions / Optional Pre-requisites
61 | :PROPERTIES:
62 | :CREATED: [2023-05-28 Sun 20:09]
63 | :ID: 8DEF2070-5BA5-475E-B9E6-3614FAD82EF3
64 | :END:
65 |
66 | ** Org Mode:
67 | :PROPERTIES:
68 | :CREATED: [2023-05-28 Sun 20:09]
69 | :ID: D648AA0E-3881-4CCF-ADF2-4801E3153604
70 | :END:
71 |
72 | For org-mode to work, you'll have to set your ~org-directory~. To do this, add the line
73 |
74 | #+begin_src emacs-lisp
75 | (setq org-directory "/path/to/org/directory")
76 | #+end_src
77 |
78 | somewhere in your Emacs config. I recommend that you create the file ~~/.emacs.d/personal.el~ and add the code to that file.
79 |
80 | For more information about the org config, take a look at [[https://github.com/vedang/org-mode-crate][vedang/org-mode-crate]]
81 |
82 | ** Clojure interactive development through Cider
83 | :PROPERTIES:
84 | :CREATED: [2023-05-28 Sun 20:09]
85 | :ID: F7F6DF37-6E6A-41E0-8395-17EF47C427E5
86 | :END:
87 |
88 | [[https://github.com/clojure-emacs/cider/][cider]] needs a one time setup of [[https://github.com/clojure-emacs/cider-nrepl/][cider-nrepl]], [[https://github.com/clojure-emacs/refactor-nrepl/][refactor-nrepl]] middleware in order to work properly. Please follow the installation instructions in the respective repos to install ~cider-nrepl~ and ~refactor-nrepl~.
89 |
90 | * Installation Instructions
91 | :PROPERTIES:
92 | :CREATED: [2023-05-28 Sun 20:07]
93 | :ID: 0D1C3749-5575-4EE8-AD4A-CFE97AC2CE18
94 | :END:
95 |
96 | 1. Clone the repository and move it to your ~.emacs.d~ folder
97 | #+begin_example
98 | $ cd /tmp/
99 | $ git clone https://github.com/vedang/emacs-up.git
100 | $ mv emacs-up ~/.emacs.d
101 | #+end_example
102 |
103 | 2. Make sure you've followed the One-Time installation instructions before proceeding.
104 |
105 | 3. Start Emacs. Make yourself a cup of tea.
106 | The first boot will trigger a (one-time) download of all the packages that Emacs-Up needs. This can take a lot of time. Sometimes (rarely) Emacs will stop and throw an error. If this happens, try re-starting Emacs. If the error is still being thrown, file an issue with me. Don't forget to include the stacktrace. Don't worry, your perfect environment is being baked with love.
107 |
108 | 4. ...
109 |
110 | 5. Profit!
111 |
112 | * Post-Installation instructions
113 | :PROPERTIES:
114 | :CREATED: [2023-05-28 Sun 20:06]
115 | :ID: 517D43E3-6EBA-4519-B4BC-B9DD8EC5FC95
116 | :END:
117 |
118 | ** All the Icons
119 | :PROPERTIES:
120 | :CREATED: [2023-05-28 Sun 20:06]
121 | :ID: 30980333-DBC9-4A30-B27D-F0A3E50A4B11
122 | :END:
123 |
124 | This configuration installs ~all-the-icons~ for pretty icons. All the Icons requires special fonts to be installed, which can be done with ~M-x all-the-icons-install-fonts~
125 |
126 | * Upgrading to the latest version of ~emacs-up~ from an older version
127 | :PROPERTIES:
128 | :CREATED: [2023-05-28 Sun 20:06]
129 | :ID: F1F517A7-F86B-4914-A2C8-197F6CE3FA46
130 | :END:
131 |
132 | 1. Close running ~emacs~ session
133 | 2. Fetch the latest changes from ~vedang/emacs-up~
134 | 3. Start ~emacs~ and run the following code:
135 | #+begin_example
136 | M-x el-get-self-update
137 | M-x el-get-update-all
138 | #+end_example
139 | 4. Restart ~emacs~
140 |
141 | * Features currently in experimental mode
142 | :PROPERTIES:
143 | :CREATED: [2023-05-28 Sun 20:05]
144 | :ID: CACF57C6-61E1-479A-923D-C07907BA1EFC
145 | :END:
146 | ** Using Tree Sitter with emacs-up
147 | :PROPERTIES:
148 | :CREATED: [2023-05-28 Sun 20:06]
149 | :ID: 4963A703-468F-4BA9-B680-590BCFBD36C0
150 | :END:
151 | ~emacs-up~ now uses the new ~tree-sitter~ support that Emacs 29+ brings for many programming modes (see list below). Getting this to work requires installing ~tree-sitter~ and the language grammars. I consider this as experimental at the moment, *you can skip this setup if you do not care of any of these languages*.
152 |
153 | The *pre-requisite* for this to work is that you need to install ~tree-sitter~ on your system. You can do this as follows:
154 | #+begin_src sh
155 | git clone https://github.com/tree-sitter/tree-sitter
156 | cd tree-sitter/
157 | make
158 | sudo make install
159 | #+end_src
160 |
161 | Here is the list of languages that use ~tree-sitter~ in this config, along with where we clone the grammars from:
162 |
163 | #+begin_src emacs-lisp
164 | '((bash "https://github.com/tree-sitter/tree-sitter-bash")
165 | (c "https://github.com/tree-sitter/tree-sitter-c")
166 | (cpp "https://github.com/tree-sitter/tree-sitter-cpp")
167 | (clojure "https://github.com/sogaiu/tree-sitter-clojure")
168 | (cmake "https://github.com/uyha/tree-sitter-cmake")
169 | (css "https://github.com/tree-sitter/tree-sitter-css")
170 | (elisp "https://github.com/Wilfred/tree-sitter-elisp")
171 | (html "https://github.com/tree-sitter/tree-sitter-html")
172 | (java "https://github.com/tree-sitter/tree-sitter-java")
173 | (javascript "https://github.com/tree-sitter/tree-sitter-javascript" "master" "src")
174 | (json "https://github.com/tree-sitter/tree-sitter-json")
175 | (make "https://github.com/alemuller/tree-sitter-make")
176 | (markdown "https://github.com/ikatyang/tree-sitter-markdown")
177 | (python "https://github.com/tree-sitter/tree-sitter-python")
178 | (rust "https://github.com/tree-sitter/tree-sitter-rust")
179 | (toml "https://github.com/tree-sitter/tree-sitter-toml")
180 | (tsx "https://github.com/tree-sitter/tree-sitter-typescript" "master" "tsx/src")
181 | (typescript "https://github.com/tree-sitter/tree-sitter-typescript" "master" "typescript/src")
182 | (yaml "https://github.com/ikatyang/tree-sitter-yaml"))
183 | #+end_src
184 |
185 | This list is maintained in the variable ~vedang/treesit-grammars~, in case you are interested in modifying it.
186 |
187 | Make sure you are using Emacs 29+ with ~tree-sitter~ support enabled. You can check this with ~C-h v system-configuration-features~. The output should have ~TREE_SITTER~ in it.
188 |
189 | ~emacs-up~ will install ~tree-sitter~ grammars automatically. We use code inspired from the ~combobulate~ README to do this. Check ~vedang/install-treesit-grammars-and-modes~ if you are curious.
190 |
--------------------------------------------------------------------------------
/site-lisp/core.el:
--------------------------------------------------------------------------------
1 | ;;; core.el --- customizing core emacs variables -*- lexical-binding: t -*-
2 | ;;; Author: Vedang Manerikar
3 | ;;; Created on: 13 Oct 2013
4 | ;;; Copyright (c) 2013 Vedang Manerikar
5 |
6 | ;; This file is not part of GNU Emacs.
7 |
8 | ;;; License:
9 |
10 | ;; This program is free software; you can redistribute it and/or
11 | ;; modify it under the terms of the Do What The Fuck You Want to
12 | ;; Public License, Version 2, which is included with this distribution.
13 | ;; See the file LICENSE.txt
14 |
15 | ;;; Commentary:
16 | ;; This file contains the basic configuration needed to get started
17 | ;; with Emacs.
18 |
19 | ;;; Code:
20 |
21 |
22 | (setq user-full-name "Vedang Manerikar"
23 | user-mail-address "vedang.manerikar@gmail.com"
24 | message-log-max t
25 | visible-bell t
26 | echo-keystrokes 0.1
27 | inhibit-startup-message t
28 | font-lock-maximum-decoration t
29 | confirm-kill-emacs 'y-or-n-p
30 | require-final-newline t
31 | ediff-window-setup-function 'ediff-setup-windows-plain
32 | column-number-mode t
33 | debug-on-error t
34 | browse-url-browser-function 'browse-url-default-browser
35 | bookmark-save-flag 1
36 | display-buffer-reuse-frames t
37 | whitespace-line-column 80
38 | recenter-positions '(top middle bottom)
39 | sentence-end-double-space nil
40 | display-time-day-and-date t
41 | prettify-symbols-unprettify-at-point 'right-edge
42 | set-mark-command-repeat-pop t)
43 |
44 | (setq tramp-default-method "ssh"
45 | tramp-shell-prompt-pattern
46 | "\\(?:^\\|\r\\)[^]#$%>\n]*#?[]#$%>].* *\\(^[\\[[0-9;]*[a-zA-Z] *\\)*")
47 |
48 | ;; Don't clutter up directories with files
49 | (setq backup-directory-alist
50 | `(("." . ,(locate-user-emacs-file "temp-files/backups"))))
51 |
52 | ;;; Increase display length of profiler output
53 | (with-eval-after-load 'profiler
54 | (setf (caar profiler-report-cpu-line-format) 80
55 | (caar profiler-report-memory-line-format) 80))
56 |
57 | ;;; Display garbage-collection messages, so that I can see impact on performance
58 | (when on-my-linux-machine (setq garbage-collection-messages t))
59 |
60 | (defvar vm/completion-ignored-extensions
61 | '(".exe" ".ps" ".abs" ".mx" ".~jv" ".rbc" ".beam" ".out" ".hbc")
62 | "Completion ignores filenames ending in any string in this list.")
63 |
64 | (dolist (ext vm/completion-ignored-extensions)
65 | (add-to-list 'completion-ignored-extensions ext))
66 |
67 | ;; Set path for saving desktop
68 | (require 'desktop)
69 | (add-to-list 'desktop-path (locate-user-emacs-file "temp-files/"))
70 |
71 | ;;; Everything in UTF8
72 | (prefer-coding-system 'utf-8)
73 | (set-default-coding-systems 'utf-8)
74 | (set-terminal-coding-system 'utf-8)
75 | (set-keyboard-coding-system 'utf-8)
76 | (when (boundp 'buffer-file-coding-system)
77 | (setq-default buffer-file-coding-system 'utf-8))
78 | (when (boundp 'default-buffer-file-coding-system)
79 | (setq default-buffer-file-coding-system 'utf-8))
80 | (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))
81 |
82 | (setq file-name-coding-system 'utf-8)
83 | (setq buffer-file-coding-system 'utf-8)
84 | (setq coding-system-for-write 'utf-8)
85 |
86 | (set-clipboard-coding-system 'utf-8)
87 | (set-selection-coding-system 'utf-8)
88 | (setq default-process-coding-system '(utf-8 . utf-8))
89 |
90 |
91 | (setq-default indent-tabs-mode nil ;only spaces by default.
92 | tab-width 4)
93 |
94 |
95 | (mouse-avoidance-mode 'exile)
96 | (delete-selection-mode t)
97 | (display-time)
98 |
99 |
100 | ;;; hooks
101 | (add-hook 'before-save-hook 'delete-trailing-whitespace)
102 | (add-hook 'text-mode-hook 'turn-on-visual-line-mode)
103 |
104 | (add-to-list 'safe-local-variable-values '(lexical-binding . t))
105 |
106 | ;; Enable narrow-to-region, extremely useful for editing text
107 | (put 'narrow-to-region 'disabled nil)
108 |
109 | ;; Zone
110 | (require 'zone)
111 | (zone-when-idle 300)
112 |
113 | ;; Tree-sitter
114 | (when (not (version< emacs-version "29"))
115 | (require 'treesit)
116 | (defvar vedang/treesit-grammars
117 | '((bash
118 | "https://github.com/tree-sitter/tree-sitter-bash"
119 | ("\\.\\(sh\\|bash\\)$" . bash-ts-mode))
120 | (c
121 | "https://github.com/tree-sitter/tree-sitter-c"
122 | ("\\.\\(c\\|h\\)$" . c-ts-mode))
123 | (cpp
124 | "https://github.com/tree-sitter/tree-sitter-cpp"
125 | ("\\.\\(cpp\\|hpp\\)$" . cpp-ts-mode))
126 | ;; Since this is my bread and butter language, I won't move to
127 | ;; tree-sitter until I'm happy with the status of the work.
128 | (clojure "https://github.com/sogaiu/tree-sitter-clojure" nil)
129 | (cmake
130 | "https://github.com/uyha/tree-sitter-cmake"
131 | ("\\(?:CMakeLists\\.txt\\|\\.cmake\\)\\'" . cmake-ts-mode))
132 | (css
133 | "https://github.com/tree-sitter/tree-sitter-css"
134 | ("\\.css\\'" . css-ts-mode))
135 | (elisp "https://github.com/Wilfred/tree-sitter-elisp" nil)
136 | (elixir "https://github.com/elixir-lang/tree-sitter-elixir"
137 | ("\\(\\.elixir\\|\\.elixir2\\)\\'" . elixir-ts-mode))
138 | (heex "https://github.com/phoenixframework/tree-sitter-heex" nil)
139 | (html
140 | "https://github.com/tree-sitter/tree-sitter-html"
141 | ("\\.\\(html\\|xhtml\\)$" . html-ts-mode))
142 | (java
143 | "https://github.com/tree-sitter/tree-sitter-java"
144 | ("\\.java\\'" . java-ts-mode))
145 | (javascript
146 | "https://github.com/tree-sitter/tree-sitter-javascript" "master" "src"
147 | ("\\(\\.js[mx]\\|\\.har\\)\\'" . js-ts-mode))
148 | (json
149 | "https://github.com/tree-sitter/tree-sitter-json"
150 | ("\\.json\\'" . json-ts-mode))
151 | ;; Waiting for -ts-mode variants to be available for these languages.
152 | (make "https://github.com/alemuller/tree-sitter-make" nil)
153 | (markdown "https://github.com/ikatyang/tree-sitter-markdown" nil)
154 | (python
155 | "https://github.com/tree-sitter/tree-sitter-python"
156 | ("\\.py[iw]?\\'" . python-ts-mode))
157 | (rust
158 | "https://github.com/tree-sitter/tree-sitter-rust"
159 | ("\\.rs\\'" . rust-ts-mode))
160 | (toml
161 | "https://github.com/tree-sitter/tree-sitter-toml"
162 | ("\\.toml\\'" . toml-ts-mode))
163 | (tsx
164 | "https://github.com/tree-sitter/tree-sitter-typescript" "master" "tsx/src"
165 | ("\\.tsx\\'" . tsx-ts-mode))
166 | (typescript
167 | "https://github.com/tree-sitter/tree-sitter-typescript" "master" "typescript/src"
168 | ("\\.ts\\'" . typescript-ts-mode))
169 | (yaml
170 | "https://github.com/ikatyang/tree-sitter-yaml"
171 | ("\\.ya?ml\\'" . yaml-ts-mode)))
172 | "Install tree-sitter grammars for these languages, from the URL sources.
173 |
174 | Enable the treesit versions of major modes for all languages where the final
175 | element of the list is non-nil.")
176 |
177 | (defun vedang/install-treesit-grammars-and-modes ()
178 | "Install grammars if they are missing, setup `auto-mode-alist` if requested.
179 |
180 | Borrows from `mickeynp/combobulate` install instructions."
181 | (interactive)
182 |
183 | (dolist (grammar vedang/treesit-grammars)
184 | (add-to-list 'treesit-language-source-alist
185 | (nbutlast (copy-sequence grammar)))
186 | ;; Only install `grammar' if we don't already have it
187 | ;; installed. However, if you want to *update* a grammar then
188 | ;; this obviously prevents that from happening.
189 | (unless (treesit-language-available-p (car grammar))
190 | (treesit-install-language-grammar (car grammar)))
191 |
192 | ;; Once installed, add the appropriate settings to the
193 | ;; `auto-mode-alist` to enable this grammar.
194 | (when (and (treesit-ready-p (car grammar))
195 | (car (last grammar)))
196 | (add-to-list 'auto-mode-alist (car (last grammar))))))
197 |
198 | ;;; Install treesit grammars
199 | (vedang/install-treesit-grammars-and-modes)
200 |
201 | ;;; Open these files in the appropriate mode
202 | (add-to-list 'auto-mode-alist '("\\.\\(mc\\|rc\\|def\\)$" . conf-mode))
203 | (add-to-list 'auto-mode-alist '("\\.\\(erl\\|hrl\\)$" . erlang-mode))
204 | (add-to-list 'auto-mode-alist '("\\.\\(tex\\|ltx\\)$" . LaTeX-mode))
205 | (add-to-list 'auto-mode-alist '("Vagrantfile$" . ruby-mode))
206 | (if (eq system-type 'darwin)
207 | (add-to-list 'auto-mode-alist '("\\.m$" . objc-mode))
208 | (add-to-list 'auto-mode-alist '("\\.m$" . octave-mode)))
209 |
210 | (defun mp-remove-treesit-sexp-changes ()
211 | (when (eq forward-sexp-function #'treesit-forward-sexp)
212 | (setq forward-sexp-function nil))
213 | (when (eq transpose-sexps-function #'treesit-transpose-sexps)
214 | (setq transpose-sexps-function #'transpose-sexps-default-function))
215 | (when (eq forward-sentence-function #'treesit-forward-sentence)
216 | (setq forward-sentence-function #'forward-sentence-default-function)))
217 |
218 | (add-hook 'prog-mode-hook #'mp-remove-treesit-sexp-changes))
219 |
220 | ;;; ask xref to use ripgrep (Emacs 28 and higher)
221 | (require 'xref)
222 | (setq xref-search-program
223 | (if (or (executable-find "rg")
224 | (executable-find "ripgrep"))
225 | 'ripgrep
226 | 'grep))
227 |
228 | (provide 'core)
229 | ;;; core.el ends here
230 |
--------------------------------------------------------------------------------
/enhance/rcirc-notify.el:
--------------------------------------------------------------------------------
1 | ;;; rcirc-notify.el --- libnotify popups -*- lexical-binding: t -*-
2 |
3 | ;; Copyright (c) 2008 Will Farrington
4 | ;; Copyright (c) 2009, 2011 Alex Schroeder
5 |
6 | ;; Author: Will Farrington, Alex Schroeder , Nic Ferrier
7 | ;; Maintainer: Nic Ferrier
8 | ;; Created: 13th October 2011
9 | ;; Version: 0.7
10 | ;; Keywords: lisp, rcirc, irc, notify, growl
11 |
12 | ;; This file is NOT part of GNU Emacs.
13 |
14 | ;; This program is free software; you can redistribute it and/or
15 | ;; modify it under the terms of the GNU General Public License as
16 | ;; published by the Free Software Foundation; either version 3 of
17 | ;; the License, or (at your option) any later version.
18 | ;;
19 | ;; This program is distributed in the hope that it will be
20 | ;; useful, but WITHOUT ANY WARRANTY; without even the implied
21 | ;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
22 | ;; PURPOSE. See the GNU General Public License for more details.
23 | ;;
24 | ;; You should have received a copy of the GNU General Public
25 | ;; License along with this program; if not, write to the Free
26 | ;; Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
27 | ;; MA 02111-1307 USA
28 |
29 | ;;; Changelog:
30 | ;; * 2013/09/04 - Add support for terminal-notifier.
31 | ;;
32 | ;; * 2011/10/13 - Clean up the namespace, add customization, prevent
33 | ;; notifys if you have the rcirc buffer open in a frame
34 | ;;
35 | ;; * 2011/04/13 - Support for Growl on Windows; support for
36 | ;; rcirc-keywords.
37 | ;;
38 | ;; * 2011/01/31 - Fix two warnings -Stefan Kangas
39 | ;;
40 | ;; * 2009/10/17 - Added support for osascript which is a Mac OS X
41 | ;; what Mac OS 10.4 and Growl 1.1.6 require.
42 | ;;
43 | ;; * 2009/02/23 - Added support for growlnotify which is a Mac OS X
44 | ;; notification tool. http://growl.info -Shane Celis
45 | ;;
46 | ;; * 2008/12/29 - Fix annoying bug where the user gets notified
47 | ;; for every PRIVMSG and added new variable specifying
48 | ;; format of message when a PRIVMSG is received
49 | ;;
50 | ;; * 2008/02/11 - Fix an annoying bug where the user got
51 | ;; notified every message
52 | ;;
53 | ;; * 2008/02/11 - First release
54 |
55 |
56 | ;;; Commentary:
57 | ;;
58 | ;; This code is inspired in part by erc-page-me.el and offers
59 | ;; the same functionality as it, but for rcirc.
60 | ;;
61 | ;; * `rcirc-notify-message` contains the message contents for
62 | ;; the notification
63 | ;;
64 | ;; * `rcirc-notify-message-private` contains the message
65 | ;; contents for a private message notification
66 | ;;
67 | ;; * `rcirc-notify-nick-alist` is a list containing the last
68 | ;; folks who notified you, and what times they did it at
69 | ;;
70 | ;; * `rcirc-notify-timeout` controls the number of seconds
71 | ;; in between notifications from the same nick.
72 |
73 | ;; Grow For Windows
74 | ;; Run something like this from eshell before you use rcirc-notify:
75 | ;; /Programme/Growl\ for\ Windows/growlnotify.com /t:IRC \
76 | ;; /ai:http://www.emacswiki.org/pics/static/CarbonEmacsPackageIcon.png \
77 | ;; /a:Emacs /r:IRC /n:IRC foo
78 |
79 | (require 'rcirc)
80 | (require 'cl) ;; needed for 'some'
81 |
82 | (defgroup rcirc-notify nil
83 | "Notifications for the rcirc IRC client."
84 | :group 'rcirc
85 | )
86 |
87 | (defcustom rcirc-notify-message "%s mentioned you: %s"
88 | "Format of the message to display in the popup.
89 | The first %s will expand to the nick that notified you,
90 | the second %s (if any) will expand to the message text itself."
91 | :type '(string)
92 | :group 'rcirc-notify
93 | )
94 |
95 | (defcustom rcirc-notify-keywords t
96 | "Non-nil means matches of `rcirc-keywords' will result in notification.
97 | See `rcirc-notify-keyword' for the message format to use."
98 | :type '(boolean)
99 | :group 'rcirc-notify
100 | )
101 |
102 | (defcustom rcirc-notify-check-frame nil
103 | "When a notify happens check if RCIRC buffer is open in a frame.
104 | If you don't want notifications if you have rcirc open in a frame
105 | then turn this on and they won't be delivered."
106 | :type '(boolean)
107 | :group 'rcirc-notify)
108 |
109 | (defcustom rcirc-notify-keyword "%s mentioned the keyword '%s': %s"
110 | "Format of the message to display in the popup.
111 | The first %s will expand to the nick that mentioned the keyword,
112 | the second %s (if any) will expand to the keyword used,
113 | the third %s (if any) will expand to the message text itself.
114 | This only happens if `rcirc-notify-keywords' is non-nil."
115 | :type '(string)
116 | :group 'rcirc-notify
117 | )
118 |
119 | (defcustom rcirc-notify-message-private "%s sent a private message: %s"
120 | "Format of the message to display in the popup.
121 | The first %s will expand to the nick that notified you,
122 | the second %s (if any) will expand to the message text itself."
123 | :type '(string)
124 | :group 'rcirc-notify
125 | )
126 |
127 | (defcustom rcirc-notify-popup-timeout 8640000
128 | "Number of seconds to show the notifcation popup, if relevant.
129 | If the notification is done via an operating system popup message
130 | then this controls the timeout of that popup."
131 | :type '(integer)
132 | :group 'rcirc-notify
133 | )
134 |
135 | (defcustom rcirc-notify-timeout 60
136 | "Seconds between notifications from the same person."
137 | :type '(integer)
138 | :group 'rcirc-notify
139 | )
140 |
141 | (defvar rcirc-notify--nick-alist nil
142 | "An alist of nicks and the last time they tried to trigger a notification."
143 | )
144 |
145 |
146 |
147 | (defun rcirc-notify-page-me (msg)
148 | (cond
149 | ((executable-find "notify-send")
150 | (start-process "page-me"
151 | nil
152 | ;; 8640000 ms = 1 day
153 | "notify-send"
154 | "-u" "normal"
155 | "-i" "gtk-dialog-info"
156 | "-t" (format "%s" rcirc-notify-popup-timeout)
157 | "rcirc: "
158 | msg))
159 | ((executable-find "terminal-notifier")
160 | (start-process "page-me" "*debug*" "terminal-notifier" "-activate" "org.gnu.Emacs" "-message" msg "-title" "RCIRC"))
161 | ((executable-find "terminal-notify")
162 | (start-process "page-me" "*debug*" "terminal-notify" "-activate" "org.gnu.Emacs" "-message" msg))
163 | ((executable-find "growlnotify.com")
164 | (start-process "page-me" "*debug*" "growlnotify.com" "/a:Emacs" "/n:IRC" msg))
165 | ((executable-find "growlnotify")
166 | (start-process "page-me" "*debug*" "growlnotify" "-a" "Emacs" "-m" msg))
167 | ((executable-find "osascript")
168 | (apply 'start-process `("page-me" nil
169 | "osascript"
170 | "-e" "tell application \"GrowlHelperApp\""
171 | "-e" "register as application \"Emacs\" all notifications {\"rcirc\"} default notifications {\"rcirc\"}"
172 | "-e" ,(concat "notify with name \"rcirc\" title \"rcirc\" description \""
173 | msg "\" application name \"Emacs\"")
174 | "-e" "end tell")))
175 | (t (error "No method available to page you"))))
176 |
177 | (defun rcirc-notify (sender &optional text)
178 | (when window-system
179 | ;; Set default dir to appease the notification gods
180 | (let ((default-directory "~/"))
181 | (rcirc-notify-page-me (format rcirc-notify-message sender text)))))
182 |
183 | (defun rcirc-notify-keyword (sender &optional keyword text)
184 | (when window-system
185 | ;; Set default dir to appease the notification gods
186 | (let ((default-directory "~/"))
187 | (rcirc-notify-page-me (format rcirc-notify-keyword sender keyword text)))))
188 |
189 | (defun rcirc-notify-private (sender &optional text)
190 | (when window-system
191 | ;; Set default dir to appease the notification gods
192 | (let ((default-directory "~/"))
193 | (rcirc-notify-page-me (format rcirc-notify-message-private sender text)))))
194 |
195 | (defun rcirc-notify-allowed (nick &optional delay)
196 | "Return non-nil if a notification should be made for NICK.
197 | If DELAY is specified, it will be the minimum time in seconds
198 | that can occur between two notifications. The default is
199 | `rcirc-notify-timeout'."
200 | ;; Check current frame buffers
201 | (let ((rcirc-in-a-frame-p
202 | (some (lambda (f)
203 | (and (equal "rcirc" (cdr f))
204 | (car f)))
205 | (mapcar (lambda (f)
206 | (let ((buffer (car (frame-parameter f 'buffer-list))))
207 | (with-current-buffer buffer
208 | (cons buffer mode-name))))
209 | (visible-frame-list)))))
210 | (if (and rcirc-notify-check-frame (not rcirc-in-a-frame-p))
211 | (progn
212 | (unless delay (setq delay rcirc-notify-timeout))
213 | (let ((cur-time (float-time (current-time)))
214 | (cur-assoc (assoc nick rcirc-notify--nick-alist))
215 | (last-time))
216 | (if cur-assoc
217 | (progn
218 | (setq last-time (cdr cur-assoc))
219 | (setcdr cur-assoc cur-time)
220 | (> (abs (- cur-time last-time)) delay))
221 | (push (cons nick cur-time) rcirc-notify--nick-alist)
222 | t)))
223 | t)))
224 |
225 | ;;;###autoload
226 | (defun rcirc-notify-me (proc sender response target text)
227 | "Notify the current user when someone sends a message that
228 | matches the current nick."
229 | (interactive)
230 | (when (and (not (string= (rcirc-nick proc) sender))
231 | (not (string= (rcirc-server-name proc) sender))
232 | (rcirc-notify-allowed sender))
233 | (cond ((string-match (rcirc-nick proc) text)
234 | (rcirc-notify sender text))
235 | (rcirc-notify-keywords
236 | (let ((keyword (catch 'match
237 | (dolist (key rcirc-keywords)
238 | (when (string-match (concat "\\<" key "\\>")
239 | text)
240 | (throw 'match key))))))
241 | (when keyword
242 | (rcirc-notify-keyword sender keyword text)))))))
243 |
244 | ;;;###autoload
245 | (defun rcirc-notify-privmsg (proc sender response target text)
246 | "Notify the current user when someone sends a private message
247 | to them."
248 | (interactive)
249 | (when (and (string= response "PRIVMSG")
250 | (not (string= sender (rcirc-nick proc)))
251 | (not (rcirc-channel-p target))
252 | (rcirc-notify-allowed sender))
253 | (rcirc-notify-private sender text)))
254 |
255 | ;;;###autoload
256 | (defun rcirc-notify-add-hooks ()
257 | "Initialize rcirc-notify into rcirc with hooks."
258 | (add-hook 'rcirc-print-hooks 'rcirc-notify-privmsg)
259 | (add-hook 'rcirc-print-hooks 'rcirc-notify-me)
260 | )
261 |
262 | (provide 'rcirc-notify)
263 |
264 | ;;; rcirc-notify.el ends here
265 |
--------------------------------------------------------------------------------
/docs/20160711T195101--01-an-opinionated-emacs-tutorial.org:
--------------------------------------------------------------------------------
1 | :PROPERTIES:
2 | :ID: 20160711T195101
3 | :CREATED: [2016-07-11 Mon 19:51]
4 | :END:
5 | #+title: 01 An Opinionated Emacs Tutorial
6 | #+subtitle: Getting started fast.
7 | #+author: Vedang Manerikar
8 | #+email: vedang.manerikar@gmail.com
9 | #+date: [2016-07-11 Mon 19:51]
10 | #+filetags:
11 | #+identifier: 20160711T195101
12 |
13 | If you have opened this document inside Emacs and do not now how to open up the sections to see the content, press three times (until the minibuffer at the bottom of the screen says SHOW ALL).
14 |
15 | * What is Emacs?
16 |
17 | - Emacs is a Lisp programming environment.
18 | - ...which happens to be good for editing things.
19 | - Notes for going through this file:
20 | + If you see C-x :: this means that you should hold down the Ctrl Key and press x.
21 | + If you see M-x :: this means that you should hold down the Meta Key (more on what this is in the next point) and press x.
22 |
23 | ** You should remap your Caps Lock key to become your Ctrl Key.
24 |
25 | You can do this by going to: *System Preferences* -> *Keyboard* -> *Modifier Keys* -> _Change Caps Lock key to mean Ctrl_.
26 |
27 | This configuration sets your Cmd key to be the Meta key inside Emacs (automatically). So every time you are supposed to press the Meta key, you should press the Cmd key.
28 |
29 | ** You should remap your Lock Screen shortcut in Mac
30 |
31 | The default lock screen shortcut is =C-M-q=, but this is a critical shortcut for Lisp programming in Emacs. In order to change it:
32 | + Launch System Preferences and go to the Keyboard pane.
33 | + Select the 'Shortcuts' tab.
34 | + From the list on the left, select 'App Shortcuts'.
35 | + Click on the plus (+) button below to add your new shortcut.
36 | + In the dialog box we'll want to leave 'All Applications' selected in the first menu. Enter 'Lock Screen' as the Menu Title. Please note this has to be exactly the same name for this to work. (It has to do with Automator entries in Mac). Finally, enter your keyboard shortcut. Let's go with Option+Shift+Q
37 | + Click Add and you're all done!
38 |
39 | * A more important question: Why should you care?
40 |
41 | You should care about your editor because it is one of the core tools you will employ when programming. You will spend a large amount of your time inside an editor. Therefore, you should choose a powerful editor and master it.
42 |
43 | * Getting started with Emacs: Problems
44 |
45 | - Completely different terminology.
46 | - Unfamiliarity with configuration systems.
47 | - Also, unfamiliarity with Lisp in general and elisp is particular.
48 | - Lack of a comprehensive beginner guide outside of Emacs.
49 | - Emacs defaults are not optimal.
50 | - ...though it is getting better with every release.
51 |
52 | * Starter Kits vs Starting from scratch
53 |
54 | - Without knowing how Emacs loads configuration, understanding existing configuration is hard.
55 | - Too hard to figure out where to start.
56 | - We are going to fix that!
57 |
58 | * What is my 'init' file?
59 |
60 | - =~/.emacs.d/init.el=
61 | - This loads extra config over the defaults when you start Emacs.
62 |
63 | * Basic Operations
64 |
65 | - C-x C-f :: ~find-file~ Opens a file for editing.
66 | - C-x C-s :: ~save-buffer~ Saves changes to disk.
67 | - C-x C-c :: ~save-buffers-kill-terminal~ Exits Emacs
68 | - C-x k :: ~kill-buffer~ Close a file
69 |
70 | * Terminology
71 |
72 | Terminology in Emacs is unfamiliar because Emacs was designed before the terms you are familiar with today were invented! Spend some time understanding the following terms in order to better read any tutorial or blogpost on Emacs. Ask your mentor to explain these to you:
73 |
74 | - Buffers
75 | - Windows
76 | - Frames
77 | - Other oddities
78 | - Killing
79 | - Yanking
80 |
81 | * A little theory: Modes
82 |
83 | Once again, ask your mentor to explain to you what these terms mean inside Emacs. Minor modes enable all the composability of functionality inside Emacs.
84 |
85 | - Major Mode
86 | - Minor Modes
87 |
88 | * Helping yourself
89 |
90 | - C-h :: The Great Emacs Self-Help system.
91 | - C-h f :: (function) Display documentation for the given function.
92 | - C-h k :: (keys) Display the full documentation for the key sequence.
93 | - C-h v :: (variable) Display the given variable's documentation and value.
94 | - C-h w :: (command) Display which keystrokes invoke the given command (where-is).
95 | - C-h P :: (package) Describe the given Emacs Lisp package.
96 | - C-h p :: (topic) Find packages matching a given topic keyword.
97 | - C-h t :: Comprehensive Emacs tutorial for getting started with Emacs.
98 | - C-h :: All bindings available within the specified prefix binding.
99 |
100 | * Movement
101 |
102 | ** Step, Step, Step
103 |
104 | - C-f :: ~forward-char~
105 | - C-b :: ~backward-char~
106 | - C-n :: ~next-line~
107 | - C-p :: ~previous-line~
108 | - M-f :: ~forward-word~
109 | - M-b :: ~backward-word~
110 | - M-n :: advancing options (will be demo'd later)
111 | - M-p :: retreating options (will be demo'd later)
112 |
113 | ** More?
114 |
115 | Emacs understands semantic groups. Commands:
116 | - C-a :: ~beginning-of-line~
117 | - C-e :: ~end-of-line~
118 | - M-a :: ~backward-sentence~
119 | - M-e :: ~forward-sentence~
120 | - C-M-f :: ~forward-sexp~
121 | - C-M-b :: ~backward-sexp~
122 | - C-M-a :: ~beginning-of-defun~
123 | - C-M-e :: ~end-of-defun~
124 | - M-m :: ~back-to-indentation~
125 |
126 | ** What if you want to move N times?
127 |
128 | The Optional Argument: Augument the behaviour of your functions.
129 | - C-u :: ~universal-argument~
130 | - C-u :: do this ~N~times (The N stands for a digit value)
131 | - M- :: a shortcut to C-u
132 |
133 | ** Directional Editing aka Driving in Reverse
134 |
135 | - M-- :: ~negative-argument~
136 | - Favorite places of using this:
137 | + M-c :: ~capitalize-word~
138 | + M-l :: ~downcase-word~
139 | + M-u :: ~upcase-word~
140 |
141 | ** Final Notes
142 |
143 | Optional and negative arguments are extremely powerful, and enable surprisingly powerful movement. Be sure to try out these arguments on the commands you regularly use.
144 |
145 | * Finding things
146 |
147 | ** Jump to a point by searching for it.
148 |
149 | This is a ton of text I don't care about:
150 |
151 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
152 |
153 | I'd rather be here:
154 |
155 | - C-s :: ~isearch-forward-regexp~
156 | - C-r :: ~isearch-backward-regexp~
157 | - C-s :: ~isearch-repeat-forward~
158 | - C-r :: ~isearch-repeat-backward~
159 | - C-w :: ~isearch-yank-word-or-char~
160 | - C-y :: ~isearch-yank-kill~
161 | - C-M-y :: Yank one char at a time
162 | - C-M-z :: Yank upto given char
163 | - M-s C-e :: Yank to the end of the line
164 |
165 | ** A segue into History: The Mark and the Point
166 |
167 | - What is a mark?
168 | - What is a point?
169 | - What is a region?
170 | - Jumping to marks
171 | - C-SPC :: ~set-mark-command~ (Drops a mark)
172 | - C-u C-SPC :: (Jumps to previously dropped mark)
173 | - C-x C-SPC :: ~pop-global-mark~
174 | - How this ties into search: All non-deterministic movement drops a mark that can be followed back
175 |
176 | ** Searching Redux : Occur
177 |
178 | - M-s o :: ~occur~
179 |
180 | ** A segue into Composability: next-error and prev-error
181 |
182 | This minor mode is auto activated for any Results buffer: compilation, grep, occur are some examples.
183 |
184 | - M-g M-n :: ~next-error~
185 | - M-g M-p :: ~prev-error~
186 |
187 | ** Searching Redux : Grep
188 |
189 | Emacs implementation of Unix Grep
190 |
191 | - M-x rgrep
192 |
193 | * Editing
194 |
195 | ** Basics
196 |
197 | - C-d :: ~delete-char~
198 | - M-d :: ~kill-word~
199 | - C-k :: ~kill-line~
200 | - C-w :: ~kill-region~
201 | - C-y :: ~yank~
202 | - M-y :: ~yank-pop~
203 | - M-w :: ~kill-ring-save~
204 |
205 | ** Semantic Killing
206 |
207 | - M-k :: ~kill-sentence~
208 | - C-M-k :: ~kill-sexp~
209 |
210 | ** Regions and Rectangles
211 |
212 | - C-w :: ~kill-region~
213 | - C-x r k :: ~kill-rectangle~
214 |
215 | ** A segue into Rings
216 |
217 | - What are rings?
218 | - ~kill-ring~, ~mark-ring~, ~undo-ring~, blah blah blah
219 |
220 | ** query-replace-regex
221 |
222 | - ~M-x query-replace-regex~
223 |
224 | * Leveling up
225 |
226 | ** Helm : Completion for the win
227 |
228 | - C-x c :: the default helm prefix key
229 | - C-x b :: ~helm-mini~ (Buffer and File selector via helm)
230 | - C-x C-f :: ~helm-find-files~ (Open a new/existing file)
231 | - C-x c i :: ~helm-semantic-or-imenu~ (Access imenu via helm)
232 | - C-x c b :: ~helm-resume~ (Go back to the previous Helm Session)
233 | - C-c n :: ~helm-resume~ (Go back through all the Helm sessions you have open, repeatedly click C-c n to cycle)
234 | - M-y :: ~helm-show-kill-ring~ (Access the kill-ring via helm)
235 | - C-x c r b :: ~helm-filtered-bookmarks~ (Access bookmarks via helm)
236 | - C-x c r i :: ~helm-register~ (Access registers via helm)
237 |
238 | ** Imenu : Suggestions for places to Jump to
239 |
240 | - ~M-x imenu~
241 | - C-x c i :: binding for imenu in ~helpshift/emacs-up~
242 |
243 | ** Avy: Jumping elsewhere
244 |
245 | - M-g g :: ~avy-goto-line~ (Jump to line start or line number)
246 | - M-g SPC :: ~avy-goto-word-1~ (Jump to a word by typing start CHAR)
247 | - M-g C-j :: ~avy-resume~ (Resume the last jump session)
248 |
249 | ** A segue into temporary and permanent markers
250 |
251 | - Registers
252 | + C-x r SPC :: ~point-to-register~
253 | + C-x r j :: ~jump-to-register~
254 | + C-x r s :: ~copy-to-register~
255 | + C-x r i :: ~insert-register~
256 | - Bookmarks
257 | + C-x r m :: ~bookmark-set~
258 | + C-x r b :: ~bookmark-jump~
259 | + C-x r l :: ~bookmark-list~
260 |
261 | * TODO Lispy Editing with Paredit
262 | :LOGBOOK:
263 | - State "TODO" from [2021-07-20 Tue 23:33]
264 | :END:
265 |
266 | Open a clojure or emacs lisp file to try these commands out:
267 |
268 | - ( :: opening brackets - excellent example of digit keys
269 | - C-) :: ~paredit-forward-slurp-sexp~
270 | #+begin_example
271 | (foo (bar |baz) quux zot)
272 | ->
273 | (foo (bar |baz quux) zot)
274 | #+end_example
275 | - C-( :: ~paredit-backward-slurp-sexp~
276 | #+begin_example
277 | (foo bar (baz| quux) zot)
278 | ->
279 | (foo (bar baz| quux) zot)
280 | #+end_example
281 | - C-} :: ~paredit-forward-barf-sexp~
282 | #+begin_example
283 | (foo (bar |baz quux) zot)
284 | ->
285 | (foo (bar |baz) quux zot)
286 | #+end_example
287 | - C-{ :: ~paredit-backward-barf-sexp~
288 | #+begin_example
289 | (foo (bar baz |quux) zot)
290 | ->
291 | (foo bar (baz |quux) zot)
292 | #+end_example
293 | - @TODO :: entering and exiting
294 | - @TODO :: splicing
295 |
296 | # LocalWords: Composability
297 |
--------------------------------------------------------------------------------
/enhance/denote-publish.el:
--------------------------------------------------------------------------------
1 | ;;; denote-publish.el --- Publish my denote files as md files -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2024 Vedang Manerikar
4 |
5 | ;; Author: Vedang Manerikar
6 | ;; Keywords: hypermedia, text
7 |
8 | ;; This program is free software; you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 |
23 | ;; This code takes different project notes, and publishes them as
24 | ;; markdown with the correct front-matter.
25 |
26 | ;; To see the custom options that the exporter supports, see the
27 | ;; `options-alist' in the `org-export-define-derived-backend'.
28 |
29 | ;;; Code:
30 |
31 | (require 'ox-publish)
32 | (require 'ox-md)
33 | (require 'ox-gfm)
34 | (require 'denote-org-extras)
35 |
36 | ;; ## The new exporter backend
37 | ;; We extend ox-gfm to get the properties we want
38 |
39 | (org-export-define-derived-backend 'denote-publish 'gfm
40 | :translate-alist
41 | '((link . denote-publish-link))
42 | :options-alist
43 | '((:with-drawers nil nil nil t)
44 | (:aliases "ALIASES" nil nil t)
45 | (:subtitle "SUBTITLE" nil nil t)
46 | (:identifier "IDENTIFIER" nil nil t)
47 | (:skip_archive "SKIP_ARCHIVE" nil nil t)
48 | (:has_code "HAS_CODE" nil nil t)
49 | (:og_image "OG_IMAGE" nil nil t)
50 | (:og_description "OG_DESCRIPTION" nil nil t)
51 | (:og_video_id "OG_VIDEO_ID" nil nil t)))
52 |
53 | ;; ## Project-specific directories
54 | (defvar vm-base-dir)
55 | (defvar vm-publishing-dir)
56 |
57 | ;; ## Convert the Front-Matter from org to md format.
58 |
59 | (setq vm-base-dir (expand-file-name "~/Tresors/Documents/diary/notes/published")
60 | vm-publishing-dir (expand-file-name "~/src/prototypes/vedang.me/v7/components/content/resources/content"))
61 |
62 |
63 | (defvar denote-publish--date-time-regexp
64 | (concat "\\`[[:digit:]]\\{4\\}-[[:digit:]]\\{2\\}-[[:digit:]]\\{2\\}"
65 | "\\(?:T[[:digit:]]\\{2\\}:[[:digit:]]\\{2\\}:[[:digit:]]\\{2\\}"
66 | "\\(?:Z\\|[+-][[:digit:]]\\{2\\}:[[:digit:]]\\{2\\}\\)*\\)*\\'")
67 | "Regexp to match the time stamp strings.
68 |
69 | Reference: https://tools.ietf.org/html/rfc3339#section-5.8
70 |
71 | Examples:
72 | 2017-07-31
73 | 2017-07-31T17:05:38
74 | 2017-07-31T17:05:38Z
75 | 2017-07-31T17:05:38+04:00
76 | 2017-07-31T17:05:38-04:00.")
77 |
78 | (defun denote-publish--yaml-quote-string (val)
79 | "Wrap VAL with quotes as appropriate.
80 |
81 | VAL can be a string, symbol, number or nil.
82 |
83 | VAL is returned as-it-is under the following cases:
84 | - It is a number.
85 | - It is a string and is already wrapped with double quotes.
86 | - It is a string and it's value is \"true\" or \"false\".
87 | - It is a string representing a date.
88 | - It is a string representing an integer or float.
89 |
90 | If VAL is nil or an empty string, a quoted empty string \"\" is
91 | returned."
92 | (cond
93 | ((null val) val)
94 | ((numberp val) val)
95 | ((symbolp val) (format "\"%s\"" (symbol-name val)))
96 | ;; If `val' is a non-empty string
97 | ((org-string-nw-p val)
98 | (if (or (and (string= (substring val 0 1) "\"") ;First char is literally a "
99 | (string= (substring val -1) "\"")) ;Last char is literally a "
100 | (string= "true" val)
101 | (string= "false" val)
102 | ;; or if it is a date (date, publishDate, expiryDate, lastmod)
103 | (string-match-p denote-publish--date-time-regexp val))
104 | val
105 | ;; Escape the backslashes
106 | (setq val (replace-regexp-in-string "\\\\" "\\\\\\\\" val))
107 | ;; Escape the double-quotes
108 | (setq val (replace-regexp-in-string "\"" "\\\\\"" val))
109 | (concat "\"" val "\"")))
110 | ;; Return empty string if anything else
111 | (t "\"\"")))
112 |
113 | (defun denote-publish--get-yaml-list-string (key list)
114 | "Return KEY's LIST value as a YAML list, represented as a string.
115 |
116 | KEY is a string and LIST is a list where an element can be a
117 | symbol, number or a non-empty string. Examples:
118 |
119 | \(\"abc\" \"def\") -> \"[\\\"abc\\\", \\\"def\\\"]\"."
120 | (concat "["
121 | (mapconcat #'identity
122 | (mapcar (lambda (v)
123 | (denote-publish--yaml-quote-string
124 | (cond
125 | ((symbolp v) (symbol-name v))
126 | ((numberp v) (number-to-string v))
127 | ((org-string-nw-p v) v)
128 | (t (user-error "Invalid element %S in `%s' value %S" v key list)))))
129 | list)
130 | ", ")
131 | "]"))
132 |
133 | (defun denote-publish--gen-yaml-front-matter (data)
134 | "Generate front-matter in YAML format, and return that string.
135 |
136 | DATA is an alist of the form \((KEY1 . VAL1) (KEY2 . VAL2) .. \),
137 | where KEY is a symbol and VAL is a string."
138 | (let ((sep "---\n")
139 | (sign ":")
140 | (front-matter ""))
141 | (dolist (pair data)
142 | (let ((key (symbol-name (car pair)))
143 | (value (cdr pair)))
144 | ;; Skip writing front-matter variables whose value is nil
145 | (unless (or (null value) (and (stringp value) (string= "" value)))
146 | ;; In YAML, the value portion needs to be wrapped in double
147 | ;; quotes. Example:
148 | ;; title: "My Post"
149 | (setq front-matter
150 | (concat front-matter
151 | (format "%s%s %s\n"
152 | key
153 | sign
154 | ;; Tags, categories, aliases:
155 | ;; front-matter which are lists.
156 | (if (listp value)
157 | (denote-publish--get-yaml-list-string key value)
158 | (denote-publish--yaml-quote-string value))))))))
159 | (concat sep front-matter sep)))
160 |
161 | (defun denote-publish--get-front-matter (info)
162 | "Return the front-matter string.
163 |
164 | INFO is a plist used as a communication channel."
165 | (let* ((title (org-string-nw-p (car (plist-get info :title))))
166 | (subtitle (org-string-nw-p (plist-get info :subtitle)))
167 | (identifier (org-string-nw-p (plist-get info :identifier)))
168 | (skip-archive (org-string-nw-p (plist-get info :skip_archive)))
169 | (has-code (org-string-nw-p (plist-get info :has_code)))
170 | (og-image (org-string-nw-p (plist-get info :og_image)))
171 | (og-description (org-string-nw-p (plist-get info :og_description)))
172 | (og-video-id (org-string-nw-p (plist-get info :og_video_id)))
173 | (date (org-string-nw-p (org-export-get-date info "%Y-%m-%d")))
174 | (last-updated-at (format-time-string "%Y-%m-%d" (current-time)))
175 | (aliases (when (plist-get info :aliases)
176 | (org-split-string (org-string-nw-p
177 | (plist-get info :aliases))
178 | " ")))
179 | ;; See: [ref: do_not_use_`org-export-get-category']
180 | (category (org-element-map (plist-get info :parse-tree) 'keyword
181 | (lambda (kwd)
182 | (when (equal (org-element-property :key kwd) "CATEGORY")
183 | (org-element-property :value kwd)))
184 | info 'first-match))
185 | (data `((title . ,title)
186 | (subtitle . ,subtitle)
187 | (identifier . ,identifier)
188 | (date . ,date)
189 | (last_updated_at . ,last-updated-at)
190 | (aliases . ,aliases)
191 | (tags . ,org-file-tags)
192 | (category . ,category)
193 | (skip_archive . ,skip-archive)
194 | (has_code . ,has-code)
195 | (og_image . ,og-image)
196 | (og_description . ,og-description)
197 | (og_video_id . ,og-video-id))))
198 | (denote-publish--gen-yaml-front-matter data)))
199 |
200 | ;; [tag: debugging_variables]
201 | (defvar denote-publish--tempinfo nil "Debug variable.")
202 | (defvar denote-publish--templink nil "Debug variable.")
203 |
204 | (defun denote-publish--link-ol-export (link description)
205 | "Export a `denote:' link from Org files.
206 | The LINK, DESCRIPTION are handled by the export
207 | backend."
208 | ;; (setq denote-publish--templink link)
209 | ;; [ref: debugging_variables]
210 | (let* ((path-id (denote-link--ol-resolve-link-to-target
211 | (org-element-property :path link)
212 | :full-data))
213 | (id (nth 1 path-id))
214 | (query (nth 2 path-id))
215 | (path (concat "denote:" id))
216 | (desc (cond
217 | (description)
218 | (query (format "%s::%s" id query))
219 | (t id))))
220 | (if query
221 | (format "%s"
222 | path query desc)
223 | (format "%s" path desc))))
224 |
225 | (defun denote-publish-link (link desc info)
226 | "Convert LINK to Markdown format.
227 |
228 | This function defers to `org-md-link' for everything other than
229 | denote: links, which it converts to file: links.
230 |
231 | DESC is the link's description.
232 | INFO is a plist used as a communication channel."
233 | (let* ((type (org-element-property :type link)))
234 | (cond
235 | ((member type '("denote")) (denote-publish--link-ol-export link desc))
236 | (t (org-md-link link desc info)))))
237 |
238 | ;; ## Publish denote file to external directory
239 |
240 | (defun denote-publish-get-front-matter (filename)
241 | "Get the front-matter for FILENAME"
242 | (let* ((org-inhibit-startup t)
243 | (visiting (find-buffer-visiting filename))
244 | (work-buffer (or visiting (find-file-noselect filename))))
245 | (unwind-protect
246 | (with-current-buffer work-buffer
247 | (let* ((ast (org-element-parse-buffer))
248 | (info (org-combine-plists
249 | (list :parse-tree ast)
250 | (org-export--get-export-attributes 'denote-publish)
251 | (org-export-get-environment 'denote-publish)))
252 | ;; (_tempinfo (setq denote-publish--tempinfo info))
253 | ;; [ref: debugging_variables]
254 | )
255 | (denote-publish--get-front-matter info)))
256 | ;; Remove opened buffer in the process.
257 | (unless visiting (kill-buffer work-buffer)))))
258 |
259 | (defun denote-publish-to-md (plist filename pub-dir)
260 | "Just like `org-md-publish-to-md' but with front-matter.
261 |
262 | FILENAME is the filename of the Org file to be published. PLIST
263 | is the property list for the given project. PUB-DIR is the
264 | publishing directory.
265 |
266 | Return output file name."
267 | (interactive)
268 | (let ((fm (denote-publish-get-front-matter filename))
269 | (outfile (org-publish-org-to 'denote-publish filename ".md" plist pub-dir)))
270 | (with-temp-buffer
271 | (insert fm)
272 | (insert "\n\n")
273 | (insert-file-contents outfile)
274 | (write-file outfile))
275 | outfile))
276 |
277 | ;; ## Configuration for `org-publish-project-alist'
278 |
279 | (setq org-publish-project-alist
280 | `(("vedangme" .
281 | (:base-directory ,vm-base-dir
282 | :publishing-directory ,vm-publishing-dir
283 | :publishing-function denote-publish-to-md
284 | :recursive nil
285 | :exclude-tags ("noexport" "draft" "private")
286 | :section-numbers nil
287 | :with-creator nil
288 | :with-toc nil
289 | :auto-sitemap t
290 | :makeindex t))))
291 |
292 | ;; # Notes
293 | ;; ## Do not use `org-export-get-category'
294 | ;; _[tag: do_not_use_`org-export-get-category']_
295 | ;;
296 | ;; We do not want the fallback behaviour of `org-export-get-category',
297 | ;; which is to return the file-name of the file as the category. For
298 | ;; us, this field only makes sense when it has been explicitly
299 | ;; defined.
300 |
301 | (provide 'denote-publish)
302 | ;;; denote-publish.el ends here
303 |
--------------------------------------------------------------------------------