Showing posts with label emacs. Show all posts
Showing posts with label emacs. Show all posts

Tuesday, November 05, 2013

GNUBahnen

Anfang des Jahres habe ich eine kleines Emacs Lisp Programm geschrieben um Textbeschreibungen zu HVV-Routen zu generieren. Das Generieren einer Route funktioniert zwar einwandfrei, aber da der HVV keine API oder Daten zur verfügung stellt und das extrahieren der Daten aus der Website zu aufwending ist, läßt sich das System nicht nutzen. Das ist nicht so schlimm weil es eh nur ein Prototyp zum von Texten aus Routenbeschreibungen sein sollte.


Jetzt lese ich grad ein Paper von 1998 zum generieren von Wegbeschreibungen der U-Bahnen in Montreal und Paris. Beim überfliegen war mir schon aufgefallen das wahrscheinlich Lisp benutzt wurde, als die Autoren dann aber schreiben das sie ihr Programm in GNU Emacs Lisp geschrieben haben war ich doch etwas erstaunt und mußte feststellen das Ich doch nicht der einzige war der seinen Editor für solche Zwecke gebraucht.


Fraczak, Lapalme & Zocke: Automatic Generation Of Subway Directions: Salience Gradation As A Factor For Determining Message And Form

Tuesday, March 26, 2013

Growl for Emacs

There are several packages for Emacs which let you send notifications to Growl but afaik none which implements sending notifications over the wire, implementing GNTP (Growl Notification Protocol). Given that it's not very hard to implement I put together an implementation. It's not very complete, it has no encryption, lacks error handling, it just does what I need, register notifications with icons and sending them.

Sunday, March 17, 2013

org-mode

I have just fallen in love with this emacs mode. I'm already using it to bring a little bit more structure into my live. I use it to manage information on some websites, my finances, TODO lists at work. I even bought the printed org manual. At the moment I'm working on a small project for university, a mix of text and code. When writing papers etc. mixing code with text usually is problematic, it's too wide, formatting stinks, code is usually copied from file but and must be manually copied formatted etc. when you change it. With org-mode you simply include the source code in your org file along with all the text and when you're done you simply export it as a LaTeX file. All in one place and easy to navigate.


org-mode best mode

Wednesday, March 06, 2013

rcirc + growl + convos on windows

How to growl with rcirc to get notified about convos:
Being annoyed about missing a convo with rcirc, I decided to get emacs to play a sound when somebody says something in a convo. Playing a sound with emacs is easy (play-sound '(sound "c:/path/file.wav")). Then I remembered that's to oldschool, I need to use growl. So here's my setup:


Ingredients

  1. Growl for Windows
  2. todochiku
  3. some elisp code

First install growler. Then because it disables M-x while it runs, we'll edit the config file c:/Documents and Settings/<USERNAME>/Local Settings/Application Data/Growl/2.0.0.0/user.config. Look for Alt+X and replace it with a combo you won't need, like Alt+Z.


Then install todochiku and configure it, specifically change the todochiku-command to c:/Programm Files/Growl for Windows/growlnotify.exe or whereever you installed growl. If you want icons get it from EmacsWiki: To Do Chi Ku and customize the todochiku-icons-directory to wherever you unpacked the icons.
Congratulations, you can now growl from within Emacs with (growl "Emacs here" "growling is a go").

The last step is to add some more code to get notified about hidden convos. The code below does that and redefines the hook that already comes with todochiku to include the text that mentions your nick.


(defun growl-convo-rcirc-print-hook (process sender response target text)
  (when (and (string= sender target)
             (not (string= (rcirc-nick process) sender))
             (not (string= (rcirc-server-name process) sender))
             (not (memq (rcirc-get-buffer process target t)
                        (rcirc-visible-buffers))))
    (todochiku-message "IRC convo" (format "<%s> %s" sender text) 'social)))
(add-hook 'rcirc-print-hooks 'growl-convo-rcirc-print-hook)

(defun growl-rcirc-print-hook (process sender response target text)
  (when (and (rcirc-channel-p target)
             (string-match (rcirc-nick process) text)
             (not (string= (rcirc-nick process) sender))
             (not (string= (rcirc-server-name process) sender)))
    (todochiku-message (format "IRC mention" target)
        (format "%s <%s> %s" target sender text)
        'social)))

Friday, February 24, 2012

PHP Class Browser II

 So I checked out cedet and while the package seems good it's PHP support sucks, as in out of the box you get almost none, to get some you have to use either etags instead of the standard tags that comes with emacs or you have to use something from the contrib directory which is unmaintained. Not wanting to deal with etags I'm opting for updating the parser in the contrib directory. Using that a parser could be really interesting, as it means Emacs could know a lot more about the code and with some uh effort one could even have a very much up to date parser by using the grammar from the PHP code (Zend/something.y). Problem: It's a lot of effort for me and not a lot of help/interest from the community it seems.
But if I can pull it off, it would help creating refactoring, style, common error (using uninitialised variables) tools.

Sunday, February 19, 2012

PHP Class Browser

Idea for emacs:
I want to be able to M-x something on a method call and get a new buffer showing all the implementations of that method and from there browse the methods of the class they belong to. And while we're at it a browseable class tree.
I haven't used cedet yet, but as it comes with emacs24 and is supposed to handle C++ it might already have such a thing but probably needs a "PHP parser"

Thursday, March 25, 2010

githubbed

I githubbed the code from the previous post. It's now at http://github.com/tekai/tools. Also php-run-string has been fixed.

Tuesday, March 16, 2010

emacs/php code

Some interesting functions if you happen to write PHP code in emacs:

php-mode.el with some modifications:

;; - php-check-syntax-and-goto-line bound to F12
;; - changed the find-tag-default function to differentiate between
;;   methods and functions BUT this means you need to use tag-fucker.php
;;   instead of etags/ctags/whatever

tag-fucker.php (rename it to use it). A CLI script which generates TAGS/etags stuff used in my php-mode. Much slower than etags but maybe it can by compiled by HipHop.

php.el Some extra php related elisp code. Them gem of it is update-tag-file which does what it says on saving a file ((php-)after-save-hook)

Those files need a bit of shell & elisp knowledge if you want to use them. Go and hack away. If you like/use/modified it pls leave a comment.

Ideapad: incremental tags

  • Add a hook to save buffer
  • run script to remove file from TAGS
  • run tag-fker to add stuff from buffer
  • run some tags function in emacs to make adopt changes in TAGS

Update: check out https://github.com/tekai/tools/blob/master/php.el#L45 for an implementation