emacs.js.third.p.art

July 16th, 2013

See Also: part 1, part 2

 

An attempted install on my home system went much more smoothly, all modules appeared to be present. I ran into one remaining issue that I had encountered previously, and so I’ve opened a ticket.

 

I also discovered the Emacs Guide — which bills itself as an Emacs guide written for JavaScript coders. It’ll cover installation, basic text editing to taking advantage of powerful extensions made for NodeJS and JavaScript. However, it’s primarily a guide to emacs.js, and is currently incomplete (“Creating Modules”, “Creating HTML Files”, “Debugging” and “See Also” are empty sections, while “Creating Projects” exists only as a keybinding note).

 

Still, I’ve got some other issues with it.

 

By default, the code wants all of the files in the HOME directory. I don’t put my files they’re — they’re going into Dropbox, and shared across a couple of installs.

It’s not difficult to update the code for this — but if that file is updated in the project, my updates go out the window.

I think the project should support something different, but I haven’t written a replacement for it.

 

A minor issue is relative line-numbers. I’m sure somebody likes them. I find them distracting.

 

But most importantly, basic keystrokes are remapped. That the arrow-keys are mapped to other functions is perhaps forgiveable — Emacs already has line-up, line-down, prevchar, next-char mapped to certain keys. Which I never use. Because it’s stupid to use those keystrokes on a modern keyboard that has arrow keys. But, hey. I can almost follow along. Emacs-stylee, right? Although how following an obscure Emacs convention for a library that is pitched at non-Emacs-users who want a Javascript IDE is a bit perplexing.

 

Unforgiveable, however, is the remapping of keystrokes like kill-region. That’s a basic Emacs keybinding, and shouldn’t be screwed around with. WTF?

 

emacs.js has the ability too use customized profiles, but these seem to be loaded AFTER things have already been loaded, so the keybindings might be unfixable by simple means. Or maybe it is an easy fix — I haven’t really looked into the customization yet.

 

I want to use emacs.js — it’s got a lot of javascript-editing packages included that I’m interested in.

But the setup, lack of complete documentation, and bizarre keybindings is slowing me down.

It’s an open-source project, and I can work to minimize those problems.

I’ve opened one ticket already; these notes are part of my own further process.

 

journaling.art

July 7th, 2013

I use Emacs, and one of the key roles I use Emacs for is journaling — keeping a log of what I do, as regards to work (I could do a better job of personal journaling, but I wouldn’t need or use Emacs for that, I’d probably put that in a paper-based journal). For computer work — whether it’s day-job related, freelance-related, or personal-project related, tracking what I did and when can be invaluable when I try to recreate a setup or recall what I was doing last month when project X started working/failing.

 

For years I used a simple journal, original built by someone else, that I had enhanced. It’s up at github, but I’ve recently (April/May 2013) started using org-mode and I am happier (sorry, old-journal-code!).

 

The below extract is taken from my org-init.el file, and needs some tweaking. They were inspired by Journaling with Emacs OrgMode. There is still some reliance on global-functions (aren’t they all, in Emacs-lisp?) from my old journal-mode, but they do the job of opening a new file where I need it. Then org-mode does all the rest.

