Thursday, December 30, 2010

Finding Emacs - An Intermission

I've been having fun working through what Emacs is all about over the last few months.  It is interesting to see what makes it so popular, and since I've also been a fan of VI and VIM, the comparison has been interesting.

Whilst I still think that knowing Vi is essential (it is ALWAYS available for a strange system), Emacs has an irresistible attraction - being built upon a lisp interpreter opens up all sorts of possibilities.  I am firmly sold on Orgmode, and my blog posting of using it with gpg for encryption, whilst basic shows the possibilities.  Symmetric encryption with gpg also makes one wonder why bother with other utilities ....

The thing of beauty that is Emacs is that it is available for whichever platform you use, it is extensive and the effort required to learn it will be repaid many times over in a lifetime.  The term "core competency" comes to mind.

Another thing I've come to accept is that Emacs requires effort to learn.  There is no really easy way.  First do the tutorial, perhaps look at a few websites, but READ the MANUAL.  Let the brain think about it and move on from there.  You cannot learn the piano in a week.

On Windows, if you want to use Emacs, then load Cygwin for any supporting binaries.  Cygwin is just essential.

In a way, the whole thing rather mirrors my journey learning Linux.  At first it was strange, and I bought a boxed set of SuSe Linux about 10 years ago, then I used Red Hat for a while and then Slackware (what a wonderful system).  Finally I settled on Debian.  Only today I was looking at a Windows setup and thinking how much easier Debian was to deal with.

About a year ago, I did a couple of posts about Debian Squeeze as it was then.  There were a few problems as could be expected of it at that stage in its development, however now it is days away from becoming the new Debian Stable.  It is a wonderful system.  Like Emacs, the effort expended in learning Debian Linux is repaid many times over.

But then, like so many things in life, we cannot appreciate these things until we have undertaken the journey.


Later.....

Tuesday, December 21, 2010

Finding Emacs - A Personal Information Manager Part 1

Over previous posts, I've been building Emacs capabilities.  It occurred to me that I had a secure information manager that I could take anywhere with me and that I could recover anywhere.

Here are the components.

  • Emacs
  • My Encryption post
  • My Orgmode Outlines post
  • DropBox

Use an Orgmode outline to structure your data - save it using encryption previously described and then copy it to Dropbox.  Secure, and you can re-create the information on ANY platform with nothing but the knowledge it can be done, this Blog, and Dropbox.

Sounds good to me.




later .......

Finding Emacs - RMail - SUCCESS!!

Emacs has an inbuilt mail program, RMail.  This is a basic mail client that was originally intended to read mail that had been already imported to the local machine or onto the network by a Mail Transport Agent.  If you configure Rmail for POP/SMTP then RMail will take over Emacs while it is retrieving mail - you will lose all multi-tasking and Emacs will appear to freeze. You have been warned.

RMail and Copying Mbox Mail

Want to read mail in the Apple Mail folders on OSX in RMail?

Set the mail file to:

Mail: ~/Library/Mail//INBOX.mbox/mbox

ie in init.el

