Thursday, 7 June 2018

Babbage Files moving to new site

I've created a new site, with new technology. This blog will no longer be updated. Please join me over at the new (Neo-) Babbage Files at https://babbagefiles.xyz.

Saturday, 11 November 2017

More pdf-tools tricks

Following a couple of recent postings on pdf-tools, here are a few customisations I've found handy.

For scanned pdfs, 'pdf-view-auto-slice-minor-mode can be useful to turn on. You might bind it to something like s a. It auto trims the borders for each page of the pdf as it encounters them.

The following sets up a variety of colour-filter modes (good for night-time viewing, or anytime really that you don't want your eyeballs blasted with blazing white light):

;; midnite mode hook
 (add-hook 'pdf-view-mode-hook (lambda ()
                                 (pdf-view-midnight-minor-mode))) ; automatically turns on midnight-mode for pdfs

(setq pdf-view-midnight-colors '("#ff9900" . "#0a0a12" )) ; set the amber profile as default (see below)

(defun bms/pdf-no-filter ()
  "View pdf without colour filter."
  (interactive)
  (pdf-view-midnight-minor-mode -1)
  )

;; change midnite mode colours functions
(defun bms/pdf-midnite-original ()
  "Set pdf-view-midnight-colors to original colours."
  (interactive)
  (setq pdf-view-midnight-colors '("#839496" . "#002b36" )) ; original values
  (pdf-view-midnight-minor-mode)
  )

(defun bms/pdf-midnite-amber ()
  "Set pdf-view-midnight-colors to amber on dark slate blue."
  (interactive)
  (setq pdf-view-midnight-colors '("#ff9900" . "#0a0a12" )) ; amber
  (pdf-view-midnight-minor-mode)
  )

(defun bms/pdf-midnite-green ()
  "Set pdf-view-midnight-colors to green on black."
  (interactive)
  (setq pdf-view-midnight-colors '("#00B800" . "#000000" )) ; green 
  (pdf-view-midnight-minor-mode)
  )

(defun bms/pdf-midnite-colour-schemes ()
  "Midnight mode colour schemes bound to keys"
        (local-set-key (kbd "!") (quote bms/pdf-no-filter))
        (local-set-key (kbd "@") (quote bms/pdf-midnite-amber)) 
        (local-set-key (kbd "#") (quote bms/pdf-midnite-green))
            (local-set-key (kbd "$") (quote bms/pdf-midnite-original))
 )  

(add-hook 'pdf-view-mode-hook 'bms/pdf-midnite-colour-schemes)


This automatically sets pdf-tools to display using the midnight mode amber filter.
You can return to the original/no-filter with "!" (i.e. S-1); set amber filter with "@" (i.e. S-2); set green filter with "#" (i.e. S-3); set the bluish original midnight mode colours with "$" (i.e. S-4). See below for screenshots of these different settings.







You also probably want to set the pdf-annot-default-markup-annotation-properties color to "#ff0000", as well as the pdf-annot-default-text-annotation-properties color to "#ff0000". This is a colour that is actually visible in the midnight-modes. If you go with the default yellow for markup it will not be easily visible in any of these colour-filter modes.

Sunday, 12 March 2017

Take Elfeed everywhere: Mobile rss reading Emacs-style (for free/cheap)

After the demise of Google Reader, I switched for some time to NewsBlur. Unfortunately, its Android app never worked well for me. And integrating more of my life into Emacs is always desirable, so once I saw there was an Android interface for the fantastic Emacs RSS reader Elfeed, I made the switch.

The tricky thing with the Elfeed Android client is that it wants to connect to web interface of an instance of Elfeed running inside of Emacs. I could have done with my home computer, but that would require poking a hole through the firewall and in any case would be non-ideal when for instance I was travelling.

About a month ago I hit upon a cheap (in fact, free) solution for running a remote instance of Emacs running Elfeed that is connectable with the Android app. The VPS provider Wishosting offers an OpenVZ mini for $4/year, and if you stick a link to Wishosting on your own domain you can get it for free.

On my home desktop, work desktop, and laptop, I have Syncthing installed and I use this to keep the Elfeed database in sync between these machines.

In this blogpost I outline how to add a remote always-on instance of Elfeed running in Wishosting’s OpenVZ mini which also remains in sync with all of the other machines. (I use elfeed-org to organise my feeds, and just keep the elfeed.org file in ~/.elfeed/.) Just use Syncthing to keep the ~/.elfeed directory sync’ed between all of the machines (including any VPS’s).

I set up an Ubuntu 16.04 LTS VPS on Wishosting, and then installed Emacs and Syncthing, and that is what I would recommend.

Steps
  • Create your Ubuntu 16.04 LTS VPS.
  • Make a (non-root) user with superuser capability. Login with this user.
  • Install Emacs and Syncthing.
  • Configure Syncthing appropriately. You can connect remotely to the Web GUI.
  • Create and save a .emacs file in your user’s ~ with the following contents:
    ;; package setup here
    (require 'package)
    
    (package-initialize nil)
    (setq package-enable-at-startup nil)
    
    (add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t)
    
    (add-to-list 'package-archives
          '("melpa" . "https://melpa.org/packages/") t)
    
    (add-to-list 'package-archives
          '("marmalade" .
            "http://marmalade-repo.org/packages/"))
    
    (package-initialize)
    
    ;; general add packages to list
    (let ((default-directory  "~/.emacs.d/elpa/"))
      (normal-top-level-add-subdirs-to-load-path))
    
    ;; make sure 'use-package is installed
    (unless (package-installed-p 'use-package)
      (package-refresh-contents)
      (package-install 'use-package))
    
    ;;; use-package
    (require 'use-package)
    
    ;; Load elfeed
    (use-package elfeed
      :ensure t
      :bind (:map elfeed-search-mode-map
         ;              ("A" . bjm/elfeed-show-all)
         ;              ("E" . bjm/elfeed-show-emacs)
         ;              ("D" . bjm/elfeed-show-daily)
           ("q" . bjm/elfeed-save-db-and-bury)))
    
    (require 'elfeed)
    
    ;; Load elfeed-org
    (use-package elfeed-org
      :ensure t
      :config
      (elfeed-org)
      (setq rmh-elfeed-org-files (list "~/.elfeed/elfeed.org"))
      )
    
    ;; Laod elfeed-goodies
    (use-package elfeed-goodies
      :ensure t
      )
    
    (elfeed-goodies/setup)
    
    ;; Load elfeed-web
    (use-package elfeed-web
      :ensure t
      )
    
    ;;; Elfeed
    (global-set-key (kbd "C-x w") 'bjm/elfeed-load-db-and-open)
    
    (define-key elfeed-show-mode-map (kbd "j") 'elfeed-goodies/split-show-next)
    (define-key elfeed-show-mode-map (kbd "k") 'elfeed-goodies/split-show-prev)
    (define-key elfeed-search-mode-map (kbd "j") 'next-line)
    (define-key elfeed-search-mode-map (kbd "k") 'previous-line)
    (define-key elfeed-show-mode-map (kbd "S-SPC") 'scroll-down-command)
    
    
    ;;write to disk when quiting
    (defun bjm/elfeed-save-db-and-bury ()
      "Wrapper to save the elfeed db to disk before burying buffer"
      (interactive)
      (elfeed-db-save)
      (quit-window))
    
    ;;functions to support syncing .elfeed between machines
    ;;makes sure elfeed reads index from disk before launching
    (defun bjm/elfeed-load-db-and-open ()
      "Wrapper to load the elfeed db from disk before opening"
      (interactive)
      (elfeed-db-load)
      (elfeed)
      (elfeed-search-update--force)
      (elfeed-update))
    
    (defun bjm/elfeed-updater ()
      "Wrapper to load the elfeed db from disk before opening"
      (interactive)
      (elfeed-db-save)
      (quit-window)
      (elfeed-db-load)
      (elfeed)
      (elfeed-search-update--force)
      (elfeed-update))
    
    (run-with-timer 0 (* 30 60) 'bjm/elfeed-updater)
    
    (setq httpd-port NNNNN)   ; replace NNNNN with a port equalling your start port + 10 (or whatever)
    
    (elfeed-web-start)
    
Note that you’ll need to configure the httpd-port appropriately as per the comment in the elisp above.
  • Then create the following systemd unit at ~/.config/systemd/user/emacs.service:
[Unit]
Description=Emacs: the extensible, self-documenting text editor

[Service]
Type=forking
ExecStart=/usr/bin/emacs --daemon
ExecStop=/usr/bin/emacsclient --eval "(kill-emacs)"
Restart=always

[Install]
WantedBy=default.target
  • Enable and start this unit with:
$ systemctl --user enable --now emacs
  • And then make sure it runs persistently even when you’re not connected to your VPS via ssh (this tripped me up for some time):
# loginctl enable-linger USERNAME
  • Install the Elfeed Android app on your mobile, enter the app’s Settings, and put in whatever your Wishosting ip is plus the port you chose above (NNNNN), e.g. http://199.39.100.23:54169, for the Elfeed web url.
  • That should be it. Now you’ll have access to your rss feed all over the world and Syncthing will ensure that all changes will be propagated to all of your Emacs instances including your VPS. These changes would include adding and deleting rss feeds and marking of posts as ’read’.
  • Note: on my desktops/laptop I use the following setup for Elfeed:
    ;; Load elfeed
    (use-package elfeed
      :ensure t
      :bind (:map elfeed-search-mode-map
    ;              ("A" . bjm/elfeed-show-all)
    ;              ("E" . bjm/elfeed-show-emacs)
    ;              ("D" . bjm/elfeed-show-daily)
           ("q" . bjm/elfeed-save-db-and-bury)))
    
    
    (require 'elfeed)
    
    ;; Load elfeed-org
    (use-package elfeed-org
      :ensure t
      :config
      (elfeed-org)
      (setq rmh-elfeed-org-files (list "~/.elfeed/elfeed.org"))
      )
    
    ;; Laod elfeed-goodies
    (use-package elfeed-goodies
      :ensure t
      )
    
    (elfeed-goodies/setup)
    
    ;; Load elfeed-web
    (use-package elfeed-web
      :ensure t
      )
    
    ;;functions to support syncing .elfeed between machines
    ;;makes sure elfeed reads index from disk before launching
    (defun bjm/elfeed-load-db-and-open ()
      "Wrapper to load the elfeed db from disk before opening"
      (interactive)
      (elfeed-db-load)
      (elfeed)
      (elfeed-search-update--force)
      (elfeed-update))
    
    ;;write to disk when quiting
    (defun bjm/elfeed-save-db-and-bury ()
      "Wrapper to save the elfeed db to disk before burying buffer"
      (interactive)
      (elfeed-db-save)
      (quit-window))
    
    
    ;;; Elfeed
    (global-set-key (kbd "C-x w") 'bjm/elfeed-load-db-and-open)
    
    
    
    (define-key elfeed-show-mode-map (kbd ";") 'visual-fill-column-mode)
    
    (define-key elfeed-show-mode-map (kbd "j") 'elfeed-goodies/split-show-next)
    (define-key elfeed-show-mode-map (kbd "k") 'elfeed-goodies/split-show-prev)
    (define-key elfeed-search-mode-map (kbd "j") 'next-line)
    (define-key elfeed-search-mode-map (kbd "k") 'previous-line)
    (define-key elfeed-show-mode-map (kbd "S-SPC") 'scroll-down-command)
    
    ;; probably temporary: hack for elfeed-goodies date column:
    (defun elfeed-goodies/search-header-draw ()
      "Returns the string to be used as the Elfeed header."
      (if (zerop (elfeed-db-last-update))
          (elfeed-search--intro-header)
        (let* ((separator-left (intern (format "powerline-%s-%s"
            elfeed-goodies/powerline-default-separator
            (car powerline-default-separator-dir))))
        (separator-right (intern (format "powerline-%s-%s"
             elfeed-goodies/powerline-default-separator
             (cdr powerline-default-separator-dir))))
        (db-time (seconds-to-time (elfeed-db-last-update)))
        (stats (-elfeed/feed-stats))
        (search-filter (cond
          (elfeed-search-filter-active
           "")
          (elfeed-search-filter
           elfeed-search-filter)
          (""))))
          (if (>= (window-width) (* (frame-width) elfeed-goodies/wide-threshold))
       (search-header/draw-wide separator-left separator-right search-filter stats db-time)
     (search-header/draw-tight separator-left separator-right search-filter stats db-time)))))
    
    (defun elfeed-goodies/entry-line-draw (entry)
      "Print ENTRY to the buffer."
    
      (let* ((title (or (elfeed-meta entry :title) (elfeed-entry-title entry) ""))
      (date (elfeed-search-format-date (elfeed-entry-date entry)))
      (title-faces (elfeed-search--faces (elfeed-entry-tags entry)))
      (feed (elfeed-entry-feed entry))
      (feed-title
       (when feed
         (or (elfeed-meta feed :title) (elfeed-feed-title feed))))
      (tags (mapcar #'symbol-name (elfeed-entry-tags entry)))
      (tags-str (concat "[" (mapconcat 'identity tags ",") "]"))
      (title-width (- (window-width) elfeed-goodies/feed-source-column-width
        elfeed-goodies/tag-column-width 4))
      (title-column (elfeed-format-column
       title (elfeed-clamp
              elfeed-search-title-min-width
              title-width
              title-width)
       :left))
      (tag-column (elfeed-format-column
            tags-str (elfeed-clamp (length tags-str)
              elfeed-goodies/tag-column-width
              elfeed-goodies/tag-column-width)
            :left))
      (feed-column (elfeed-format-column
             feed-title (elfeed-clamp elfeed-goodies/feed-source-column-width
          elfeed-goodies/feed-source-column-width
          elfeed-goodies/feed-source-column-width)
             :left)))
    
        (if (>= (window-width) (* (frame-width) elfeed-goodies/wide-threshold))
     (progn
       (insert (propertize date 'face 'elfeed-search-date-face) " ")
       (insert (propertize feed-column 'face 'elfeed-search-feed-face) " ")
       (insert (propertize tag-column 'face 'elfeed-search-tag-face) " ")
       (insert (propertize title 'face title-faces 'kbd-help title)))
          (insert (propertize title 'face title-faces 'kbd-help title)))))
    
Screenshots:
[Also posted at r/emacs]

Sunday, 21 December 2014

Emacs and (synchronised) org-mode on Android

Running emacs and org-mode under Android. I’m doing this on my Android tablet - it’s not perhaps as useful on a phone, though it’s not unmanageable.

There used to be an Emacs app for Android in the Google Play store - in fact it’s still there, but the server it used to download its files from is no longer working - and the app was always a bit fiddly to get to work properly.

Here’s a better way of getting it working:
  • Install ZShaolin, a console terminal emulator (zsh shell) for Android with a number of useful commandline tools like rsync, awk, imagmagick etc.
  • Then install the files from the old Emacs app. They’re no longer accessible via the app from the Play store, but I had saved the files from back when it still worked, and have zipped them up and thrown them on mega: https://mega.co.nz/#!B4AThKxI!_ImT57mJNirozxna-1SOcNGAzPRr9QacM34jUoPVMgo
  • Unzip the files from there and place at /sdcard/emacs/ on your device.
  • Then, open up ZShaolin and start a session, and type “emacs”. Voilà.
Now for getting org-mode to work. Org-mode is part of the basic Emacs setup in recent versions of Emacs (including the one above). For some reason, though, at least when I ran it, I had trouble turning on org-mode. Here’s the fix:
  • Create a .emacs file (if you don’t have one already) in ~ under ZShaolin and put the following into:
(defun load-history-filename-element (file-regexp)
  "Get the first elt of `load-history' whose car matches FILE-REGEXP.
        Return nil if there isn't one."
  (let* ((loads load-history)
         (load-elt (and loads (car loads))))
    (save-match-data
      (while (and loads
                  (or (null (car load-elt))
                      (not (and (stringp (car load-elt)) ; new condition
                                (string-match file-regexp (car load-elt))))))
        (setq loads (cdr loads)
              load-elt (and loads (car loads)))))
    load-elt))
That gets org-mode to work as expected.
fh9YvOc.png
Figure 1: Emacing an org file on Android (with ZShaolin)

Now, most likely you will have org-files that you want to keep synchronized. You may already be running MobileOrg, with something like a Dropbox synchronisation. Note that the way that the MobileOrg app works, you can’t edit the org files that it uses directly. MobileOrg utilises some sort of database and the changes that it pushes back are done so through the database, so editing the org files that MobileOrg is synched with (say, in Dropbox) won’t result in any changes being propagated back to your other devices.

So, if you’re running MobileOrg with Dropbox, you’ll need to have a separate Dropbox synchronisation in order to be able to edit org-files in Emacs on Android in a way that allows for propagation of changes from Android to other devices/repositories.

Here’s a method which allows for editing of org-mode files on Emacs which allows for back-propagation via Dropbox:
  • Create a separate Dropbox synchronisation directory - that is, separate from the one you use for MobileOrg synchronisation. [The way I did this on my Linux desktop was to create a symlink from my “Org folder” in my Documents directory to the “actual” Org directory in my Dropbox folder. In my setup, this directory also synchs with a git repository, so I ended up excluding the hidden .git directory from synching with Dropbox, since I have only a free, very-limited-space Dropbox account.]
  • Open up the Dropbox app on your Android device. Navigate to your new Org directory (not the one you use for MobileOrg). “Open” any of the org files you want to have access to. It doesn’t matter if they successfully open or not - the act of “opening” them gets the Dropbox app to save a local copy which it will keep synchronised with your Dropbox repository.
  • The location for these local files is a path like this: /sdcard/Android/data/com.dropbox.android/files/u87923223/scratch/YourOrgDirectoryName/ the u-number part of the path I assume varies from user to user; and of course the final part of the path will depend on what you named your Org folder and files
  • Files in the above path can be opened in Emacs on Android. Any changes you make will be propagated via Dropbox.
Again, this will be perhaps of limited use on a phone — though ZShaolin does have a built-in software keyboard which works very well for Emacs — on a tablet device with a keyboard (I use an Asus tablet) it works pretty well. (Though I haven’t figured out how to remap CAPSLOCK on my tablet to CTRL yet….)

Saturday, 20 December 2014

In praise of DejaVu (Sans Mono)

I do the majority of my work in Emacs - from the composition of linguistics articles and chapters, to lecture slides, to keeping track of grades, to email. Much of what I do requires a monospaced font, and much of what I do requires a good Unicode font. Which narrows the range of potential font candidates significantly. And, since I spend so much time looking at it, I would like the font to be aesthetically-pleasing.
After trying many different fonts, at different sizes and so forth, I’ve found that DejaVu Sans Mono is really the only font which meets all of these criteria. It is really a good-looking font too. Here it is in a few different applications:

Figure 1: DejaVu Sans Mono in mu4e mail
cMMuHWf.png
Figure 2: DejaVu Sans Mono in LaTeX doc
ox7g0FF.jpg
Figure 3: DejaVu Sans Mono displaying some Unicode
And…it appears to be the same font used in the terminal in Tron: Legacy:
TRON_EMACS.JPG
Figure 4: kill -9ing in Tron: Legacy with DejaVu

Saturday, 23 June 2012

Who uses Linux? (+Emacs, +TeX)

Some really rough notes. Suggestions welcome.

Notable people who use Linux (with additional notes on Emacs and TeX users), a first draft.

My rough criterion for determining who counts as "famous": does the person have a Wikipedia entry? 

Presumably many more can be added under "computer-related" (which is why I put it at the bottom). I'm only listing each person once, under most relevant/salient category (otherwise I could, for instance, list Shuttleworth also under an "astronaut" category).

See also: "The Setup / Linux" and "My Linux Rig" for more 'prominent' people and their Linux setups.

Political

Rick Falkvinge, founder of Swedish Pirate Party [Wikipedia entry]

  • Uses an Ubuntu Linux set-up [1]

Christian Engström, Swedish Pirate Party MEP [Wikipedia entry]

  • Seems to use some sort of Ubuntu Linux set-up [1, 2, 3]
  • Couple of pics with Richard Stallman from 2004 [1, 2]

Amelia Andersdotter, Swedish Pirate Party MEP [Wikipedia entry]

  • Mentions using Arch, Fedora [1, 2]
  • Also Emacs and TeX (see above links)
Vinay Gupta, geopolitical risk analyst [Wikipedia entry]
  • uses Ubuntu Linux [1] 
  • inventor of Hexayurt [1]

Writers

Cory Doctorow, blogger, journalist, & sci-fi/fantasy author [Wikipedia entry]

Charlie Stross, sci-fi/horror/fantasy author [Wikipedia entry]

  • formerly the monthly Linux columnist for Computer Shopper
  • uses Linux, but mainly for running server, otherwise Mac [1, 2, 3]
  • position on piracy: "If you've downloaded unauthorized copies of my books, instead of hitting on a tipjar button, I urge you to buy a (new) copy of one of my books....Your typical book publisher is not like the music or movie industry; they run on thin margins, and they're staffed by underpaid, overworked folk who do it because they love books, not because they're trying to make themselves rich on the back of a thousand ruthlessly exploited artists. I think their effort deserves to be rewarded appropriately..." [1]

Piers Anthony, fantasy/sci-fi author [Wikipedia entry]

  • switched to Linux in 2000 [1, 2, 3, 4]
  • mentions using a number of different distros, including Ubuntu & Fedora [1]
  • use of Linux seems at least in part principle-driven [1, 2]
  • uses LibreOffice [1]
  • concerns about piracy:
    • speaks approvingly of Harlan Ellison's war on piracy (2002-4) [1, 2]
    • complaints about piracy & Ebay (2010) [1]
    • some recognition of danger of censoring internet: "THE WEEK had an item on Internet piracy of music, books, and movies, and efforts to stop it. I have discussed this here before, but it bears repeating: pirates are thieves who are destroying the ability of creative artists to make a living, myself included; a LOT of my works are chronically stolen. The pirates need to be stopped. The problem is how to do it without censoring free expression itself. I think there does have to be a law, but one carefully crafted to shut down only the pirates." (2012) [1]

Neal Stephenson, sci-fi/speculative fiction author [Wikipedia entry]

Actors & film-related

Stephen Fry, actor [Wikipedia entry]

  • big fan of Apple products [1, 2, etc.]
  • but also touts GNU [1, 2, 3]

Wil Wheaton, actor [Wikipedia entry]

  • primarily uses Macs, but also uses Linux [1, 2]
  • support for Bittorrent [1]
Asia Carrera, adult-film actress [Wikipedia entry] 
  • early Linux-adopter, ran own website since 1998 [1, 2]
Cindy Margolis, model [Wikipedia entry]
  • apparent Debian user [1, 2]

Programmers & computer-related

Linus Torvalds [Wikipedia entry]

Richard Stallman [Wikipedia entry]

Mark Shuttleworth, programmer, entreprenuer, astronaut [Wikipedia entry]

Donald Knuth, computer scientist & professor [Wikipedia entry]

  • creator of TeX typesetting system (1978), upon which LaTeX, LuaTeX etc. are based
  • uses Ubuntu Linux (as of 2008) [1]
  • uses Emacs to edit TeX [1]
  • friends with computer security researcher Jacob Appelbaum [1]

American McGee, game designer [Wikipedia entry

  •  switched to Ubuntu Linux (from Windows) with plans to "stay switched" (2006) [1]

John "maddog" Hall, director of Linux International & professor of computer science [Wikipedia entry]

  • runs different Linux distributions depending on employer [1]

Some Initial Ruminations

A number of the people above fall into two rough groupings: "technology/gadget-lovers" vs. "ideological-users". So Stephen Fry and Wil Wheaton would fall into the first category, as would perhaps Charlie Stross and even Linus Torvalds. On the ideological side are (of course) Richard Stallman, Cory Doctorow, Piers Anthony, and the Pirate Party MPs. Anthony's position in the latter grouping is interesting, given his position on piracy. Stallman's position is similar to the Pirate MPs in certain respects, but values the legal status of copyleft.

What about Free Culture proponents?

What computer setups do Free Culture proponents use? Particularly, I'm wondering about Lawrence Lessig, founding father of the Free Culture movement (largely based on Stallman's Free Software Foundation) and founder of the Creative Commons licences. Nina Paley is another prominent Free Culture activist, but I'm pretty sure she's largely (solely?) a Mac user.

Hattrick winners and other random notes

Amelia Andersdotter, Donald Knuth, and Richard Stallman take hattrick prizes for Linux-Emacs-TeX use. (For an extra bonus, Andersdotter also explicitly mentions use of org-mode in Emacs.) 

Of course there are various connections between some of the characters mentioned above. For instance, Doctorow releases his novels under Lessig's Creative Common licences; Doctorow & Stross are co-writing a novel [1]; etc.

In terms of the general public, the actors are (unsurprisingly) probably the best known: I would guess Stephen Fry is the most famous person listed above.

Again, suggestions/additions welcome.

Tuesday, 19 June 2012

Emacs in the future: after the ice-caps melt

Emacs 24.1 is out. I haven't really tried it properly yet. All of the pre-release Emacs 24 snapshots I tried had severe memory-leak problems (at least with my set-up) and the quick try-out of 24.1 I did do revealed that it seems to be incompatible with twittering-mode. Since Emacs 23.3 is still working nicely for me, perhaps I'll wait a bit before trying 24.1 seriously.

Speaking of the future of Emacs, a great quote from sociologist Kieran Healy on The Setup ("usesthis.com") site:
Emacs ... will be there when the icecaps melt and the cities drown, when humanity destroys itself in fire and zombies, when the roaches finally achieve sentience, take over, and begin using computers themselves - at which point its various Ctrl-Meta key-chords will seem not merely satisfyingly ergonomic for the typical arthropod, but also direct evidence for the universe's Intelligent Design by some six-legged, multi-jointed God.

Monday, 23 April 2012

History as revealed by Google Ngrams, I: UNIX

UNIX was apparently really first discovered in the 18th century, about fifty years before the American War of Independence. However, it wasn't until the 20th century that it gained wide-spread use, when it was repopularised by AT&T.

Source: Google Ngram Viewer.

Tuesday, 7 June 2011

Emacs user at work

Despite being designed by a Vim user, and despite its implied criticism of Emacs, I still enjoyed this image:

















ashawley in the comments below points out the similarity with the 1981 cover of the EMACS Manual:



Saturday, 21 May 2011

rms on apple and brain scans


Some Apple addicts truly worship that company, suggest brain scans.
That must be why they allow it to abuse them so much and don't care.
I know a number of Apple fans, and they do tend to have strongly favourable attitudes towards Apple products. (Apple things generally seem to be superior to Microsoft things, but the Apple company doesn't seem any less evil than Microsoft, and Linux is generally superior to both anyway.)

But I question whether this is a reaction which is actually specific to Apple fans. I imagine my brain scans might show similar reactions to GNU/Linux and Emacs.... (Most Windows/Microsoft users probably wouldn't show similar results, given that it's really just the "default" nowadays.)

Wednesday, 6 April 2011

Emacs in Tron

JT Nimoy discusses the creation of software art for creating visual effects in the film Tron: Legacy. Additionally, he mentions that:
In Tron, the hacker was not supposed to be snooping around on a network; he was supposed to kill a process. So we went with posix kill and also had him pipe ps into grep. I also ended up using emacs eshell to make the terminal more l33t. The team was delighted to see my emacs performance -- splitting the editor into nested panes and running different modes. I was tickled that I got emacs into a block buster movie. I actually do use emacs irl, and although I do not subscribe to alt.religion.emacs, I think that's all incredibly relevant to the world of Tron.




Links:
(1) The original article/post by JT Nimoy
(2) On jwz's blog
(3) On boingboing
(4) On reddit

Tip: Showing blocked syntactic movement in LaTeX with tikz(-qtree)

Minimal example showing how to indicate blocked/illegal syntactic movement in LaTeX using the tikz and tikz-qtree packages.

\documentclass{article}
\usepackage{tikz}
\usepackage{tikz-qtree}
\begin{document}
\begin{tikzpicture}[baseline,description/.style={fill=white,inner sep=2pt}]
  \Tree [.A [.B \node(b){b}; ] [.C c [.D d [.E e [.F f [.G g [.H \node(h){h}; ]]]]]]]
  \draw [dashed, ->, bend left] (h) to node [description] {\LARGE $\times$} (b);
\end{tikzpicture}
\end{document}


Thanks to Andy Lücking and Alexis Dimitriadis from the Ling-TeX mailing list.

Saturday, 19 March 2011

Tip: let Synaptic handle updates to Buuf icon set

If you want the synaptic package manager to keep your Buuf icons up-to-date, you can do so by using the Ubuntu Satanic Edition repository, as follows:


1) add the secure key; in terminal enter:
wget -q http://ubuntusatanic.org/ubuntu-se-key.gpg -O- | sudo apt-key add -

2) add the following repository to your system (you could go to Go System->Administration->Software Sources->Other Software->Add and enter the following APT line:), choose the appropriate version (the following assumes you're using Ubuntu Maverick 10.10):
deb http://ubuntusatanic.org/hell maverick main

3) then in the terminal add the Buuf package by entering:
sudo apt-get update && sudo apt-get install buuf-icon-theme

Thursday, 3 February 2011

Tunes from an alternative Victorian era: Sunday Driver

Sunday Driver were formed in the summer of 2000, though lead singer Chandrika "Chandy" Nath had earlier composed some of the songs whilst monitoring ice floes near the South Pole, during a field trip in Antarctica, collecting data for the British Antarctic Survey.

Chandy has a Ph.D. (in physics, I think), and the band's name "Sunday Driver" derives from the moniker of a gene (SYD) commonly found in mice; and the music mixes Indian (Carnatic) and English folk music, along with early 20th century classical music (Ravel, Glass, etc.) and West End musicals, topped off with a (originally unintentional, I believe) steampunky twist.

Their first album, "In the City of Dreadful Night", is available here: www.sundaydriver.co.uk. From their own description: "...inspiration from Victorian London and Raj-era Calcutta, the tracks range from hypnotic to bittersweet."

In any case, here's...

A nice sampler:

A few interviews:

And a few promotion photos suitable for wallpaper:

Monday, 31 January 2011

The Indifference Engine - Victorianesque Hiphop

Prof Elemental : a steampunk mad professor with a fondness for adventure, strange animals and the pursuit of a good cuppa.  He has a new album out, the delightfully titled Indifference Engine.



Here's a taste:

Cup of Brown Joy:

Fighting Trousers (The beginning of a battle with Mr B?):

Tuesday, 25 January 2011

CPUs (+ALUs) in Minecraft

Some people have managed to create working CPUs (or ALUs) in Minecraft. They're slow and have little computing power or memory, but I still think it's an interesting case of recursion. Minecraft simulates a physical world, and these are computers created within the confines, and conforming to the rules of that world.

In any case, some links to information/videos about creating CPUs (and ALUs) in Minecraft follow.


An 8-bit CPU:


And a webpage about it: http://lazcraft.info/tagged/CPU

(This is the project with most information.)



A 16-bit CPU:


Here's the Youtube channel connected with this project: http://www.youtube.com/user/theinternetftw


A 32-bit ALU:



And, finally, it's not a computer, but a pretty cool implementation of Conway's Game of Life in Minecraft:

Conway's Game of Life in Minecraft:


Let me know about other CPUs/ALUs etc. in the comments.

Saturday, 22 January 2011

Clockworks: explanations and videos

Some interesting/educational videos on the workings of mechanical watches.

First, from 1949, a video produced by the Hamilton Watch Company:

Source: http://www.archive.org/details/HowaWatc1949

A simple demonstration of the basic design and operation of a watch. The inside "works" are shown in stop-motion animation using giant 7.5 foot, in-line movement, exact and to scale in every detail. [See the source for higher resolution versions.]

Second, a beautiful video showing some high resolution video shots of a mechanical pocket watch:

Source: http://theb-roll.com/day-186-time/

[See the source for a description.]

(More bits on clockworks here: http://blekko.com/ws/+/beslayed/clockworks .)

Thursday, 20 January 2011

2D Goggles, Or, The Thrilling Adventures of Lovelace & Babbage: a webcomic

Something which, for some reason, I only came across just now:

A webcomic consisting of the chronicles of Charles Babbage (the inventor of the first computer, which, alas, was never built---but it might be soon: see here!) and Ada Lovelace (the first computer programmer) in an alternative world where Ada Lovelace didn't die at age of 36, and where Babbage and Lovelace successfully developed the first computer (giving humanity the necessary technological advantage to repel the alien invasion of 1898) and went on to use their combined powers to fight crime and have thrilling adventures.

Here's a taste:

See more here.

Part of what I really like about this comic is its footnotes. Yes, it has footnotes, references to various primary (and secondary) sources relevant to the comic, like Babbage's autobiography.

Saturday, 15 January 2011

LaTeX table manipulation using Emacs/AUCTeX+align.el+rectangular selection

Tables in LaTeX are sometimes somewhat difficult to manage; in particular doing anything with columns---in contrast to most word processors, which allow for the manipulation of columns in certain environments (e.g. tables). However, the text editor Emacs in fact allows for rectangular selections anywhere, which means that using Emacs as an editor for (La)TeX files makes working with tables easier.

The AUCTeX package for Emacs adds a vast number of useful features; however, it does not automatically format tabular environments. Here I  offer some notes on how to deal with LaTeX tables in a Emacs/AUCTeX environment.

So let's say we have a LaTeX document containing a (big) table, like this:



















And let's say we want to switch the third and fourth columns. Easily done in a typical word processor, but not necessarily so for a LaTeX document. Let's look at the LaTex .tex source for this table:













A rectangular selection will work only if we have  our columns aligned in our source .tex file. The align.el package for Emacs is needed here (as of Emacs 22, this functionality is built in).

Place the cursor at the beginning of the tabular environment (in our current example, right below the first \hline command will work), and use the align-current function (press M-x and then type align-current RET):

 





[Make sure there are no blank lines in your tabular environment; "align-current" will stop when it hits a blank line.]

If you're working with a large table, as in this example, you still won't be able to see the entire width of the table, so hold down SHIFT and left-click the mouse and choose "Decrease Buffer Text Size" repeatedly until the entire width of the table is visible on your screen (maximizing the Emacs frame to the maximum width of your desktop will be helpful as well...). You should then  be able to view the table as so:















All of our columns are now aligned. Now we need simply to select a rectangular region. There are (at least) two ways of going about doing so. Firstly, the ability to select rectangular regions is a built-in feature of Emacs (see the relevant section of the Emacs manual). Simply select the columnar area (mark it using C-SPC) and press either C-x r r to copy the rectangular area to the register or C-x r k to cut ("kill") the rectangular area and place it in the register. And then use C-x r y to paste ("yank") the copied/cut rectangle into the position you want it (with the cursor in the position of its upper left-hand corner).

However, if your Emacs has the visible selection turned on (as is the default as of Emacs 23), then it is nicer and easier to be able to see the selected area as a rectangle. One nice option is to use the rectangular selection features of the CUA package (a built-in default as of Emacs 22). One of the main functions of the CUA-mode is to change Emacs' copy, kill/cut, and yank/paste keybindings (M-w, C-w, C-y) to the "common" C-c, C-x, C-v. If you, like me, don't want to change the default Emacs keybindings, then include the following in your .emacs configuration file:

(cua-selection-mode t)
(setq cua-auto-tabify-rectangles nil) 

[If you do want the "common" keybindings, then use (cua-mode t) in place of (cua-selection-mode t).]

With this configuration in place, we can now visibly select rectangular areas, and use the normal copy/kill/yank keybindings to copy, cut, and paste the rectangular selections. In CUA-mode rectangular selections are made using C-RET rather than C-SPC. Here is the rectangular selection in our example:











I then kill ("cut") this rectangular area with C-w. And then position the cursor at the point where I want the upper left-hand corner of this rectangular area to be inserted:











And then yank ("paste") the column in its new position with C-y:










That's it. Here is the resulting table (with columns 3 and 4 switched):





















Oh, and here is a nice video demonstration of the use of rectangular selection cut-and-pasting (with CUA-mode): Emacs Column Editing by Mark Mansour. It doesn't deal with LaTeX, but rather HTML; however, it illustrates the general use.