(global-set-key "\C-c\M-jw" 'org-journal-work)
(global-set-key "\C-c\M-jp" 'org-journal-personal)
(global-set-key "\C-c\M-jf" 'org-journal-freelance)
(defun org-journal-work ()
  "Send work-based directory to org-journal for day-job journaling."
  (interactive)
  (org-journal "D:/home/Personal/org-journal-work/" "work"))
 
(defun org-journal-personal ()
  "Send dropbox-based directory to org-journal for personal journaling."
  (interactive)
  (org-journal "D:/Dropbox/Emacs/org/org-journal-personal/" "personal"))
 
 
(defun org-journal-freelance ()
  "Send dropbox-based directory to org-journal for freelance journaling."
  (interactive)
  (org-journal "D:/Dropbox/Emacs/org/org-journal-freelance/" "freelance"))
 
(defun org-journal (&optional root suffix)
  "Open .org file named after today's date, format YYYY-MM-DD-Day.jnl,
in subdirectory named in variable root, set in ~/.emacs,
else as defined below.
"
  (interactive)
  (progn
    (setq root (or root "D:/Dropbox/Emacs/org-journal/"))
    (setq default-directory (year-month-dir root))
    (setq todays-date (format-time-string "%Y-%m-%d-%a" nil))
    (let ((sfx (if suffix (concat "." suffix) "")))
    (setq filename (concat todays-date sfx ".org")))
 
    (list (read-file-name
"Open journal-org file: " default-directory filename nil filename)))
 
  (find-file filename) ;; switch to buffer if exists, or open file
 
  ;; following lines based on http://metajack.im/2009/01/01/journaling-with-emacs-orgmode/
  (widen)
  ;; heading is not working correctly if it is the result of (today)
  (let ((isearch-forward t) (heading (get-today)))
        (beginning-of-buffer)
        (unless (org-goto-local-search-headings heading nil t)
          ((lambda ()
             (org-insert-heading)
             (insert heading)
             (insert "\n\n"))))
        (end-of-buffer)
        ;; (org-show-entry)
        (widen)
        ;; (org-narrow-to-subtree)
        ;; (end-of-buffer)
        ;; (backward-char 2)
        ;; (unless (= (current-column) 2)
        ;; (insert "\n\n "))
))

doing.art

May 30th, 2013

I’ve been working on a boostrap-theme/skin for PmWiki.

 

It’s beginning to take shape, but there’s a long way to go to make it a “real theme.” (I should note that it was extracted from a ready-to-install PmWiki “kit” with bootstrap in it; I’ve made it standalone, and am enhancing the feature-set and building documentation.).

 

I’ve been learning how to use git, GitHub, (guthub-flavored) markdown, more work with Bootstrap, deep-diving back into PmWiki development, playing with Emacs’ org-mode for journaling, and using Trello for planning.

 

PHP is annoying the !@#!@# out of me, as is GitHub’s wise advice to use relative links in a README.md, but making it impossible to use relative links to files in the wiki.

 

I’m hitting a bunch of tasks on my TODO list.

 

pmwiki.bootstrap.darkstrap.00

emacs.js.second.p.art

May 17th, 2013

See Part One

 

I tried to run init.el from within my existing emacs, but got an error, so I launched it suppressing my config-files

emacs -q -l d:homeemacs.jsinit.el

 

Basically got the following error (although with a longer trace indicating where it had occured):

Debugger entered--Lisp error: (invalid-function (tool-bar-mode -1))
  ((tool-bar-mode -1) (menu-bar-mode -1) (scroll-bar-mode -1))
  (if window-system ((tool-bar-mode -1) (menu-bar-mode -1) (scroll-bar-mode -1)))
  eval((if window-system ((tool-bar-mode -1) (menu-bar-mode -1) (scroll-bar-mode -1))))
  eval-last-sexp-1(nil)
  eval-last-sexp(nil)
  call-interactively(eval-last-sexp nil nil)

 

The root seems to be THIS snippet that doesn’t like to work from appearance.el

 

(if window-system
    ((tool-bar-mode -1)
     (menu-bar-mode -1)
     (scroll-bar-mode -1)))

 

Now, each of those lines can execute individually, but none of them like to execute in that block.

Why is that?

 

Oh, my elisp-fu is woefully faded.

 

hrm. THIS seems to work:

 

(if window-system
    (progn (tool-bar-mode -1)
           (menu-bar-mode -1)
           (scroll-bar-mode -1)))

 

so. I update that.

 

Now,

set-default-font: Font Inconsolata-12′ is not defined

 

jeebus.

 


 

End Part Two

 

read Part One

emacs.js.art

May 17th, 2013

I’m still trying to figure out how I should be using my wiki and my blog – what content goes where?

I’ve been putting a lot more this-is-what-I-did notes into the wiki, and cleaning them up as I redo it/find other/better ways.

I’m going to try putting them HERE in the blog first (in pmwiki-markup), and then clean them up a bit for the wiki.

 

That’s the idea, anyway….

 

This is Part One; read Part Two

 


 

So, I decided to test-install emacs.js

 

NOTE: the installation instructions presume Linux. Because: 1337. Because: Us windows users suck.

Or something like that.

 

NOTE: the notes below are pretty much unedited transcripts of my attempts to get this to work. They are more a reflection on my unfamiliarity with cygwin than they are of the lack of Windows installation docs. Although making this into an ELPA package would solve this problem in one fell swoop.

read more…

rhymers-gonna-rhyme.art

May 31st, 2012

I figured a (semi-manual) way to get emacs to sort some lines by rhymes:

Show Original

haters gonna hate
gaters gonna gate
laters gonna late
maters gonna mate
skaters gonna skate
baiters gonna bait
plaiters gonna plait
straiters gonna strait
waiters gonna wait
straighters gonna straight
eighters gonna eight
craters gonna crate
stators gonna state
graters gonna grate
raters gonna rate
freighters gonna freight
gaiters gonna gait
gators gonna gate
greaters gonna great
praters gonna prate
straighters gonna straight
traitors gonna trait
vapers gonna vape
bakers gonna bake
shakers gonna shake
drapers gonna drape
rakers gonna rake
scrapers gonna scrape
quakers gonna quake

Show Sorted

bakers gonna bake
shakers gonna shake
rakers gonna rake
quakers gonna quake
scrapers gonna scrape
drapers gonna drape
vapers gonna vape
gaters gonna gate
gators gonna gate
haters gonna hate
skaters gonna skate
laters gonna late
maters gonna mate
raters gonna rate
craters gonna crate
graters gonna grate
praters gonna prate
stators gonna state
greaters gonna great
straighters gonna straight
straighters gonna straight
eighters gonna eight
freighters gonna freight
baiters gonna bait
gaiters gonna gait
plaiters gonna plait
traitors gonna trait
straiters gonna strait
waiters gonna wait

(setq words "haters gonna hate....")
(apply 'string (reverse (string-to-list words)))
delete quotes
select region
M-x sort-lines
add quotes
setq words
(apply 'string (reverse (string-to-list words)))

I’m sure this could be completely automated.

Also, for personal reasons, I’m not satisfied with the order obtained — but it’s a great start, and a quick restructuring that helped clear my head on this text.

emacs.art

May 30th, 2012

I’ve been using Emacs as my editor since… I dunno, 5, 6 years now?

Steve Yegge’s js2-mode was an excellent answer for JavaScript coding, but there were a few issues that drove me nuts. Whatever — the benefits outweighed the disadvantages.

Scroll forward to 2012, and I’m refactoring a large codebase, and trying to indent it properly, and Emacs goes nuts. I have to task-kill it several times, until I eventually narrow down the issue to js2-mode trying to indent certain regexes. Aaargh! (And I eventually figured out that I could interrupt the task without killing Emacs, it was just slow to respond….).

Over to google, and I find others with the exact problem, and a solution: Mihai Bazon has a committed patch that isn’t in the release of js2-mode, and some helper functions, as well. Hooray!

  • syndicate

    • Add to MyMSN
    • Add to MyYahoo
    • Add to Google Reader
    • Add to Bloglines
    • Add to Newsgator
    • Add to NewsIsFree