(setq rmail-primary-inbox-list '("Mail: ~/Library/Mail//INBOX.mbox/mbox"))

then
`rmail-preserve-inbox' to non-`nil'

ie in init.el

(setq rmail-preserve-inbox t)

RMail will now copy the mbox file over to the RMail file for you to use.  

NOTE- WARNING - I have not tried this, just tried to figure out what a few posts have said..


RMail and POP Access
After some experimentation, here is the init.el file config that worked for me. I was able to log on to my local ISP with POP and to retreive email, then to send email as well. The mail was deleted from the server when I retreived it.

;; email address 
(setq user-full-name "Firstname Lastname") 
(setq user-mail-address "username@ispname.com")

;; Movemail Program - modify your path as required 
(setq rmail-movemail-program "c:\\pro\\emacs-23.2\\bin\\movemail.exe")

;;POP
(setenv "MAILHOST" "yourISP_Pop_servername") 
(setq rmail-primary-inbox-list '("po:username@ispname.com"))
(setq rmail-pop-password-required t)  

;;SMTP 
(setq smtpmail-default-smtp-server "yourISP_smtp_servername") 
(setq smtpmail-local-domain nil) 
(setq send-mail-function 'smtpmail-send-it)
(load-library "smtpmail")

NOTE: I had to use the format for the POP line "po:username@ispname.com" to make it work.


later ...

Update 24Dec10:

  • Corrected the POP config - some formatting had been lost in the bit-bucket.
  • Movemail program that is included with Emacs will only perform non-SSL connections. Gnu has a more complete version, however I have not found a binary for Windows. As its name suggests, its purpose is to move mail between points.



Disclaimer: You will be vewy vewy careful with the above instructions!

Sunday, December 19, 2010

Finding Emacs - Mail, the Bad and the Good

Having heard that Emacs has two built in email clients (rmail, gnus) I've been trying to get them to work for me.  Everywhere I've read, I have seen people frustrated at not being able to get imap working, and complaining that Emacs freezes when it starts dealing with mail.  So, why is this and is there anything we can do about it?

RMail and Gnus were originally intended to deal with mail from the local network, not remote servers on the internet.  If RMail, for example, is collecting mail from a POP server, then Emacs multi-tasking is lost and it "freezes" until that mail collection is complete.  The good news is that Emacs does come with the "Movemail" program needed to communicate with POP servers, so all this can be done from within Emacs.

Setting up email in Emacs comes at a cost.

The conclusions I've come to are that to use mail effectively, Emacs needs an external mail transfer agent to do the work of transferring the mail to and from the Internet, and then the mail client can do the email management.  Once we make that breakthrough in thinking, the process becomes much easier and more flexible.

And we come again to Cygwin where those unix tools are provided.

Before I finish, I guess I should say that setting both clients up for POP access seems to be reasonably straightforward (haven't done it yet), and with additional SSL binaries even IMAP has been achieved by a few people (though trying to get their incantations to work for me has been elusive).  Having said that, I'd point out that POP is as far as you can go with no additional binaries.  It just seems that Emacs is a whole lot happier if an MTA is used to transfer the mail, rather than Emacs freezing while it does that job.  Having Emacs lock up seems to defeat the purpose of ease of use.

later .....................

Finding Emacs - Orgmode, Outlines and Ascii Export

I mentioned earlier that I came to Emacs because I thought Orgmode would be a great thing to use.  Cross platform, readable format and a powerful tool once it has been learnt.  To make the learning curve a little flatter, here is how to do a simple outline in Orgmode, and to export it to a text file.

I've already pointed to the link that shows the few lines that are needed to be inserted in the " init.el " file, so all we need to do is to open a file and start.  I name all my orgmode files with the suffix " .org " - makes it easier to recognise, and Emacs will know that we want orgmode.  The first lines of an orgmode file I open are:

-*- mode:org ; mode:visual-line -*-
#+STARTUP: indent
#+OPTIONS: H:4


The lines re-confirm it is an orgmode file, and ensure the system is set up for wordwrap the way I like it.  I tell orgmode I want the headings arranged in a more readable format, and that when I export, I want down to four levels of headings (the default is three).

To start a level one heading, type something like:

* heading one

  • If you now type M-RETURN, you will get another level one heading below it ready to name.
  • Once you have your second level one heading, type M-RIGHTARROW - you now have a level two heading. Try M-LEFTARROW now.
  • Note the coloured headings - a different colour for each heading level
  • With two level one headings, experiment with M-DOWNARROW and M-UPARROW and see that the headings (and all their sub-trees) swap around
  • If you type RETURN, then you can simply start typing text.

Want to do a list?  Try this:

list header
- list item

at the end of the " - list item " line, M-RETURN and there is the next item started for you.

Exporting

Want to export as a plain, formatted text file?
Org>Export/Publish..  menu item

A new buffer appears in a split (is that a window or a frame, he thinks)  and type   "  a  " from the list of possibilities, and the export is confirmed in the mini-buffer at the bottom.  It appears as a " .txt " file in the same directory as the " .org " file you were using.

Here is what I got:


         -*- mode:org ; mode:visual-line -*-
         ========================

Author:  
Date: 2010-12-19 11:26:27



Table of Contents
=================
1 heading one
2 Another heading


1 heading one
^^^^^^^^^^^^^^

2 Another heading
^^^^^^^^^^^^^^^^^^^
list header:
- list item
-


Of course, if you want to avoid the the first line starting with -*- , there are several ways you can easily do this, but I won't go into that now.  One final note, when you export to HTML, it follows the HTML logic, so that if you have an informal list like so:

item one
item two
item three

Then they will appear in the HTML export as:

item oneitem twoitem three



later ................

Update 12 jan11:

You can comment out the first line "-*- mode:org ; mode:visual-line -*-" to be:

# -*- mode:org ; mode:visual-line -*-

and it will not appear in the export and it will still give you the presets for your file.

Saturday, December 18, 2010

Finding Emacs - W3m and Installation Routines

I keep reading how people use the W3m pager to view the web from within Emacs and I just had to give it a go.  Believe me when I say that it isn't as easy as you might think to set up Emacs for web browsing, certainly not in Windows.  W3m doesn't exist for Windows as a separate easily downloadable binary for a start.

But wait ....... there is Cygwin.

I talked a bit about Cygwin in my last post and it turns out that for installing extensions to Emacs in Windows, that Cygwin is turning out to be the most sensible course of action.  There are exceptions of course, but in my experience there always are.

So, for that "text" web experience, start here ..

Start by downloading and installing cygwin.  It comes as a single file called "setup.exe" which will then ask which internet repository you wish to use, then download the available installation menu for you.  If you are really keen, you can install X and have some graphical Unix tools on your desktop, however we just want to download the " w3m " browser which you can easily find by using the search function included.

Next, Put the path to the " C:\cygwin\bin " directory in your .. er .. PATH environment variable.  The beauty of this is that it will allow you to use other utilities without adding more and more to the PATH, and save you some fiddling to boot.

OK, we have the easy bit done.  Now we have to download and install the emacs-w3m extension.  The extension itself is available from here and at the time of writing the most recent release was 1.4.4 from 2005.
Unpack the archive and place the resulting folder in your " .emacs.d " directory.

Installation.  This needs a bit of thought and is not entirely obvious.  On Windows, we cannot use the " make " utility so there is an alternative provided.

First, change into the emacs-w3m directory that you just unpacked, from in Emacs by using the menu FILE>Open Directory command.

Next, issue the installation command for non-Unix systems given in the web page by using the TOOLS>Shell Command menu selection.

emacs -batch -q -no-site-file -l w3mhack.el NONE -f w3mhack-nonunix-install

We are almost there.  All we need is to make changes to our " init.el " file and it is finished.  Without a thoughtful hack mentioned here, this version of w3m won't work in Emacs 23.

;; w3m
(setq load-path (cons "~/.emacs.d/emacs-w3m-1.4.4" load-path))
(setq load-path (cons "~/.emacs.d/emacs-w3m-1.4.4/attic" load-path))
(require 'w3m-e21)
(provide 'w3m-e23)
(require 'w3m-load)
 Now, restart to re-initialise your PATH variable, hold your breath and start Emacs then:

M-x w3m

and ..... ?

 

later ..............


It worked for me ... your mileage may vary ......

Finding Emacs - Cygwin

Whilst I've been investigating what I can do with Emacs, I've mostly been using a Windows XP machine - not for any reason other than it was there after I'd had to drag it out of a back room into my study to use it for a set of electronic manuals I needed to study.  Why does everyone need to write such things that are dependent on Windows?  Cross platform manuals seem such a logical thing to do.

However back to the story.  I'd started on Emacs with Org-mode for my notes and then I found myself with time on my hands and decided to expand on the Emacs and learn what else I could use it for.  I have rapidly found that the Unix heritage shows through, but I've been resisting and trying to find solutions using purely Windows binaries.  I have finally had to admit that such a course is really too complex and by far the simplest course of action is to use cygwin.


Cygwin

Simply put, Cygwin is a large subset of the Unix system compiled for Windows.  That is oversimplifying it, but essentially correct.  You can effectively use Unix tools in the Windows environment, and since there are no native binaries for a number of utilities required for Emacs extensions (or binaries that need careful searching for) it makes sense just to use Cygwin and have one entry into the PATH variable.

Of course the other advantage of Cygwin is that it provides a gentler introduction to the Unix way for people and who knows, they may even see the sense of a change and abandon the dangers of a computing monoculture.


later ....


Disclaimer:  I'm happy to tell you what I've found if you take responsibility for your actions.

Friday, December 17, 2010

Finding Emacs - Gnus (news)

The Emacs documentation says that Gnus can be used for Newsgroup reading and Email.  It all seems a bit opaque as you start, however, when all else fails, read the documentation.  Even though most manuals are more "reference manuals" than "how-to" manuals, there are a couple of things straight up that let you get connected to reading newsgroups.

First, you have the option of placing your gnus initialisation instructions in either " init.el " or in " ~/.gnus.el ".  Placing them in the gnus.el file means that they are removed from the init.el and they are only read when gnus is started.  So all that is needed is to place these lines in whichever of the two files you have chosen:

;; Gnus
(setq gnus-select-method '(nntp "news.somewhere.com"))

I note in one tutorial I found that there is also an option to place the nntp port in the server instruction, however I didn't see it mentioned in the reference manual.

Three ways you can start Gnus:

  • Menu
  • M-x gnus or 
  • M-x gnus-other-frame

Once you start, you will be presented with a restricted subset of the available newsgroups in the current buffer.  To retrieve the full alphabetically sorted list

AA

Now you can move the cursor round and enter and read whichever groups you fancy.  With the cursor over a group you want to subscribe to

u

Now, Groups>Listing>List unread subscribed groups     ( or   l  - small L)

I haven't been too intent on learning Gnus in depth, since newsgroups are not particularly interesting to me at the moment, however I did check that highlighted articles (even multiple highlighted articles) with binary attachments can be decoded and saved with:

Article>MIME>Extract all parts

Searching Google with " Gnus Tutorial " was quite productive and these are a couple I found:


This is enough to get started, and a little more dilligence will show in more detail how to best use this tool.  Like everything in Emacs, the tools overlap, so learn one and parts are of benefit elsewhere.  With one tool you know well such as Emacs, you can take it anywhere with you and not have to start afresh on a different system.


Later ............

Thursday, December 16, 2010

Strategy - Goals, Tools, Riffs

The title for this post is shamelessly taken from an article written about 10 years ago by Steve Litt at Troubleshooters.com .  The article in question is a part of his online magazine series and I find it completely brilliant in explaining an effective approach to achieving high productivity.  I guess I should show you the article first:


The lesson is not a new one, and there are many sayings that effectively echo the sentiments, such as "Jack of all trades and master of none" however the concept illustrated here is practical and shows those who hear it how to be successful when all others are not.

There is another article in this issue of Steve's that I love as well


I especially love the section titled "There is None as Blind as He Who Will Not See" .  Hard won wisdom.

Finally there is an article he wrote about the recession of the early '90s when people were being laid off and jobs were being outsourced to South Asia.  The link points to only a sub-section of the complete magazine which has so much to offer.


There is a common thread through all these articles, however I'll leave it to you to work out what they are.  In any endevour, it is not necessarily the spectacular parts of it that will give you the most reward.

One subset of this that I've taken on board is that in many professions there is a library of routines that you need to know well.  For me that is particularly so - I fly aeroplanes for a day/night job (mostly night).  There are a number of sequences that you need to remember and be able to do without thinking:

  • Go-Around
  • Loss of Cabin Pressure
  • Engine Fire

are just three, but you get the drift.

Have a good look at Steve's site.  I think it is great and has so much to offer - but only to those of us that think carefully about things.


later .......

Wednesday, December 15, 2010

Finding Emacs - Add an External Mode, Predictive, Byte Compiling

I've tried to keep these posts short to illustrate one point that will be easy to find (for me as well when I need to remember) however I'm combining three things here because they dovetail so well and really depend upon each other.


Add an External Mode

Modes in Emacs are really collections of Emacs Lisp files collected together in a directory.  You tell Emacs about them by referring to them in the " init.el " file.

This is where I believe that using the standard Emacs intitialisation structure even for Aquamacs is an excellent idea.  Use the " .emacs.d " initialisation directory and place the external modes you are adding into this directory. That way it is all neatly packed together.


Predictive


I first read about predictive on this page.  It gives a good introduction to what it is all about and how to do Byte compiling of Lisp files on a Windows machine.  Normally, when you add an external mode, they give a " makefile " which is not much good to you in Windows, however you can simply do a manual version of it using Byte Compiling using Dired.  I will repeat a couple of points on my linked page, just in case it becomes broken at some stage in the future, which will not be much good to me if I've forgotten it and am trying to piece things together again.

So, obtain Predictive from here.  I used a Windows archive utility (check freewarefiles) to unpack the " tar.gz " file into a folder called " predictive ".  Place this folder in the " .emacs.d " directory.

These are the lines I put in my " init.el " file to point to the directory.

;; Predictive
(setq load-path (cons "~/.emacs.d/predictive" load-path))
(autoload 'predictive-mode "predictive" "predictive" t)

You are all set now (after you restart Emacs to get the init.el file re-read), you can manually start predictive-mode by:

M-x predictive-mode (RETURN)

See my post about File Variables for an automagic way of starting it.

It now all works ....... errrr ........ sooorrrrttttt of.

It is sooo slooowwww it is almost unuseable.  To speed things up, we need to ...


Byte Compile Lisp Files

This is where that previous post on Dired comes in handy.  We can change to the appropriate directory, mark the files and then byte compile them from within Emacs.

C-x d ~/.emacs.d/predictive RET
% m \.el$ RET  
B                        
  • With the first line, we open Dired, changing to the predictive directory
  • The next line (starting with the % character) marks all the  " .el " files
  • Finally, the command " B " tells Emacs to start byte compiling all the marked files.  You will only have to reply " yes, or y " to confirm you want it to start.
The byte compilation will take some time, so don't worry, it will get there.  Once it is finished, restart Emacs and now you are on your way with a much faster and useable " predictive mode "


later .....

Finding Emacs - Mobileorg

 v 0.4
Oct 2011

But wait, there's more!

Orgmode has the ability to be read and manipulated on iphone / ipad / android through mobileorg.  Now to be strictly correct, there is a separate website for dealing with the android platform, however you get the idea.

There are several ways to synchronise between devices, but the method I use is through Dropbox.  Works great.

NOW ... if you use Emacs/Orgmode on Windows, you NEED to know this if you are going to use Mobileorg.  It is essential you download and install in your path the md5sum utility.  The webpage is here, and if you are uncertain which file to download, download the setup file.  The reason is that this file includes BOTH the executables AND the required dll files.  Don't forget to modify the PATH variable so that the system can find the md5sum executable.

And since there's nothing I can add that isn't a duplicate of the Mobileorg site ......



more later .......

Update 31 Dec 2010

With regard to the MD5sum program.  Rather than go through the complexity of the instructions above, download and install Cygwin, putting the cygwin\bin directory in your path.  Using the md5sum from cygwin allows you to simplify the PATH, since there are numberous cygwin binaries (w3m, gpg, gnutls etc)  that are useful for Emacs.

Additionally, the setup given in the Mobileorg page is as clear as mud.  I searched around a bit trying to remember how I set mine up and:

You can play around with the "setup" menu selection under Mobileorg in the Emacs menus, or .. use this example for additions to your init.el  .. obviously you need to modify to suit yourself:


;; Mobileorg
;; Set to the location of your Org files on your local system
(setq org-directory "~/org")
;; Set to the name of the file where new notes will be stored
(setq org-mobile-inbox-for-pull "~/org/newnotes.org")
;; Set to /MobileOrg.
(setq org-mobile-directory "~/Dropbox/MobileOrg")


(setq org-mobile-files (quote ("~/org/A380Notes.org")))



if you want all your org files to be pushed then:


(setq org-mobile-files (quote ("~/org")))


Then to manipulate in Emacs:
M-x org-mobile-push
and
M-x org-mobile-pull


I'm sure there are errors above - will work on it and refine the above later - I know how frustrating it can be trying to find these things out and thought I'd post what I have at the moment.

Update 9 Oct 2011

I spent the afternoon reviewing my MobileOrg setup on a Windows 7 machine. 

To use Emacs / Mobileorg on a Windows machine, you really do need some Unix tools.  Either use Cygwin, or install the GnuWin32 tools from Sourceforge.  (I won't supply the links - google will provide).  You will need "coreutils" (and the "make" utility if you are going to compile any lisp files).  Make sure the GnuWin32 "bin" directory is in your path. (coreutils contains the "md5sum" utility).

Whilst the instructions on the MobileOrg website are correct, I found there were a few "gotchas" that need explaining. 
  • Dropbox has changed its location on a Windows Machine.  It is now just "Dropbox" rather than "My Dropbox".  Took me a while to work out why things were not working when Mobileorg on Emacs said they were.
  • The filename for collecting notes from the mobile device can be anything you like.
  • The "index.org" file format is described correctly, however be particularly careful of the syntax for the link. ... " [[file:first.org][An Org file I like]] " .. as opposed to the http format.
I tried using "Box.net" as a WEBDAV connection, however the link format they use is incompatible with Mobileorg.

The only other thing I can think of  to note is that the file for notes from the mobile device will probably get confused if you have multiple devices collecting notes, such as an ipad AND an iphone.


Later......

Finding Emacs - Orgmode

A suitable sub-title for this post would be:

Just how deep does this rabbit hole go?

I couldn't possibly show how to use orgmode in a blog posting.  It is far more profitable to visit the orgmode website and view the youtube videos and tutorials.

Instructions as to the text to insert into your " init.el " file are in the activation section of the orgmode manual.

What I can do though is to give you an overview and just a hint of what you are able to achieve using orgmode.  Orgmode has been likened to being an "Office suite" for Emacs and the comparison is not too far from the truth.  In its basic iteration, orgmode seems to be an outliner, which is where it started life however it also has to-do list capabilities, agenda views, the ability to produce a nicely formatted table and to run spreadsheets and formulas within a text orgmode document.  Then there are the export capabilities - we start with exporting your document as an ascii text document whereupon you see a nicely formatted document with a table of contents at the front.  Then you can export to HTML if you wish or make a beautifully indexed PDF or Latex document.

I suppose I should tell you that Orgmode is included in Emacs.

Finally, these are first lines I put into an orgmode file:


-*- mode:org ; mode:visual-line; mode:predictive -*-
#+STARTUP: indent
#+OPTIONS: H:4

The first line I have discussed previously, however the next two lines are specific orgmode instructions that you can read more about in the manual.  The first tells orgmode to indent sub-headings so as to make the document more readable, and the second tells orgmode to export as separate headings down to 4 levels of headings.  If you have, say 5 levels, they will be exported, but not placed as a heading, just text.

I leave the rest to your curiosity.


more later ...........

Finding Emacs - Customising Automatically per File

psst ..... listen verryy carefully ... I shall say this only once ...

The secret search term is  "emacs file variables"

To set modes and variables for an individual file, place a line such as that below on the FIRST line of the file.

-*- mode:org ; mode:visual-line; mode:predictive -*-

What this line means is to set the file for orgmode, word-wrap and predictive text typing.  Saves having to enter keystrokes to set the environment how you want.

There is an alternative syntax that can be used at the end of the file, however I'll leave you to read the reference for that.

Update 17Jan11

Placing the particular comment character for the source file you are using in front of the customisation line will render it invisible in the output, so for orgmode, it would look like this:

# -*- mode:org ; mode:visual-line; mode:predictive -*-

more later ...



I'll leave you to spot the errors ..... :)

Finding Emacs - to Word Wrap or to Truncate

When I started using Emacs, which was only a few months ago when I discovered org-mode, I spent a little bit of time working out how to organise the word-wrap of text files.

The menu selection "Options>Line Wrapping in this Buffer" has the answer.
  • Truncate lines simply means that the line will continue until you terminate the line and you will only see a small amount of it in the window.
  • Visual Line Mode is what we typically think of word wrapping in the window.
  • Wrap at Window Edge is another line wrap mode which appears to work, however I prefer the previous two modes as I'm using the editor.
Remember, you will probably have to set the wrap manually.

.... unless .... you have learnt to set the modes and variables per file.

Finding Emacs - Dired (Directory Editor)

  • Allows you to perform actions on files and directories, with the feedback to you displayed on a buffer.
  • Can be closed with the File>Close menu.
  • Can be opened with the " C-x d " keyboard command, or with the File>Open Directory menu command.

I mention Dired here, since we will use it when we byte-compile some of the Elisp files upon adding additional modules or updating existing ones.

:)

Tuesday, December 14, 2010

Finding Emacs - Encryption

v 0.3
It is quite easy to use encryption with Emacs.  Ensure you have gpg installed - under Windows, you can either install gpg for windows, or install it through Cygwin.  Under OSX and Linux, gpg will most probably already be installed.

So, if you have Windows, download and install gpg for windows or install Cygwin with gpg

In any event, add these lines to your " init.el " file


;; Encryption - symmetric gpg
(require 'epa)
(epa-file-enable)


  • Any file with the ending " .gpg " will be taken as encrypted.
  • When you open or save such a file, you will be asked for a password.
  • If you use orgmode, then a file of the format " filename.org.gpg " will be taken as ormode and encrypted.

This will result in a symmetric encryption scheme - you will need to provide the password to open the file, and the password twice to encrypt it.  That is it.

Update 28Jan11

After having not used "Aquamacs" and my Mac laptop for some time - because I was at home rather than at work - I discovered that using Aquamacs with "gpg" encrypted files as above brought up the MacGPG interface (which is rather nice).  SO, if trying to use encryption on the Mac doesn't "just work", then you might want to go to MacGPG at sourceforge and download their binary (1.4.9 is the version I've been using).  Apologies for any frustration.

Have you been certified to be let out unsupervised?

Finding Emacs - Spell Check in Windows

Default spell check in Emacs is Ispell.  Well, I had a look and took someone's advice and went with Aspell.  Here are the steps.




The init.el modifications are:


;; Aspell
(setq-default ispell-program-name "c:\\Program Files\\Aspell\\bin\\aspell.exe")


Now all the spell check menu items in Emacs work like a charm.

Do I REALLY need to tell you that you are responsible for your actions?


more later .......

Finding Emacs - The Window is a Frame and the Frame is a Window

Emacs was written before Microsoft Windows came on the scene, so the terminology is different.  Consider when you first fire up Emacs.  There is one window looking at you with a menu bar and toolbar at the top.

Weeelllll .. almost.

The outer border is a FRAME.  Inside that is one WINDOW.  You can have several divisions inside a frame, each of which is called a window.  You can play with this with the File menu.  Select new Frame.  Split the window, and remove the splits.

Now for Buffy ... er ... Buffers.


  • The term "buffer" is effectively a file in memory.  
  • You can choose from the list of buffers to show one in a window using the buffer menu  and you can look at the same buffer in any number of windows.  
  • You can open or close a buffer from the File menu.  
  • One final twist.  If you are playing a game, or using one of the associated programs from within Emacs, that program is a buffer.  
  • You can close it using the File-Close menu selection, or select another to use from the Buffer menu.



Easy ... er ... yes ....


Later.

Finding Emacs - the Growing Links List

Finding Emacs - Installation

 v 0.3
12 Oct 11

(Note - see updated post dated Oct 11)

There are probably three questions that come to mind when installing Emacs:
  • Where does the program go?
  • Where is "Home" on this platform?
  • How is the Emacs initialisation / configuration file organised?


Where does the program go?

OSX and Linux have this pretty well sorted out and it is only on Windows that you have to make a decision.  Of course "Program files" is the obvious first choice, however since Emacs is normally distributed for Windows as the straight binary with no installer, I tend to put it (and other such programs) in a " C:\pro " directory, so that the path becomes "C:\pro\emacs " .



Where is  "Home" ?

Home is pretty obvious when you think about it - except for Windows.  So where is it in Windows?  Depends.

For Windows XP it is "C:\Documents and Settings\username
For Windows Vista and 7 it is "C:\Users\username

where username  represents whatever your username for your account is.

..... but wait!

For Windows XP at least, when you have a look at the environment variables, THERE IS NO HOME!  The variable is called HOMEPATH - not much use to Emacs.  So, make an environmental variable "HOME" to make things to your liking, and this is what I have done.

Should you want to set your "HOME", in Control Panel, go to System>Advanced>Environment Variables>User variables.


How is the Emacs initialisation / configuration file organised?

Conventional positioning now is that the Emacs init file is in " ~\.emacs.d\init.el ".  Aquamacs has a different position in preferences - " ~/Library/Preferences/Aquamacs Emacs/Preferences.el " where, whilst it will understand the traditional init file, it will use Preferences.el if it can.

A significant advantage of using the " .emacs.d " directory is that you can put other emacs related files and directories in it and use it all from one place.

Some notes on Unix nomenclature.
  • The " ~ " character at the front of a pathname refers to the " home " directory.
  • A dot at the beginning of a file or directory name will hide that item in Unix.
  • Directories in Unix often have a " .d " at the end to distinguish them from files.  So " .emacs.d " is a hidden directory, whilst " .emacs " is a hidden file and " emacs " is a visible file.

Update 25 Dec 10

Clarifying for Windows XP - I make my "HOME" as "C:\home" - this makes it easy for me to sort things as my machine is a single user machine - if there are several accounts, then the homepath given above may well be the better way to go.

..... later

disclaimer - this worked for me, it may not work for you.




Monday, December 13, 2010

Finding Emacs - Why?

 v 0.3
Updated 12 Oct 11


A sometime series I thought I'd post as I work out how to use this amazing piece of software.

At first blush, you look at Emacs and think:

  • "Hey, it is only an editor - what can the fuss be?  There are heaps of editors out there that do great stuff, and are easier to use to boot!"
  • Then you hear more, about the wars with Vim and then the extensibility or something.
  • And then you find out about Orgmode and discover that many people only come to Emacs because of this.  And then they are lost forever.


Why is Emacs Different?

Emacs is different because at its heart, it is a Lisp interpreter around which all the routines are built.  It is putty and it is extensible to do whatever you want.  Start using it as an editor, then discover the calculator, the calendar and then the games.  Use orgmode for outlines, agendas and then export to latex.  Discover the newsreader, email client and then the web-browser.

Perhaps a tour is in order.


Which Computers will it Run on?


What system do you use?  You can download and run Emacs on pretty much any platform you can think of.  If you run Unix or Linux then you probably already have Emacs included - at least in the Terminal, if not on the desktop.

Emacs for Windows
Emacs for OSX
Aquamacs for OSX


Investment in the Future

Learn Emacs and you have it for life.  Doesn't sound like much, but the more you invest in learning to use Emacs, the richer your long-term rewards.  It can do so much that replaces those one-off programs you buy and use for a while.  Emacs can stay with you no matter which computer you buy in the future.  It will always be there to get you out of that hole.

Update 12 Oct 11

It's been a year since I wrote this, and can only say that it understates the case for Emacs.  As I've learnt how to manipulate this piece of software, I can only say that the effort has been well worth it.

Learn Emacs and its tools, such as Orgmode and you will have a highly capable authoring and organising tool that you can use on any computer for as long as you wish.


disclaimer - this worked for me, it may not work for you.


more later ......