forked from sachac/.emacs.d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Sacha.html
9857 lines (8859 loc) · 574 KB
/
Sacha.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2016-03-15 Tue 12:14 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Sacha Chua's Emacs configuration</title>
<meta name="generator" content="Org-mode" />
<meta name="author" content="Sacha Chua" />
<style type="text/css">
<!--/*--><![CDATA[/*><!--*/
.title { text-align: center;
margin-bottom: .2em; }
.subtitle { text-align: center;
font-size: medium;
font-weight: bold;
margin-top:0; }
.todo { font-family: monospace; color: red; }
.done { font-family: monospace; color: green; }
.priority { font-family: monospace; color: orange; }
.tag { background-color: #eee; font-family: monospace;
padding: 2px; font-size: 80%; font-weight: normal; }
.timestamp { color: #bebebe; }
.timestamp-kwd { color: #5f9ea0; }
.org-right { margin-left: auto; margin-right: 0px; text-align: right; }
.org-left { margin-left: 0px; margin-right: auto; text-align: left; }
.org-center { margin-left: auto; margin-right: auto; text-align: center; }
.underline { text-decoration: underline; }
#postamble p, #preamble p { font-size: 90%; margin: .2em; }
p.verse { margin-left: 3%; }
pre {
border: 1px solid #ccc;
box-shadow: 3px 3px 3px #eee;
padding: 8pt;
font-family: monospace;
overflow: auto;
margin: 1.2em;
}
pre.src {
position: relative;
overflow: visible;
padding-top: 1.2em;
}
pre.src:before {
display: none;
position: absolute;
background-color: white;
top: -10px;
right: 10px;
padding: 3px;
border: 1px solid black;
}
pre.src:hover:before { display: inline;}
pre.src-sh:before { content: 'sh'; }
pre.src-bash:before { content: 'sh'; }
pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
pre.src-R:before { content: 'R'; }
pre.src-perl:before { content: 'Perl'; }
pre.src-java:before { content: 'Java'; }
pre.src-sql:before { content: 'SQL'; }
table { border-collapse:collapse; }
caption.t-above { caption-side: top; }
caption.t-bottom { caption-side: bottom; }
td, th { vertical-align:top; }
th.org-right { text-align: center; }
th.org-left { text-align: center; }
th.org-center { text-align: center; }
td.org-right { text-align: right; }
td.org-left { text-align: left; }
td.org-center { text-align: center; }
dt { font-weight: bold; }
.footpara { display: inline; }
.footdef { margin-bottom: 1em; }
.figure { padding: 1em; }
.figure p { text-align: center; }
.inlinetask {
padding: 10px;
border: 2px solid gray;
margin: 10px;
background: #ffffcc;
}
#org-div-home-and-up
{ text-align: right; font-size: 70%; white-space: nowrap; }
textarea { overflow-x: auto; }
.linenr { font-size: smaller }
.code-highlighted { background-color: #ffff00; }
.org-info-js_info-navigation { border-style: none; }
#org-info-js_console-label
{ font-size: 10px; font-weight: bold; white-space: nowrap; }
.org-info-js_search-highlight
{ background-color: #ffff00; color: #000000; font-weight: bold; }
/*]]>*/-->
</style>
<link rel="stylesheet" type="text/css"
href="http://sachachua.com/blog/wp-content/themes/sacha-v3/foundation/css/foundation.min.css"></link>
<link rel="stylesheet" type="text/css" href="http://sachachua.com/org-export.css"></link>
<link rel="stylesheet" type="text/css" href="http://sachachua.com/blog/wp-content/themes/sacha-v3/style.css"></link>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script type="text/javascript">
/*
@licstart The following is the entire license notice for the
JavaScript code in this tag.
Copyright (C) 2012-2013 Free Software Foundation, Inc.
The JavaScript code in this tag is free software: you can
redistribute it and/or modify it under the terms of the GNU
General Public License (GNU GPL) as published by the Free Software
Foundation, either version 3 of the License, or (at your option)
any later version. The code is distributed WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
As additional permission under GNU GPL version 3 section 7, you
may distribute non-source (e.g., minimized or compacted) forms of
that code without the copy of the GNU GPL normally required by
section 4, provided you include this license notice and a URL
through which recipients can access the Corresponding Source.
@licend The above is the entire license notice
for the JavaScript code in this tag.
*/
<!--/*--><![CDATA[/*><!--*/
function CodeHighlightOn(elem, id)
{
var target = document.getElementById(id);
if(null != target) {
elem.cacheClassElem = elem.className;
elem.cacheClassTarget = target.className;
target.className = "code-highlighted";
elem.className = "code-highlighted";
}
}
function CodeHighlightOff(elem, id)
{
var target = document.getElementById(id);
if(elem.cacheClassElem)
elem.className = elem.cacheClassElem;
if(elem.cacheClassTarget)
target.className = elem.cacheClassTarget;
}
/*]]>*///-->
</script>
</head>
<body>
<div id="preamble" class="status">
<a name="top" id="top"></a>
</div>
<div id="content">
<h1 class="title">Sacha Chua's Emacs configuration</h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#orgheadline196">Configuration</a>
<ul>
<li><a href="#babel-init">About this file</a></li>
<li><a href="#orgheadline3">Personal information</a></li>
<li><a href="#orgheadline6">Emacs initialization</a>
<ul>
<li><a href="#orgheadline1">Add package sources</a></li>
<li><a href="#orgheadline4">Add my elisp directory and other files</a></li>
<li><a href="#orgheadline5">Load secrets</a></li>
</ul>
</li>
<li><a href="#orgheadline24">General configuration</a>
<ul>
<li><a href="#orgheadline7">Backups</a></li>
<li><a href="#orgheadline8">History</a></li>
<li><a href="#orgheadline9">Windows configuration   <span class="tag"><span class="drill">drill</span></span></a></li>
<li><a href="#orgheadline10">Winner mode - undo and redo window configuration</a></li>
<li><a href="#orgheadline11">Sentences end with a single space</a></li>
<li><a href="#orgheadline12">Helm - interactive completion</a>
<ul>
<li><a href="#orgheadline13">Getting Helm and org-refile to clock in or create tasks   <span class="tag"><span class="emacs">emacs</span> <span class="org">org</span> <span class="helm">helm</span></span></a></li>
</ul>
</li>
<li><a href="#orgheadline14">Mode line format</a></li>
<li><a href="#orgheadline15">Change "yes or no" to "y or n"</a></li>
<li><a href="#orgheadline16">Minibuffer editing - more space!</a></li>
<li><a href="#orgheadline17">Set up a light-on-dark color scheme</a></li>
<li><a href="#orgheadline18">Undo tree mode - visualize your undos and branches</a></li>
<li><a href="#orgheadline19">Help - guide-key</a></li>
<li><a href="#orgheadline20">UTF-8</a></li>
<li><a href="#orgheadline21">Killing text</a></li>
<li><a href="#orgheadline22">Repeatable commands</a>
<ul>
<li><a href="#orgheadline23"><span class="todo TODO">TODO</span> Look for opportunities to use this</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#orgheadline36">Navigation</a>
<ul>
<li><a href="#orgheadline25">Pop to mark</a></li>
<li><a href="#orgheadline26">Helm-swoop - quickly finding lines</a></li>
<li><a href="#orgheadline27">Windmove - switching between windows</a></li>
<li><a href="#orgheadline28">More window movement</a></li>
<li><a href="#orgheadline29">Frequently-accessed files</a></li>
<li><a href="#key-chord">Key chords and Hydras</a></li>
<li><a href="#orgheadline31">Smartscan</a></li>
<li><a href="#orgheadline32">Dired</a></li>
<li><a href="#orgheadline33">Move to beginning of line</a></li>
<li><a href="#orgheadline34">Recent files</a></li>
<li><a href="#orgheadline35">Copy filename to clipboard</a></li>
</ul>
</li>
<li><a href="#orgheadline37">Reading</a></li>
<li><a href="#orgheadline38">Shuffling lines</a></li>
<li><a href="#orgheadline45">Writing</a>
<ul>
<li><a href="#orgheadline39">Avoiding weasel words</a></li>
<li><a href="#orgheadline40">Unfill paragraph</a></li>
<li><a href="#orgheadline41">Unicode</a></li>
<li><a href="#orgheadline42">Clean up spaces</a></li>
<li><a href="#orgheadline43">Expand</a></li>
<li><a href="#orgheadline44">Define more abbreviations</a></li>
</ul>
</li>
<li><a href="#orgheadline46">Org   <span class="tag"><span class="org">org</span></span></a>
<ul>
<li><a href="#org-files">My files</a></li>
<li><a href="#orgheadline48">Modules</a></li>
<li><a href="#orgheadline49">Keyboard shortcuts</a>
<ul>
<li><a href="#orgheadline50">Speed commands</a></li>
</ul>
</li>
<li><a href="#orgheadline51">Navigation</a>
<ul>
<li><a href="#orgheadline52">Link Org subtrees and navigate between them</a></li>
<li><a href="#orgheadline53">Viewing, navigating, and editing the Org tree</a></li>
</ul>
</li>
<li><a href="#orgheadline54">Taking notes</a>
<ul>
<li><a href="#orgheadline55">Date trees</a></li>
<li><a href="#orgheadline56">Templates</a></li>
<li><a href="#orgheadline58">Refiling</a></li>
<li><a href="#orgheadline61">Estimating WPM</a></li>
</ul>
</li>
<li><a href="#orgheadline73">Tasks</a>
<ul>
<li><a href="#orgheadline68">Managing tasks</a></li>
<li><a href="#subset">Estimating tasks</a></li>
<li><a href="#orgheadline70">Modifying org agenda so that I can display a subset of tasks</a></li>
<li><a href="#orgheadline71">Flexible scheduling of tasks</a></li>
<li><a href="#orgheadline72">Task dependencies</a></li>
</ul>
</li>
<li><a href="#orgheadline76">Templates</a>
<ul>
<li><a href="#orgheadline74">Structure templates</a></li>
<li><a href="#orgheadline75">Emacs chats, Emacs hangouts</a></li>
</ul>
</li>
<li><a href="#orgheadline88">Org agenda</a>
<ul>
<li><a href="#project_subtasks">Basic configuration</a></li>
<li><a href="#orgheadline78">Starting my weeks on Saturday</a></li>
<li><a href="#agenda_commands">Display projects with associated subtasks</a></li>
<li><a href="#orgheadline80">Org agenda custom commands</a></li>
<li><a href="#orgheadline81">Make it easy to mark a task as done</a></li>
<li><a href="#orgheadline82">Make it easy to mark a task as done and create a follow-up task</a></li>
<li><a href="#orgheadline83">Capture something based on the agenda</a></li>
<li><a href="#orgheadline84">Sorting by date and priority</a></li>
<li><a href="#orgheadline85">Preventing things from falling through the cracks</a></li>
<li><a href="#orgheadline86">Synchronizing with Google Calendar</a></li>
<li><a href="#orgheadline87">Projects</a></li>
</ul>
</li>
<li><a href="#orgheadline95">Reviews</a>
<ul>
<li><a href="#weekly-review">Weekly review</a></li>
<li><a href="#monthly-reviews">Monthly reviews</a></li>
</ul>
</li>
<li><a href="#orgheadline99">Filing</a>
<ul>
<li><a href="#destination">Moving lines around</a></li>
<li><a href="#orgheadline97">Organizing my blog index</a></li>
<li><a href="#orgheadline98">Quickly refiling to the same file</a></li>
</ul>
</li>
<li><a href="#orgheadline100">Publishing</a>
<ul>
<li><a href="#orgheadline101">Org2blog</a></li>
<li><a href="#orgheadline102">Publish without prompting</a></li>
<li><a href="#orgheadline103">Stylesheet / header</a></li>
<li><a href="#orgheadline104">Footer</a></li>
<li><a href="#orgheadline105">Copy region</a></li>
<li><a href="#orgheadline106">UTF-8 checkboxes</a></li>
<li><a href="#orgheadline107">Share my Emacs configuration</a></li>
</ul>
</li>
<li><a href="#orgheadline112">Links</a>
<ul>
<li><a href="#orgheadline108">Quick links</a></li>
<li><a href="#orgheadline109">Custom links</a></li>
<li><a href="#orgheadline110">Links from org-protocol</a></li>
<li><a href="#org-dired">Dired</a></li>
</ul>
</li>
<li><a href="#orgheadline113">Attachments</a></li>
<li><a href="#orgheadline114">Diagrams and graphics</a></li>
<li><a href="#orgheadline115">Counting</a></li>
<li><a href="#orgheadline116">Spreadsheets</a></li>
<li><a href="#orgheadline119">Literate programming</a>
<ul>
<li><a href="#orgheadline117">Editing source code</a></li>
<li><a href="#orgheadline118">Copying and sharing code</a></li>
</ul>
</li>
<li><a href="#orgheadline120">Invoices</a></li>
<li><a href="#orgheadline121">Archiving</a></li>
<li><a href="#orgheadline122">Filesystem</a>
<ul>
<li><a href="#orgheadline123"><span class="todo TODO">TODO</span> check out org-fstree</a></li>
</ul>
</li>
<li><a href="#orgheadline124">Presentations</a></li>
<li><a href="#orgheadline125">Allow dashes in tags</a></li>
<li><a href="#orgheadline126">Copying information from my phone</a></li>
<li><a href="#emacs-news">Emacs packages, other settings for easy Emacs News generation</a>
<ul>
<li><a href="#orgheadline127"><span class="done DONE">DONE</span> Publishing Emacs News as plain text, HTML, and attached Org file</a></li>
</ul>
</li>
<li><a href="#orgheadline129"><span class="done DONE">DONE</span> Org Mode tables and fill-in quizzes - Latin verb conjugations in Emacs</a></li>
</ul>
</li>
<li><a href="#orgheadline157">Coding</a>
<ul>
<li><a href="#orgheadline130">Web development</a></li>
<li><a href="#orgheadline131">Tab width of 2 is compact and readable</a></li>
<li><a href="#orgheadline132">New lines are always indented</a></li>
<li><a href="#orgheadline133">Adapt to being on Windows</a></li>
<li><a href="#orgheadline134">Expand region</a></li>
<li><a href="#orgheadline135">Compilation</a></li>
<li><a href="#orgheadline141">Emacs Lisp</a>
<ul>
<li><a href="#orgheadline136">Eldoc</a></li>
<li><a href="#orgheadline137">Refactoring   <span class="tag"><span class="drill">drill</span></span></a></li>
<li><a href="#orgheadline138">Jumping to code</a></li>
<li><a href="#orgheadline139">Sorting</a></li>
<li><a href="#orgheadline140">Evaluation</a></li>
</ul>
</li>
<li><a href="#orgheadline142">Snippets</a></li>
<li><a href="#orgheadline143">Show column number</a></li>
<li><a href="#orgheadline144">Don't show whitespace in diff, but show context</a></li>
<li><a href="#orgheadline145">Javascript</a></li>
<li><a href="#orgheadline146">HTML</a></li>
<li><a href="#magit">Magit - nice git interface</a>
<ul>
<li><a href="#orgheadline147"><span class="todo TODO">TODO</span> Make this better by adding a post command options variable</a></li>
</ul>
</li>
<li><a href="#orgheadline149">git-messenger - shows commit message</a></li>
<li><a href="#orgheadline150">Tag files</a></li>
<li><a href="#orgheadline151">Projects</a></li>
<li><a href="#orgheadline152">Exploring MELPA recipes</a></li>
<li><a href="#orgheadline153">Ruby</a></li>
<li><a href="#orgheadline154">Skewer</a></li>
<li><a href="#orgheadline155">Autocomplete</a></li>
<li><a href="#orgheadline156">Tern - for Javascript</a></li>
</ul>
</li>
<li><a href="#orgheadline158">Internet Relay Chat</a></li>
<li><a href="#orgheadline165">Self-tracking, statistics, and other data transformations</a>
<ul>
<li><a href="#clock-in">Quantified Awesome</a></li>
<li><a href="#compare-time">Compare times and effort estimates</a></li>
<li><a href="#orgheadline161">R</a></li>
<li><a href="#orgheadline162">Workrave</a></li>
<li><a href="#orgheadline163">Blog</a></li>
<li><a href="#orgheadline164">Artrage</a></li>
</ul>
</li>
<li><a href="#orgheadline170">Workarounds</a>
<ul>
<li><a href="#orgheadline166">GnuTLS on Windows</a></li>
<li><a href="#orgheadline167">color-theme sometimes comes across lists. Odd!</a></li>
<li><a href="#orgheadline168">ido-sort-mtime stopped working when I upgraded to Windows 8</a></li>
<li><a href="#orgheadline169">Cygwin mogrify doesn't work for me, but ImageMagick does</a></li>
</ul>
</li>
<li><a href="#orgheadline171">Display</a></li>
<li><a href="#orgheadline172">Web browsing</a></li>
<li><a href="#orgheadline173">Clipboard</a></li>
<li><a href="#orgheadline174">Search</a></li>
<li><a href="#orgheadline177">Mail</a>
<ul>
<li><a href="#orgheadline175">Gnus</a></li>
<li><a href="#orgheadline176">Notmuch</a></li>
</ul>
</li>
<li><a href="#orgheadline178">Ledger (personal finance)</a></li>
<li><a href="#orgheadline179">Emacs server</a></li>
<li><a href="#orgheadline180">Menus</a></li>
<li><a href="#orgheadline188">Advanced stuff / things I tend to forget about</a>
<ul>
<li><a href="#orgheadline182">Editing multiple things</a>
<ul>
<li><a href="#orgheadline181">Multiple cursors mode   <span class="tag"><span class="drill">drill</span></span></a></li>
</ul>
</li>
<li><a href="#orgheadline183">Edit list   <span class="tag"><span class="drill">drill</span></span></a></li>
<li><a href="#orgheadline184">Quickly jump to positions</a></li>
<li><a href="#orgheadline185">Deleting things</a>
<ul>
<li><a href="#orgheadline186"><span class="todo TODO">TODO</span> Get zap-to-isearch to work with helm-swoop</a></li>
</ul>
</li>
<li><a href="#orgheadline187">Network: TRAMP and editing files over SSH</a></li>
</ul>
</li>
<li><a href="#orgheadline190">Other nifty Emacs things I want to learn</a>
<ul>
<li><a href="#orgheadline189">Smartparens mode   <span class="tag"><span class="drill">drill</span></span></a></li>
</ul>
</li>
<li><a href="#orgheadline191">Weather forecast</a></li>
<li><a href="#orgheadline192">Encryption</a></li>
<li><a href="#orgheadline193">Yaoddmuse</a></li>
<li><a href="#orgheadline194">Building a today-I-learned habit, and displaying the documentation for random Emacs commands   <span class="tag"><span class="emacs">emacs</span></span></a></li>
<li><a href="#orgheadline195"><span class="done DONE">DONE</span> Scan ~/bin and turn the scripts into interactive commands</a></li>
</ul>
</li>
<li><a href="#links">Other cool configs you may want to check out</a></li>
<li><a href="#orgheadline199">Temporary workarounds</a>
<ul>
<li><a href="#orgheadline198">Tablet clicks count as drags</a></li>
</ul>
</li>
<li><a href="#orgheadline235">Inactive/infrequent things</a>
<ul>
<li><a href="#orgheadline200">Org - mapping blog posts and image URLs from bulk exports</a></li>
<li><a href="#orgheadline201">Transcript editing</a></li>
<li><a href="#orgheadline202">Japanese</a></li>
<li><a href="#beeminder">Beeminder</a></li>
<li><a href="#orgheadline204">Strike through DONE headlines</a></li>
<li><a href="#orgheadline205">Rainbow delimiters</a></li>
<li><a href="#orgheadline206">Drupal</a></li>
<li><a href="#orgheadline207">Autoconnect to IRC so that I don't forget</a></li>
<li><a href="#orgheadline208">Org - send things to the bottom of the list</a></li>
<li><a href="#orgheadline209">Time tracking, previous weekly review</a>
<ul>
<li><a href="#orgheadline210">List upcoming tasks so that I can see if I'm overloaded</a></li>
<li><a href="#orgheadline211">Compare time use</a></li>
</ul>
</li>
<li><a href="#orgheadline212">Animation for Emacs chats</a></li>
<li><a href="#orgheadline213">Idle timer</a></li>
<li><a href="#orgheadline214">Old Flickr/Evernote export</a></li>
<li><a href="#emacsconf2013">Presentation code for Emacs Conference</a></li>
<li><a href="#orgheadline216">Enable minibuffer completion</a></li>
<li><a href="#orgheadline220">Because I'm trying to use helm instead of ido…</a>
<ul>
<li><a href="#orgheadline217">Ido-mode: Much better navigationy things</a></li>
<li><a href="#orgheadline218">Ido and Org</a></li>
<li><a href="#orgheadline219">Finding files</a></li>
</ul>
</li>
<li><a href="#orgheadline221">Keywiz - keyboard quizzes</a></li>
<li><a href="#orgheadline222">MobileOrg for Android</a></li>
<li><a href="#orgheadline223">Encryption</a></li>
<li><a href="#orgheadline234">Drawing</a>
<ul>
<li><a href="#orgheadline224">Digital index piles with Emacs</a></li>
<li><a href="#orgheadline225">Using Emacs to prepare files for external applications like Autodesk Sketchbook Pro</a>
<ul>
<li><a href="#orgheadline226">Index cards</a></li>
<li><a href="#orgheadline227">Easily backfilling my journal</a></li>
<li><a href="#orgheadline228">Rename scanned index cards</a></li>
<li><a href="#orgheadline229">Automatically resize images</a></li>
<li><a href="#orgheadline230">Get information for sketched books</a></li>
</ul>
</li>
<li><a href="#orgheadline231"><span class="todo TODO">TODO</span> Move to-blog sketches to a staging folder for easier upload</a></li>
<li><a href="#orgheadline232">Other sketches</a></li>
<li><a href="#insert-point">Sketched books</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#orgheadline237">Games</a>
<ul>
<li><a href="#orgheadline236">Typing of Emacs</a></li>
</ul>
</li>
<li><a href="#orgheadline238">Speech synthesis (experimental)</a></li>
<li><a href="#orgheadline239">Path</a></li>
</ul>
</div>
</div>
<div id="outline-container-orgheadline196" class="outline-2">
<h2 id="orgheadline196">Configuration</h2>
<div class="outline-text-2" id="text-orgheadline196">
</div><div id="outline-container-orgheadline2" class="outline-3">
<h3 id="babel-init"><a id="orgheadline2"></a>About this file</h3>
<div class="outline-text-3" id="text-babel-init">
<p>
<a id="orgtarget1"></a>
</p>
<p>
Inspired by the <a href="http://eschulte.me/emacs24-starter-kit/#installation">Emacs Starter Kit</a>, I set up my configuration file
using Org-babel. You could load it with <code>(org-babel-load-file
"/path/to/file")</code>, changing the path appropriately, but you'll
probably want to tweak it extensively first.
</p>
<p>
This page: <a href="http://sachac.github.io/.emacs.d/Sacha.html">HTML</a> - <a href="https://github.com/sachac/.emacs.d/blob/gh-pages/Sacha.org">Org</a> - <a href="https://dl.dropbox.com/u/3968124/sacha-emacs.el">.el</a> - <a href="http://github.com/sachac/.emacs.d/">Github</a> - also, <a href="http://sach.ac/dotemacs">http://sach.ac/dotemacs</a>
</p>
<p>
To be precise, this is what's in the first part of my <code>~/.emacs.d/init.el</code> (what used to be the <code>~/.emacs</code> file):
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp"><span class="org-comment-delimiter">;; </span><span class="org-comment">This sets up the load path so that we can override it</span>
(package-initialize nil)
<span class="org-comment-delimiter">;; </span><span class="org-comment">Override the packages with the git version of Org and other packages</span>
(add-to-list 'load-path <span class="org-string">"~/elisp/org-mode/lisp"</span>)
(add-to-list 'load-path <span class="org-string">"~/elisp/org-mode/contrib/lisp"</span>)
(add-to-list 'load-path <span class="org-string">"~/code/org2blog"</span>)
(add-to-list 'load-path <span class="org-string">"~/Dropbox/2014/presentations/org-reveal"</span>)
(add-to-list 'load-path <span class="org-string">"/usr/local/share/emacs/site-lisp"</span>)
<span class="org-comment-delimiter">;; </span><span class="org-comment">Load the rest of the packages</span>
(package-initialize nil)
(<span class="org-keyword">setq</span> package-enable-at-startup nil)
(org-babel-load-file <span class="org-string">"~/.emacs.d/Sacha.org"</span>)
</pre>
</div>
<p>
If you're new to Emacs Lisp, you probably don't want to copy and paste
large chunks of this code. Instead, copy small parts of it (always
making sure to copy a complete set of parentheses) into your
<code>*scratch*</code> buffer or some other buffer in <code>emacs-lisp-mode</code>. Use <code>M-x
eval-buffer</code> to evaluate the code and see if you like the way that
Emacs behaves. See <a href="https://www.gnu.org/software/emacs/manual/html_mono/eintr.html">An Introduction to Programming in Emacs Lisp</a> for more details on Emacs Lisp. You can also find the manual by using <code>C-h i</code> (<code>info</code>) and choosing "Emacs Lisp Intro".
</p>
<p>
I've installed a lot of packages. See the <a href="#orgheadline1">package sources</a> section to
add the repositories to your configuration. When you see <code>use-package</code>
and a package name you might like, you can use <code>M-x package-install</code>
to install the package of that name. Note that use-package is itself
provided by a package, so you'll probably want to install that and
<code>bind-key</code>.
</p>
<p>
If you're viewing the Org file, you can open source code blocks (those are the ones in begin_src) in a separate buffer by moving your point inside them and typing C-c ' (<code>org-edit-special</code>). This opens another buffer in <code>emacs-lisp-mode</code>, so you can use <code>M-x eval-buffer</code> to load the changes. If you want to explore how functions work, use <code>M-x edebug-defun</code> to set up debugging for that function, and then call it. You can learn more about edebug in the <a href="http://www.gnu.org/software/emacs/manual/html_node/elisp/Edebug.html">Emacs Lisp</a> manual.
</p>
<p>
I like using <code>(setq ...)</code> more than Customize because I can neatly organize my configuration that way.
</p>
</div>
</div>
<div id="outline-container-orgheadline3" class="outline-3">
<h3 id="orgheadline3">Personal information</h3>
<div class="outline-text-3" id="text-orgheadline3">
<div class="org-src-container">
<pre class="src src-emacs-lisp">(<span class="org-keyword">setq</span> user-full-name <span class="org-string">"Sacha Chua"</span>
user-mail-address <span class="org-string">"[email protected]"</span>)
</pre>
</div>
</div>
</div>
<div id="outline-container-orgheadline6" class="outline-3">
<h3 id="orgheadline6">Emacs initialization</h3>
<div class="outline-text-3" id="text-orgheadline6">
</div><div id="outline-container-orgheadline1" class="outline-4">
<h4 id="orgheadline1">Add package sources</h4>
<div class="outline-text-4" id="text-orgheadline1">
<div class="org-src-container">
<pre class="src src-emacs-lisp">(<span class="org-keyword">unless</span> (assoc-default <span class="org-string">"melpa"</span> package-archives)
(add-to-list 'package-archives '(<span class="org-string">"melpa"</span> . <span class="org-string">"https://melpa.org/packages/"</span>) t)
<span class="org-comment-delimiter">; </span><span class="org-comment">(package-refresh-contents)</span>
)
</pre>
</div>
<p>
Use <code>M-x package-refresh-contents</code> to reload the list of packages
after adding these for the first time.
</p>
</div>
</div>
<div id="outline-container-orgheadline4" class="outline-4">
<h4 id="orgheadline4">Add my elisp directory and other files</h4>
<div class="outline-text-4" id="text-orgheadline4">
<p>
Sometimes I load files outside the package system. As long as they're
in a directory in my <code>load-path</code>, Emacs can find them.
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp">(add-to-list 'load-path <span class="org-string">"~/elisp"</span>)
(add-to-list 'load-path <span class="org-string">"~/elisp/artbollocks-mode"</span>)
(<span class="org-keyword">unless</span> (package-installed-p 'use-package)
(package-install 'use-package))
(<span class="org-keyword">setq</span> use-package-verbose t)
(<span class="org-keyword">require</span> '<span class="org-constant">use-package</span>)
(<span class="org-keyword">use-package</span> <span class="org-constant">auto-compile</span>
<span class="org-builtin">:ensure</span> t
<span class="org-builtin">:config</span> (auto-compile-on-load-mode))
(<span class="org-keyword">setq</span> load-prefer-newer t)
</pre>
</div>
</div>
</div>
<div id="outline-container-orgheadline5" class="outline-4">
<h4 id="orgheadline5">Load secrets</h4>
<div class="outline-text-4" id="text-orgheadline5">
<p>
I keep slightly more sensitive information in a separate file so that I can easily publish my main configuration.
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp">(load <span class="org-string">"~/.emacs.secrets"</span> t)
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-orgheadline24" class="outline-3">
<h3 id="orgheadline24">General configuration</h3>
<div class="outline-text-3" id="text-orgheadline24">
</div><div id="outline-container-orgheadline7" class="outline-4">
<h4 id="orgheadline7">Backups</h4>
<div class="outline-text-4" id="text-orgheadline7">
<p>
This is one of the things people usually want to change right away. By default, Emacs saves backup files in the current directory. These are the files ending in <code>~</code> that are cluttering up your directory lists. The following code stashes them all in <code>~/.emacs.d/backups</code>, where I can find them with <code>C-x C-f</code> (<code>find-file</code>) if I really need to.
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp">(<span class="org-keyword">setq</span> backup-directory-alist '((<span class="org-string">"."</span> . <span class="org-string">"~/.emacs.d/backups"</span>)))
</pre>
</div>
<p>
Disk space is cheap. Save lots.
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp">(<span class="org-keyword">setq</span> delete-old-versions -1)
(<span class="org-keyword">setq</span> version-control t)
(<span class="org-keyword">setq</span> vc-make-backup-files t)
(<span class="org-keyword">setq</span> auto-save-file-name-transforms '((<span class="org-string">".*"</span> <span class="org-string">"~/.emacs.d/auto-save-list/"</span> t)))
</pre>
</div>
</div>
</div>
<div id="outline-container-orgheadline8" class="outline-4">
<h4 id="orgheadline8">History</h4>
<div class="outline-text-4" id="text-orgheadline8">
<p>
From <a href="http://www.wisdomandwonder.com/wordpress/wp-content/uploads/2014/03/C3F.html">http://www.wisdomandwonder.com/wordpress/wp-content/uploads/2014/03/C3F.html</a>
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp">(<span class="org-keyword">setq</span> savehist-file <span class="org-string">"~/.emacs.d/savehist"</span>)
(savehist-mode 1)
(<span class="org-keyword">setq</span> history-length t)
(<span class="org-keyword">setq</span> history-delete-duplicates t)
(<span class="org-keyword">setq</span> savehist-save-minibuffer-history 1)
(<span class="org-keyword">setq</span> savehist-additional-variables
'(kill-ring
search-ring
regexp-search-ring))
</pre>
</div>
</div>
</div>
<div id="outline-container-orgheadline9" class="outline-4">
<h4 id="orgheadline9"><a id="ID-440c0b9a-9068-450b-89a3-a20c8ec1f447"></a>Windows configuration   <span class="tag"><span class="drill">drill</span></span></h4>
<div class="outline-text-4" id="text-orgheadline9">
<p>
When you're starting out, tooltips, menus, and the tool bar can be very helpful. <a href="http://sachachua.com/blog/2014/03/emacs-basics-using-mouse/">(Emacs Basics: Using the Mouse</a>). Eventually, you may want to reclaim that extra little bit of screenspace. The following code turns those things off when using a graphical Emacs. (Although I changed my mind about the menu - I want that again.)
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp">(<span class="org-keyword">when</span> window-system
(tooltip-mode -1)
(tool-bar-mode -1)
(menu-bar-mode 1)
(scroll-bar-mode -1))
</pre>
</div>
</div>
</div>
<div id="outline-container-orgheadline10" class="outline-4">
<h4 id="orgheadline10">Winner mode - undo and redo window configuration</h4>
<div class="outline-text-4" id="text-orgheadline10">
<p>
<code>winner-mode</code> lets you use <code>C-c <left></code> and <code>C-c <right></code> to switch between window configurations. This is handy when something has popped up a buffer that you want to look at briefly before returning to whatever you were working on. When you're done, press <code>C-c <left></code>.
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp">(<span class="org-keyword">use-package</span> <span class="org-constant">winner</span>
<span class="org-builtin">:ensure</span> t
<span class="org-builtin">:defer</span> t)
</pre>
</div>
</div>
</div>
<div id="outline-container-orgheadline11" class="outline-4">
<h4 id="orgheadline11">Sentences end with a single space</h4>
<div class="outline-text-4" id="text-orgheadline11">
<p>
In my world, sentences end with a single space. This makes
sentence navigation commands work for me.
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp">(<span class="org-keyword">setq</span> sentence-end-double-space nil)
</pre>
</div>
</div>
</div>
<div id="outline-container-orgheadline12" class="outline-4">
<h4 id="orgheadline12">Helm - interactive completion</h4>
<div class="outline-text-4" id="text-orgheadline12">
<p>
Helm makes it easy to complete various things. I find it to be easier
to configure than ido in order to get completion in as many places as
possible, although I prefer ido's way of switching buffers.
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp">(<span class="org-keyword">use-package</span> <span class="org-constant">helm</span>
<span class="org-builtin">:ensure</span> t
<span class="org-builtin">:diminish</span> helm-mode
<span class="org-builtin">:init</span>
(<span class="org-keyword">progn</span>
(<span class="org-keyword">require</span> '<span class="org-constant">helm-config</span>)
(<span class="org-keyword">setq</span> helm-candidate-number-limit 100)
<span class="org-comment-delimiter">;; </span><span class="org-comment">From https://gist.github.com/antifuchs/9238468</span>
(<span class="org-keyword">setq</span> helm-idle-delay 0.0 <span class="org-comment-delimiter">; </span><span class="org-comment">update fast sources immediately (doesn't).</span>
helm-input-idle-delay 0.01 <span class="org-comment-delimiter">; </span><span class="org-comment">this actually updates things</span>
<span class="org-comment-delimiter">; </span><span class="org-comment">reeeelatively quickly.</span>
helm-yas-display-key-on-candidate t
helm-quick-update t
helm-M-x-requires-pattern nil
helm-ff-skip-boring-files t)
(helm-mode))
<span class="org-builtin">:bind</span> ((<span class="org-string">"C-c h"</span> . helm-mini)
(<span class="org-string">"C-h a"</span> . helm-apropos)
(<span class="org-string">"C-x C-b"</span> . helm-buffers-list)
(<span class="org-string">"C-x b"</span> . helm-buffers-list)
(<span class="org-string">"M-y"</span> . helm-show-kill-ring)
(<span class="org-string">"M-x"</span> . helm-M-x)
(<span class="org-string">"C-x c o"</span> . helm-occur)
(<span class="org-string">"C-x c s"</span> . helm-swoop)
(<span class="org-string">"C-x c y"</span> . helm-yas-complete)
(<span class="org-string">"C-x c Y"</span> . helm-yas-create-snippet-on-region)
(<span class="org-string">"C-x c b"</span> . my/helm-do-grep-book-notes)
(<span class="org-string">"C-x c SPC"</span> . helm-all-mark-rings)))
(ido-mode -1) <span class="org-comment-delimiter">;; </span><span class="org-comment">Turn off ido mode in case I enabled it accidentally</span>
</pre>
</div>
<p>
Great for describing bindings. I'll replace the binding for <code>where-is</code> too.
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp">(<span class="org-keyword">use-package</span> <span class="org-constant">helm-descbinds</span>
<span class="org-builtin">:defer</span> t
<span class="org-builtin">:ensure</span> t
<span class="org-builtin">:bind</span> ((<span class="org-string">"C-h b"</span> . helm-descbinds)
(<span class="org-string">"C-h w"</span> . helm-descbinds)))
</pre>
</div>
<p>
helm-grep? Bit slow and hard to read, though.
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp">(<span class="org-keyword">defvar</span> <span class="org-variable-name">my/book-notes-directory</span> <span class="org-string">"~/Dropbox/books"</span>)
(<span class="org-keyword">defun</span> <span class="org-function-name">my/helm-do-grep-book-notes</span> ()
<span class="org-doc">"Search my book notes."</span>
(<span class="org-keyword">interactive</span>)
(helm-do-grep-1 (list my/book-notes-directory)))
</pre>
</div>
</div>
<div id="outline-container-orgheadline13" class="outline-5">
<h5 id="orgheadline13"><a id="o2b:68856129-3324-4a07-87f3-066a228c5847"></a>Getting Helm and org-refile to clock in or create tasks   <span class="tag"><span class="emacs">emacs</span> <span class="org">org</span> <span class="helm">helm</span></span></h5>
<div class="outline-text-5" id="text-orgheadline13">
<p>
I've been thinking about how to improve the way that I navigate to,
clock in, and create tasks in Org Mode. If the task is one of the ones
I've planned for today, I use my Org agenda. If I know that the task
exists, I use <code>C-u C-c C-w</code> (<code>org-refile</code>) to jump to it, and then <code>!</code>
(one of my <code>org-speed-commands-user</code> options) to clock in and track it
on Quantified Awesome. If I want to resume an interrupted task, I use
<code>C-u C-c j</code> (my shortcut for <code>org-clock-goto</code>). For new tasks, I go to
the appropriate project entry and create it, although I really should
be using <code>org-capture</code> instead.
</p>
<p>
<a href="https://www.flickr.com/photos/65214961@N00/16218018829">2015-01-30 Org Mode jumping to tasks – index card #emacs #org</a>
</p>
<p>
I thought about how I can reduce some of these distinctions. For
example, what if it didn't matter whether or not a task already
exists? I can modify the org-refile interface to make it easier for me
to create tasks if my description doesn't match anything. To make
things simpler, I'll just reuse one of my <code>org-capture-templates</code>, and
I'll pre-fill it with the candidate from Helm.
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp">(<span class="org-keyword">ert-deftest</span> <span class="org-function-name">my/org-capture-prefill-template</span> ()
(<span class="org-keyword">should</span>
<span class="org-comment-delimiter">;; </span><span class="org-comment">It should fill things in one field at ia time</span>
(string=
(my/org-capture-prefill-template
<span class="org-string">"* TODO %^{Task}\nSCHEDULED: %^t\n:PROPERTIES:\n:Effort: %^{effort|1:00|0:05|0:15|0:30|2:00|4:00}\n:END:\n%?\n"</span>
<span class="org-string">"Hello World"</span>)
<span class="org-string">"* TODO Hello World\nSCHEDULED: %^t\n:PROPERTIES:\n:Effort: %^{effort|1:00|0:05|0:15|0:30|2:00|4:00}\n:END:\n%?\n"</span>
))
(<span class="org-keyword">should</span>
(string=
(my/org-capture-prefill-template
<span class="org-string">"* TODO %^{Task}\nSCHEDULED: %^t\n:PROPERTIES:\n:Effort: %^{effort|1:00|0:05|0:15|0:30|2:00|4:00}\n:END:\n%?\n"</span>
<span class="org-string">"Hello World"</span> <span class="org-string">"<2015-01-01>"</span>)
<span class="org-string">"* TODO Hello World\nSCHEDULED: <2015-01-01>\n:PROPERTIES:\n:Effort: %^{effort|1:00|0:05|0:15|0:30|2:00|4:00}\n:END:\n%?\n"</span>))
(<span class="org-keyword">should</span>
(string=
(my/org-capture-prefill-template
<span class="org-string">"* TODO %^{Task}\nSCHEDULED: %^t\n:PROPERTIES:\n:Effort: %^{effort|1:00|0:05|0:15|0:30|2:00|4:00}\n:END:\n%?\n"</span>
<span class="org-string">"Hello World"</span> <span class="org-string">"<2015-01-01>"</span> <span class="org-string">"0:05"</span>)
<span class="org-string">"* TODO Hello World\nSCHEDULED: <2015-01-01>\n:PROPERTIES:\n:Effort: 0:05\n:END:\n%?\n"</span>)))
(<span class="org-keyword">defun</span> <span class="org-function-name">my/org-capture-prefill-template</span> (template <span class="org-type">&rest</span> values)
<span class="org-doc">"Pre-fill TEMPLATE with VALUES."</span>
(<span class="org-keyword">setq</span> template (<span class="org-keyword">or</span> template (org-capture-get <span class="org-builtin">:template</span>)))
(<span class="org-keyword">with-temp-buffer</span>
(insert template)
(goto-char (point-min))
(<span class="org-keyword">while</span> (re-search-forward
(concat <span class="org-string">"%</span><span class="org-string"><span class="org-regexp-grouping-backslash">\\</span></span><span class="org-string"><span class="org-regexp-grouping-construct">(</span></span><span class="org-string">"</span>
<span class="org-string">"\\[</span><span class="org-string"><span class="org-regexp-grouping-backslash">\\</span></span><span class="org-string"><span class="org-regexp-grouping-construct">(</span></span><span class="org-string">.+</span><span class="org-string"><span class="org-regexp-grouping-backslash">\\</span></span><span class="org-string"><span class="org-regexp-grouping-construct">)</span></span><span class="org-string">\\]</span><span class="org-string"><span class="org-regexp-grouping-backslash">\\</span></span><span class="org-string"><span class="org-regexp-grouping-construct">|</span></span><span class="org-string">"</span>
<span class="org-string">"<</span><span class="org-string"><span class="org-regexp-grouping-backslash">\\</span></span><span class="org-string"><span class="org-regexp-grouping-construct">(</span></span><span class="org-string">[</span><span class="org-string"><span class="org-negation-char">^</span></span><span class="org-string">>\n]+</span><span class="org-string"><span class="org-regexp-grouping-backslash">\\</span></span><span class="org-string"><span class="org-regexp-grouping-construct">)</span></span><span class="org-string">></span><span class="org-string"><span class="org-regexp-grouping-backslash">\\</span></span><span class="org-string"><span class="org-regexp-grouping-construct">|</span></span><span class="org-string">"</span>
<span class="org-string">"</span><span class="org-string"><span class="org-regexp-grouping-backslash">\\</span></span><span class="org-string"><span class="org-regexp-grouping-construct">(</span></span><span class="org-string">[tTuUaliAcxkKInfF]</span><span class="org-string"><span class="org-regexp-grouping-backslash">\\</span></span><span class="org-string"><span class="org-regexp-grouping-construct">)</span></span><span class="org-string"><span class="org-regexp-grouping-backslash">\\</span></span><span class="org-string"><span class="org-regexp-grouping-construct">|</span></span><span class="org-string">"</span>
<span class="org-string">"</span><span class="org-string"><span class="org-regexp-grouping-backslash">\\</span></span><span class="org-string"><span class="org-regexp-grouping-construct">(</span></span><span class="org-string">:[-a-zA-Z]+</span><span class="org-string"><span class="org-regexp-grouping-backslash">\\</span></span><span class="org-string"><span class="org-regexp-grouping-construct">)</span></span><span class="org-string"><span class="org-regexp-grouping-backslash">\\</span></span><span class="org-string"><span class="org-regexp-grouping-construct">|</span></span><span class="org-string">"</span>
<span class="org-string">"\\^</span><span class="org-string"><span class="org-regexp-grouping-backslash">\\</span></span><span class="org-string"><span class="org-regexp-grouping-construct">(</span></span><span class="org-string">{</span><span class="org-string"><span class="org-regexp-grouping-backslash">\\</span></span><span class="org-string"><span class="org-regexp-grouping-construct">(</span></span><span class="org-string">[</span><span class="org-string"><span class="org-negation-char">^</span></span><span class="org-string">}]*</span><span class="org-string"><span class="org-regexp-grouping-backslash">\\</span></span><span class="org-string"><span class="org-regexp-grouping-construct">)</span></span><span class="org-string">}</span><span class="org-string"><span class="org-regexp-grouping-backslash">\\</span></span><span class="org-string"><span class="org-regexp-grouping-construct">)</span></span><span class="org-string">"</span>
<span class="org-string">"?</span><span class="org-string"><span class="org-regexp-grouping-backslash">\\</span></span><span class="org-string"><span class="org-regexp-grouping-construct">(</span></span><span class="org-string">[gGtTuUCLp]</span><span class="org-string"><span class="org-regexp-grouping-backslash">\\</span></span><span class="org-string"><span class="org-regexp-grouping-construct">)</span></span><span class="org-string">?</span><span class="org-string"><span class="org-regexp-grouping-backslash">\\</span></span><span class="org-string"><span class="org-regexp-grouping-construct">|</span></span><span class="org-string">"</span>
<span class="org-string">"%\\\\</span><span class="org-string"><span class="org-regexp-grouping-backslash">\\</span></span><span class="org-string"><span class="org-regexp-grouping-construct">(</span></span><span class="org-string">[1-9][0-9]*</span><span class="org-string"><span class="org-regexp-grouping-backslash">\\</span></span><span class="org-string"><span class="org-regexp-grouping-construct">)</span></span><span class="org-string">"</span>
<span class="org-string">"</span><span class="org-string"><span class="org-regexp-grouping-backslash">\\</span></span><span class="org-string"><span class="org-regexp-grouping-construct">)</span></span><span class="org-string">"</span>) <span class="org-warning">nil t)</span>
(<span class="org-keyword">if</span> (car values)
(replace-match (car values) nil t))
(<span class="org-keyword">setq</span> values (cdr values)))
(buffer-string)))
(<span class="org-keyword">defun</span> <span class="org-function-name">my/org-get-current-refile-location</span> ()
<span class="org-doc">"Return the current entry as a location understood by org-refile."</span>
(<span class="org-keyword">interactive</span>)
(list (elt (org-heading-components) 4)
(<span class="org-keyword">or</span> buffer-file-name
(<span class="org-keyword">with-current-buffer</span> (buffer-base-buffer (current-buffer))
buffer-file-name))
nil
(point)))
(<span class="org-keyword">defun</span> <span class="org-function-name">my/helm-org-create-task</span> (candidate)
<span class="org-doc">"Creates the task and returns the location."</span>
(<span class="org-keyword">let</span> ((entry (org-capture-select-template <span class="org-string">"T"</span>)))
(org-capture-set-plist entry)
(org-capture-get-template)
(org-capture-set-target-location)
(<span class="org-keyword">condition-case</span> error
(<span class="org-keyword">progn</span>
(org-capture-put
<span class="org-builtin">:template</span>
(org-capture-fill-template
(my/org-capture-prefill-template (org-capture-get <span class="org-builtin">:template</span>)
candidate)))
(org-capture-place-template
(equal (car (org-capture-get <span class="org-builtin">:target</span>)) 'function))
(<span class="org-keyword">setq</span> org-refile-target-table (org-refile-get-targets))
<span class="org-comment-delimiter">;; </span><span class="org-comment">Return the new location</span>
(my/org-get-current-refile-location))
((<span class="org-warning">error</span> quit)
(<span class="org-keyword">if</span> (get-buffer <span class="org-string">"*Capture*"</span>) (kill-buffer <span class="org-string">"*Capture*"</span>))
(<span class="org-warning">error</span> <span class="org-string">"Capture abort: %s"</span> error)))))
<span class="org-comment-delimiter">;; </span><span class="org-comment">(my/org-refile-get-location-by-substring "Try again")</span>
</pre>
</div>
<p>
Next, I want to add this to the way that Helm prompts me to refile.
That means that my creation task should return something ready for
<code>org-refile</code>. Actually, maybe I don't have to do that if I know I'm
always going to call it when I want to jump to something. I might as
well add that bit of code that sets up clocking in, too.
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp"> (<span class="org-keyword">defvar</span> <span class="org-variable-name">my/helm-org-refile-locations</span> nil)
(<span class="org-keyword">defvar</span> <span class="org-variable-name">my/org-refile-last-location</span> nil)
(<span class="org-keyword">defun</span> <span class="org-function-name">my/helm-org-clock-in-and-track-from-refile</span> (candidate)
(<span class="org-keyword">let</span> ((location (org-refile--get-location candidate my/helm-org-refile-locations)))
(<span class="org-keyword">save-window-excursion</span>
(org-refile 4 nil location)
(my/org-clock-in-and-track)
t)))
(<span class="org-keyword">defun</span> <span class="org-function-name">my/org-get-todays-items-as-refile-candidates</span> ()
<span class="org-doc">"Return items scheduled for today, ready for choosing during refiling."</span>
(delq
nil
(mapcar
(<span class="org-keyword">lambda</span> (s)
(<span class="org-keyword">if</span> (get-text-property 0 'org-marker s)
(list
s
(buffer-file-name (marker-buffer (get-text-property 0 'org-marker s)))
nil
(marker-position (get-text-property 0 'org-marker s)))))
(<span class="org-keyword">save-window-excursion</span> (my/org-get-entries-fn (calendar-current-date) (calendar-current-date))))))
<span class="org-comment-delimiter">;; </span><span class="org-comment">Based on http://emacs.stackexchange.com/questions/4063/how-to-get-the-raw-data-for-an-org-mode-agenda-without-an-agenda-view</span>
(<span class="org-keyword">defun</span> <span class="org-function-name">my/org-get-entries-fn</span> (begin end)
<span class="org-doc">"Return org schedule items between BEGIN and END.</span>
<span class="org-doc">USAGE: (org-get-entries-fn '(6 1 2015) '(6 30 2015))"</span>
(<span class="org-keyword">require</span> '<span class="org-constant">calendar</span>)
(<span class="org-keyword">require</span> '<span class="org-constant">org</span>)
(<span class="org-keyword">require</span> '<span class="org-constant">org-agenda</span>)
(<span class="org-keyword">require</span> '<span class="org-constant">cl</span>)
(<span class="org-keyword">unless</span>
(<span class="org-keyword">and</span>
(calendar-date-is-valid-p begin)
(calendar-date-is-valid-p end))
(<span class="org-keyword">let</span> ((debug-on-quit nil))
(<span class="org-warning">signal</span> 'quit `(<span class="org-string">"One or both of your gregorian dates are invalid."</span>))))
(<span class="org-keyword">let*</span> (
result
(org-agenda-prefix-format <span class="org-string">" • "</span>)
(org-agenda-entry-types '(<span class="org-builtin">:scheduled</span>))
(date-after
(<span class="org-keyword">lambda</span> (date num)
<span class="org-doc">"Return the date after NUM days from DATE."</span>
(calendar-gregorian-from-absolute
(+ (calendar-absolute-from-gregorian date) num))))
(enumerate-days
(<span class="org-keyword">lambda</span> (begin end)
<span class="org-doc">"Enumerate date objects between BEGIN and END."</span>
(<span class="org-keyword">when</span> (> (calendar-absolute-from-gregorian begin)
(calendar-absolute-from-gregorian end))
(<span class="org-warning">error</span> <span class="org-string">"Invalid period : %S - %S"</span> begin end))
(<span class="org-keyword">let</span> ((d begin) ret (cont t))
(<span class="org-keyword">while</span> cont
(<span class="org-keyword">push</span> (copy-sequence d) ret)
(<span class="org-keyword">setq</span> cont (not (equal d end)))
(<span class="org-keyword">setq</span> d (funcall date-after d 1)))
(nreverse ret)))) )
(org-agenda-reset-markers)