<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Eyes-free Linux Ninja! (Emacspeak)</title><link>http://eyesfreelinux.ninja/</link><description></description><atom:link href="http://eyesfreelinux.ninja/categories/emacspeak.xml" type="application/rss+xml" rel="self"></atom:link><language>en</language><lastBuildDate>Fri, 22 Sep 2017 20:57:19 GMT</lastBuildDate><generator>https://getnikola.com/</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Emacs/Emacspeak Initialization Strategy</title><link>http://eyesfreelinux.ninja/posts/emacs-init-files.html</link><dc:creator>Mike</dc:creator><description>&lt;div&gt;&lt;p&gt;This afternoon I have changed the way my &lt;code&gt;emacs&lt;/code&gt; and &lt;code&gt;emacspeak&lt;/code&gt; initialization works.&lt;/p&gt;
&lt;p&gt;Until now I have always used the file:&lt;/p&gt;
&lt;pre class="code literal-block"&gt;&lt;span&gt;&lt;/span&gt;~/.emacs
&lt;/pre&gt;


&lt;p&gt;For my initialization.  But today, in reading about how &lt;code&gt;emacs&lt;/code&gt; initialization
and library-loading works, to try to understand how T.V. Raman does it and how
his files in the &lt;code&gt;git&lt;/code&gt; repository all hang together, I have made
a discovery which has made me understand things a lot better and change my strategy.&lt;/p&gt;
&lt;h2&gt;Initialization Files&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;emacs&lt;/code&gt; will look for any of these files for it's initialization:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;~/.emacs&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;~/.emacs.el&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;~/.emacs.d/init.el&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So, I changed from using &lt;code&gt;~/.emacs&lt;/code&gt; to &lt;code&gt;~/.emacs.d/init.el&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Not only that but I have made some other discoveries, things which I did not know about before.&lt;/p&gt;
&lt;p&gt;In our &lt;code&gt;.emacs&lt;/code&gt; files we have usually had two blocks of &lt;code&gt;lisp&lt;/code&gt; that begin with:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;(custom-set-variables ...&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;(custom-set-faces ...&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These two blocks of code are places into which changes are made when the &lt;code&gt;emacs&lt;/code&gt; customization 
screens are used to make adjustments, hence the commentary in these blocks which warn about editing 
them by hand and not having more than one occurrence of each block.&lt;/p&gt;
&lt;p&gt;Now, of course when adding stuff to the &lt;code&gt;emacs&lt;/code&gt; initialization files by hand it is very easy to screw something up and
stop the initialization from working.&lt;/p&gt;
&lt;p&gt;When running &lt;code&gt;emacspeak&lt;/code&gt; this is always immediately obvious because it comes up talking very, very 
slowly.  Assuming of course you have &lt;code&gt;emacspeak&lt;/code&gt; configured to talk more quickly than the default.&lt;/p&gt;
&lt;p&gt;It is possible, it seems, to place the &lt;code&gt;custom-set-variables&lt;/code&gt; and &lt;code&gt;custom-set-faces&lt;/code&gt; code blocks into a separate file, name it as the custom
file and then load it from the main initialization file.&lt;/p&gt;
&lt;p&gt;So, bearing in mind we are now using &lt;code&gt;~/.emacs.d/init.el&lt;/code&gt; as our initialization file, place these two lines at the top
of it:&lt;/p&gt;
&lt;pre class="code literal-block"&gt;&lt;span&gt;&lt;/span&gt;(setq custom-file "~/.emacs.d/custom.el")
(load custom-file)
&lt;/pre&gt;


&lt;p&gt;The first of these lines instructs &lt;code&gt;emacs&lt;/code&gt; that we want to use a different file from our main
initialization file for custom changes made by the &lt;code&gt;emacs&lt;/code&gt; customization
mechanism.&lt;/p&gt;
&lt;p&gt;The second line instructs &lt;code&gt;emacs&lt;/code&gt; to load it.&lt;/p&gt;
&lt;p&gt;Now we can merrily add other stuff to &lt;code&gt;~/.emacs.d/init.el&lt;/code&gt;, knowing that we are at no
risk of messing up those customizations added with the &lt;code&gt;emacs&lt;/code&gt; mechanism.&lt;/p&gt;
&lt;h2&gt;Loading Personal Libraries&lt;/h2&gt;
&lt;p&gt;Instead of loading everything we want in our initialization file, we can split it up, and make it
much more &lt;em&gt;modular&lt;/em&gt;.  In this way we can tinker with
something new, and when something breaks, we know more easily what broke it and probably how to fix it.&lt;/p&gt;
&lt;p&gt;The first thing we need to do, again in our shiny new &lt;code&gt;~/.emacs.d/init.el&lt;/code&gt; file, is to add some paths to
the &lt;code&gt;load-path&lt;/code&gt; variable in &lt;code&gt;emacs&lt;/code&gt;.  It is this variable which acts a bit like
the &lt;code&gt;$PATH&lt;/code&gt; environment variable in the bash shell.&lt;/p&gt;
&lt;p&gt;Put this fragment of code in your &lt;code&gt;~/.emacs.d/init.el&lt;/code&gt; file, just
underneath the top two lines which specify and load the custom file:&lt;/p&gt;
&lt;pre class="code literal-block"&gt;&lt;span&gt;&lt;/span&gt;;; add some paths to load-path
(let ((default-directory "~/.emacs.d/lisp/"))(setq load-path
(append
(let ((load-path (copy-sequence load-path))) ;; Shadow
(append
(copy-sequence (normal-top-level-add-to-load-path '(".")))
(normal-top-level-add-subdirs-to-load-path)))
load-path)))
&lt;/pre&gt;


&lt;p&gt;This will add:&lt;/p&gt;
&lt;pre class="code literal-block"&gt;&lt;span&gt;&lt;/span&gt;~/.emacs.d/lisp
&lt;/pre&gt;


&lt;p&gt;And all of the sub-directories thereof to the &lt;code&gt;load-path&lt;/code&gt; variable.  Well,
not &lt;strong&gt;ALL&lt;/strong&gt; the sub-directories.  It will ignore things like version-control related paths, sub-directory
names that start with a dot etc., very useful if you want to put your
initialization stuff in &lt;code&gt;git&lt;/code&gt; or &lt;code&gt;CVS&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Now we can add a whole bunch of &lt;code&gt;load-library&lt;/code&gt; directives below this to load individual &lt;em&gt;personal&lt;/em&gt; libraries of
lisp code:&lt;/p&gt;
&lt;pre class="code literal-block"&gt;&lt;span&gt;&lt;/span&gt;(load-library "elpa-prepare.el")
(load-library "markdown-prepare")
(load-library "rst-prepare.el")
(load-library "abbrev-prepare")
(load-library "c-code-folding-prepare.el")
&lt;/pre&gt;


&lt;p&gt;These are just a few libraries I have created from splitting off the code which I previously used to have in my &lt;code&gt;~/.emacs&lt;/code&gt; file.&lt;/p&gt;
&lt;p&gt;It should be obvious from the names what each library is for.&lt;/p&gt;
&lt;h2&gt;What was left in ~/.emacs?&lt;/h2&gt;
&lt;p&gt;There were a few lines of code remaining in my original ~/.emacs file which I left in the new initialization file:&lt;/p&gt;
&lt;pre class="code literal-block"&gt;&lt;span&gt;&lt;/span&gt;(setq-default truncate-lines t)
(setq inhibit-splash-screen t)
&lt;/pre&gt;


&lt;p&gt;Before I did this work today it was very hard to wade through all of the
custom stuff, the &lt;em&gt;markdown&lt;/em&gt; initialization code, the &lt;em&gt;rst&lt;/em&gt; initialization
code, and find these lines.&lt;/p&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;By doing this stuff this afternoon I think I have:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Split my original &lt;code&gt;emacs&lt;/code&gt; initialization file into multiple library files which I load individually&lt;/li&gt;
&lt;li&gt;Split my manually added initialization code from the code added and changed
by the Emacs customization mechanism, which should make identifying errors easier&lt;/li&gt;
&lt;li&gt;Dramatically increased the modularity of my initializations, making it more scalable&lt;/li&gt;
&lt;li&gt;Made tinkering with &lt;code&gt;emacs&lt;/code&gt; configuration less scary and hence more inclined to get done&lt;/li&gt;
&lt;li&gt;Learned some valuable stuff about Emacs and Emacs Lisp&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Note About &lt;code&gt;load-library&lt;/code&gt; and &lt;code&gt;.elc&lt;/code&gt; Files&lt;/h2&gt;
&lt;p&gt;By adding the path to our personal-libraries to the &lt;code&gt;load-path&lt;/code&gt; variable we can
leave out the &lt;code&gt;.el&lt;/code&gt; extension of our libraries.&lt;/p&gt;
&lt;p&gt;If byte-compiled versions of any of our libraries exist in &lt;code&gt;.elc&lt;/code&gt; files, these will be
loaded in preference to &lt;code&gt;.el&lt;/code&gt; files, giving us an appreciable speed advantage.&lt;/p&gt;
&lt;p&gt;To batch compile all the &lt;code&gt;.el&lt;/code&gt; files in &lt;code&gt;~/.emacs.d/lisp&lt;/code&gt;:&lt;/p&gt;
&lt;pre class="code literal-block"&gt;&lt;span&gt;&lt;/span&gt;emacs -batch -f batch-byte-compile *.el
&lt;/pre&gt;


&lt;p&gt;The above will create &lt;code&gt;.elc&lt;/code&gt; versions of each of the &lt;code&gt;.el&lt;/code&gt; files.  These will be the files which are 
loaded in preference to the &lt;code&gt;.el&lt;/code&gt; files.&lt;/p&gt;&lt;/div&gt;</description><category>Emacs</category><category>Emacspeak</category><guid>http://eyesfreelinux.ninja/posts/emacs-init-files.html</guid><pubDate>Fri, 26 Jun 2015 17:06:59 GMT</pubDate></item><item><title>Emacspeak on Debian Jessie</title><link>http://eyesfreelinux.ninja/posts/emacspeak-on-debian-jessie.html</link><dc:creator>Mike</dc:creator><description>&lt;div&gt;&lt;p&gt;I've installed &lt;em&gt;Emacspeak&lt;/em&gt; on my Dell Latitude D630 laptop running Debian 8.0 &lt;em&gt;Jessie&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;It's version 3.9 &lt;em&gt;Big Dog&lt;/em&gt;, which I don't think is the latest version.&lt;/p&gt;
&lt;p&gt;I had to edit the Makefile for the speech server to increase the &lt;em&gt;tcl&lt;/em&gt; version from 8.4 to 8.6.&lt;/p&gt;
&lt;p&gt;It works very nicely in a &lt;em&gt;Mate&lt;/em&gt; terminal window, after pressing &lt;em&gt;caps lock+s&lt;/em&gt; to stop &lt;em&gt;Orca&lt;/em&gt; talking over the top of &lt;em&gt;Emacspeak&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;In fact I am writing this post with &lt;em&gt;Emacspeak&lt;/em&gt; instead of my usual &lt;em&gt;nano&lt;/em&gt; and I have to say that in a lot of ways I prefer it.  There is still some tweaking to be done to my &lt;em&gt;.emacs&lt;/em&gt; file.&lt;/p&gt;&lt;/div&gt;</description><category>Emacspeak</category><guid>http://eyesfreelinux.ninja/posts/emacspeak-on-debian-jessie.html</guid><pubDate>Thu, 07 May 2015 11:34:39 GMT</pubDate></item></channel></rss>