tag:blogger.com,1999:blog-68625082024-03-28T08:25:44.367+01:00Alex Ott's blogBlog dedicated to Software Development, Unixes, Content Filtering, Emacs, Lisp, and other things.Alex Otthttp://www.blogger.com/profile/13001951608173211050noreply@blogger.comBlogger65125tag:blogger.com,1999:blog-6862508.post-31318936914039096742012-10-30T19:19:00.003+01:002019-12-26T15:06:49.354+01:00New version of article about Emacs/CEDETI just uploaded to site the new version of my article <a href="http://alexott.net/en/writings/emacs-devenv/EmacsCedet.html">A Gentle introduction to CEDET</a>. I also left <a href="http://alexott.net/en/writings/emacs-devenv/EmacsCedetOld.html">old version of this article</a>, but as separate page.<br />
New version describes CEDET with new activation scheme, so it's now applicable to versions from bzr, and to versions bundled with GNU Emacs (after they will release next GNU Emacs version, where CEDET was updated).<br />
Besides this, I added small description of how to customize CEDET to work with Java, and small section about setting name completion through the auto-complete package.<br />
<br />
Instead of my config file, that contains too much not necessary stuff, now it's better to use <a href="https://gist.github.com/3930120">separate config</a>.<br />
<br />
P.S. btw, fresh snapshots of CEDET can automatically detect Maven projects, and get classpath information directly from them. So now, names completion works also for 3rd party libraries. For example, this is name completion during work with source code from Apache Tika:<br />
<table style="width: auto;"><tbody>
<tr><td><a href="https://photos.app.goo.gl/AxPesXs8CaraqdXY9"><img height="268" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6YVZWq1ocjQOUmWnXQ2bOKep8Nvscu6E3cKc5J7DslBtm_qjLMJZQgVnLpkm6qAXQi0AdGIrVq0KnkhIWJ_0vQdlwS9RBqzm5SqxHh6I9fZiXNZ3qdM2G_lXJBtwHpbiPrrTu/s400/OutlookExtractor.java_002.png" width="400" /></a></td></tr>
</tbody></table>
Alex Otthttp://www.blogger.com/profile/13001951608173211050noreply@blogger.com3tag:blogger.com,1999:blog-6862508.post-70776067506408192572012-06-17T15:18:00.000+02:002015-01-18T18:57:35.734+01:00ECB & fresh Emacs/CEDET...Update (18th January 2015): the ECB now has new home: https://github.com/ecb-home/ecb <br />
<br />
I already twitted about this, and also wrote to ECB & CEDET mailing lists, but I also want to reach Planet Emacs readers :-)<br />
I made small changes in the ECB code that allow to use it together with fresh Emacs & CEDET versions. Modified code is available in <a href="https://github.com/alexott/ecb/">my github</a>. I tried this version together with CEDET from trunk, and also with CEDET from Emacs 24.1, and it worked for me.<br />
If you're using ECB, please try this modified version, and leave feedback (either here, or by sending e-mail to me or to ECB mailing list). If you'll find bugs, feel free to file a bug using github's issue tracker.Alex Otthttp://www.blogger.com/profile/13001951608173211050noreply@blogger.com31tag:blogger.com,1999:blog-6862508.post-45603878047098153572011-02-01T21:39:00.000+01:002011-02-01T21:39:47.432+01:00Additions to haskell-modeBetween Christmas and New Year I had some time to hack haskell-mode (this was planned for a long time) - I added support for <a href="http://community.haskell.org/%7Endm/hlint/">hlint</a> (the <b style="font-family: "Courier New",Courier,monospace;">hs-lint</b> command) and <a href="http://projects.haskell.org/style-scanner/">haskell style scanner</a> (the <b><span style="font-family: "Courier New",Courier,monospace;">hs-scan</span></b> command). As <a href="http://alexott.blogspot.com/2009/02/second-version-of-hs-lint-package.html">before</a>, hs-lint supports replacement of code with suggestions.<br />
Patches were sent to maintainer, but they not committed into main repository yet. But in the meantime you can use <a href="https://patch-tag.com/r/alexott/haskell-mode/home">my fork</a>. Please, send me comments and suggestions on these changes...Alex Otthttp://www.blogger.com/profile/13001951608173211050noreply@blogger.com0tag:blogger.com,1999:blog-6862508.post-8279845930131379202010-08-30T09:17:00.000+02:002010-08-30T09:17:19.413+02:00Release of CEDET 1.0!After many years of development, numerous 1.0preX versions, version 1.0 of CEDET package was released.<br />
This version differs from previous version - 1.0pre7, and contains many changes in Semantic, EDE, and other subsystems. Full list of changes you can find in <a href="http://sourceforge.net/mailarchive/message.php?msg_name=4C7AF54C.9030905%40siege-engine.com">official announcement</a>.<br />
Source code you <a href="http://sourceforge.net/projects/cedet/files/cedet/cedet-1.0.tar.gz/download">can download</a> from project's page and compile it <a href="http://alexott.net/en/writings/emacs-devenv/EmacsCedet.html">according to instructions</a>.<br />
And after release 1.0, development team continue to work on further integration of package into GNU Emacs, development of new parsers and other stuff, that will allow to improve work with different languages and build tools.Alex Otthttp://www.blogger.com/profile/13001951608173211050noreply@blogger.com11tag:blogger.com,1999:blog-6862508.post-24016156388812075552010-05-08T10:33:00.000+02:002010-05-08T10:33:20.549+02:00GNU Emacs 23.2 released!The new stable version of GNU Emacs - 23.2 <a href="http://permalink.gmane.org/gmane.emacs.announce/17">was released</a>. It contains mostly bug fixes, but also has some big changes - the new mode for JavaScript editing was added. And Emacs now includes CEDET, so users will have less problems with installing it (although, I think, that version from CVS is better ;-)Alex Otthttp://www.blogger.com/profile/13001951608173211050noreply@blogger.com0tag:blogger.com,1999:blog-6862508.post-45663515787828407062010-02-26T09:51:00.000+01:002010-02-26T09:51:26.106+01:00New version of CEDET released!Eric M. Ludlam - author of CEDET, had announced the new relese of CEDET - 1.0pre7. In this release are included many changes, made during last year, including changes in build procedure, in C++ parsing, integration with different external tools, etc. Here you can find <a href="http://sourceforge.net/mailarchive/forum.php?thread_name=4B8745DC.4000508%40siege-engine.com&forum_name=cedet-devel">official announce</a>.<br />
P.S. This version isn't compatible with CEDET from development version of EmacsAlex Otthttp://www.blogger.com/profile/13001951608173211050noreply@blogger.com2tag:blogger.com,1999:blog-6862508.post-41401075931802835782009-05-25T11:42:00.000+02:002009-05-25T11:43:08.973+02:00Muse + bibtex -> HTML outputI slightly hacked Muse to add support for bibliography generation in HTML output. First (very naive, but working) version is available from <a href="http://github.com/alexott/muse/tree/master">my repository at github</a>Alex Otthttp://www.blogger.com/profile/13001951608173211050noreply@blogger.com0tag:blogger.com,1999:blog-6862508.post-2674880727584615492009-05-16T21:17:00.002+02:002009-05-16T21:24:01.115+02:00New version of ECB packageAfter 4 years of development, the new versions of <a href="http://ecb.sourceforge.net/">ECB package</a> was released. There are <a href="http://ecb.sourceforge.net/NEWS.html">lot of changes</a>, now ECB requires fresh version of Cedet package, as it uses many new features of it, including support for EDE projects.Alex Otthttp://www.blogger.com/profile/13001951608173211050noreply@blogger.com2tag:blogger.com,1999:blog-6862508.post-88074060796257800642009-03-21T10:49:00.003+01:002009-03-21T11:02:27.434+01:00GNU Emacs 23, Mac OS X and fontsAfter several weeks, had rebuilt theл GNU Emacs from CVS and start to work with it under Mac OS X. In latest builds, use of anti-aliased fonts is disable by default, so text looks very bad :-( In mailing list i got a hint about the <span style="font-family: courier new;">ns-antialias-text</span> variable (not available via <span style="font-family: courier new;">customize</span>), that should be set to non-nil value, and than anti-aliased fonts will enabled, like in Carbon Emacs.Alex Otthttp://www.blogger.com/profile/13001951608173211050noreply@blogger.com1tag:blogger.com,1999:blog-6862508.post-4046873423986920802009-03-06T09:55:00.002+01:002009-03-06T10:01:57.701+01:00Small addition to sh-modeBelow is piece of code, that could be useful for all, who write shell scripts in Emacs. It provides <span style="font-family: courier new;">sh-check-syntax</span> function, that performs syntax checking (currently only for sh/bash/zsh) and navigation between errors, if they found. It's better to bind this function to some key (i use <span style="font-family: courier new;">C-c l</span>)<br /><pre>(defun sh-check-finish-hook (buf msg)<br /> <span style="color: rgb(102, 102, 102);">"Function, that is executed at the end of sh check"</span><br /> (<span style="color: rgb(160, 32, 240);">when</span> (not (string-match <span style="color: rgb(0, 139, 0);">"finished"</span> msg))<br /> (next-error 1 t)))<br /><br />(define-compilation-mode sh-check-mode <span style="color: rgb(0, 139, 0);">"SH"</span><br /> <span style="color: rgb(102, 102, 102);">"Mode for check sh source code."</span><br /> (set (make-local-variable 'compilation-disable-input) t)<br /> (set (make-local-variable 'compilation-scroll-output) nil)<br /> (set (make-local-variable 'compilation-finish-functions)<br /> (list 'sh-check-finish-hook))<br /> )<br /><br />(defun sh-check-syntax ()<br /> <span style="color: rgb(102, 102, 102);">"Check syntax of current file"</span><br /> (interactive)<br /> (<span style="color: rgb(160, 32, 240);">when</span> (string-match <span style="color: rgb(0, 139, 0);">"^</span><span style="color: rgb(0, 139, 0); font-weight: bold;">\\</span><span style="color: rgb(0, 139, 0); font-weight: bold;">(</span><span style="color: rgb(0, 139, 0);">ba</span><span style="color: rgb(0, 139, 0); font-weight: bold;">\\</span><span style="color: rgb(0, 139, 0); font-weight: bold;">|</span><span style="color: rgb(0, 139, 0);">z</span><span style="color: rgb(0, 139, 0); font-weight: bold;">\\</span><span style="color: rgb(0, 139, 0); font-weight: bold;">)</span><span style="color: rgb(0, 139, 0);">sh"</span> (symbol-name sh-shell))<br /> (save-some-buffers t)<br /> (compilation-start (concat (symbol-name sh-shell) <span style="color: rgb(0, 139, 0);">" -n "</span> (buffer-file-name))<br /> 'sh-check-mode))<br /> )<br /></pre>Alex Otthttp://www.blogger.com/profile/13001951608173211050noreply@blogger.com1tag:blogger.com,1999:blog-6862508.post-50283862469322564212009-03-01T10:56:00.002+01:002009-03-01T11:30:15.975+01:00New Cedet pre-releaseAfter almost two years since previous pre-release, Eric M. Ludlam <a href="https://sourceforge.net/mailarchive/forum.php?thread_name=200903010339.n213dS6Q025283%40projectile.siege-engine.com&forum_name=cedet-devel">released</a> today a new pre-release version of Cedet - <a href="http://sourceforge.net/project/showfiles.php?group_id=17886&package_id=98769">1.0pre6</a>. This version includes numerous additions of new features, and fixes.Alex Otthttp://www.blogger.com/profile/13001951608173211050noreply@blogger.com4tag:blogger.com,1999:blog-6862508.post-81549722272379372122009-02-17T11:34:00.003+01:002009-02-17T11:38:21.938+01:00Emacs + Haskell + Pretty lambdaDo you know, that if you set the <span style="font-family:courier new;">haskell-font-lock-symbols</span> variable to <span style="font-family:courier new;">t</span>, in the <span style="font-style: italic;">haskell-mode</span> hook, then your source code will look as on following picture:<br /><a href="http://xtalk.msk.su/~ott/common/writings/emacs-devenv/haskell-pretty-font-lock.png"><img src="http://img-fotki.yandex.ru/get/3314/ottalex.5/0_23992_5fbf7afb_L.jpg" title="haskell-pretty-font-lock" alt="haskell-pretty-font-lock" border="0" height="399" width="500" /></a><br />P.S. some symbols aren't included into standard package, but patch is already sent to author of <span style="font-style: italic;">haskell-mode</span>...Alex Otthttp://www.blogger.com/profile/13001951608173211050noreply@blogger.com9tag:blogger.com,1999:blog-6862508.post-39531682017184377602009-02-13T14:46:00.010+01:002012-10-29T13:00:12.667+01:00Cedet + QtOn one of the Russian forums I was asked "Why Cedet doesn't work with Qt?" Answer is very simple - it works, but you need to make simple customization. Add following code into your initialization file, and Cedet begin to parse your code:<br />
<pre style="background-color: #ebebeb; color: black;">(add-to-list 'auto-mode-alist
'(<span style="color: #008b00;">"/usr/include/qt4"</span> . c++-mode))
(semantic-add-system-include <span style="color: #008b00;">
"/usr/include/qt4"</span> 'c++-mode)
(add-to-list 'semantic-lex-c-preprocessor-symbol-file
<span style="color: #008b00;">"/usr/include/qt4/Qt/qconfig.h"</span>)
(add-to-list 'semantic-lex-c-preprocessor-symbol-file
<span style="color: #008b00;">"/usr/include/qt4/Qt/qconfig-dist.h"</span>)</pre>
Here is proof:<br />
<a href="http://xtalk.msk.su/%7Eott/common/writings/emacs-devenv/cedet-qt-name-completion.png"><img alt="Emacs + Cedet + Qt" border="0" height="429" src="http://img-fotki.yandex.ru/get/3311/ottalex.5/0_236d6_8199799b_L.jpg" title="Emacs + Cedet + Qt" width="500" /></a><br />
Thanks to Eric M. Ludlam for hint about <span style="font-family: courier new;">semantic-lex-c-preprocessor-symbol-file</span> variable.<br />
<span style="font-style: italic;">Update (12/05/2009)</span>: It seems, that this approach will not work in fresh CEDET - I'm working on fixAlex Otthttp://www.blogger.com/profile/13001951608173211050noreply@blogger.com4tag:blogger.com,1999:blog-6862508.post-15623280255317677102009-02-13T14:07:00.003+01:002010-01-21T10:32:08.199+01:00Small article about CedetI wrote small article, called "<a href="http://alexott.net/en/writings/emacs-devenv/EmacsCedet.html">A Gentle introduction to Cedet</a>" about how to install & use the Cedet package. I hope, that this article will help Emacs users to get information about this wonderful package.<br />
You can write comments and suggestions about article in comment widget at the end of page (JavaScript should be enabled).<br />
P.S. i know that there are grammatical errors in my article, please write your comments at the end of the page, or via mail/jabber directly to me.Alex Otthttp://www.blogger.com/profile/13001951608173211050noreply@blogger.com1tag:blogger.com,1999:blog-6862508.post-50012414444463759392009-02-08T14:07:00.003+01:002010-01-21T10:32:19.091+01:00Second version of the hs-lint packageJust updated hs-lint, so it now allows to perform replacements of user's code with hints, produced by HLint. To use this feature, you need to set <span style="font-family: courier new; font-weight: bold;">hs-lint-replace-with-suggestions</span> variable to <span style="font-family: courier new; font-weight: bold;">t</span>, and than after execution of the <span style="font-family: courier new;">hs-lint</span> command you'll asked for confirm replacement each of hint, found by HLint. And if you'll set the <span style="font-family: courier new; font-weight: bold;">hs-lint-replace-without-ask</span> variable to <span style="font-family: courier new; font-weight: bold;">t</span>, then all replacement will be done without confirmation.<br />
New version is available from <a href="http://alexott.net/common/emacs/hs-lint.el">my site</a>.Alex Otthttp://www.blogger.com/profile/13001951608173211050noreply@blogger.com2tag:blogger.com,1999:blog-6862508.post-68425634076004237842009-02-07T17:17:00.002+01:002009-02-07T17:21:34.218+01:00cedet + boost::shared_ptrEric Ludlam committed to CVS changes, that fix errors in names completion for objects, wrapped into boost::shared_ptr. Now all works fine, and I able to use Emacs more effectively, when I work with foreign code (usually for my code, i remember all functions ;-)<br />For other smart pointers this feature already existed, the problem was only in parsing of shared_ptr's definition.<br />P.S. I started to translate to English my introduction level article about Emacs & Cedet usage for work with C & C++ code...Alex Otthttp://www.blogger.com/profile/13001951608173211050noreply@blogger.com6tag:blogger.com,1999:blog-6862508.post-52674045133761900702009-01-11T15:29:00.005+01:002010-01-21T10:32:31.650+01:00Running HLint from EmacsI wrote <a href="http://alexott.net/common/emacs/hs-lint.el">small module</a> for more comfortable work with <a href="http://www-users.cs.york.ac.uk/%7Endm/hlint/">HLint</a> from Emacs. It has same functionality as compilation-mode - navigation between errors, etc.<br />
To use it, just add following code to emacs init file:<br />
<span style="font-family: courier new;">(require 'hs-lint)</span><br />
<span style="font-family: courier new;">(defun my-haskell-mode-hook ()</span><br />
<span style="font-family: courier new;"> (local-set-key "\C-cl" 'hs-lint))</span><br />
<span style="font-family: courier new;">(add-hook 'haskell-mode-hook 'my-haskell-mode-hook)</span><br />
and after this, you'll be able to run <span style="font-family: courier new;">hs-lint</span> command with <span style="font-family: courier new;">C-c l</span> key binding when you open your filw with Haskell source codeAlex Otthttp://www.blogger.com/profile/13001951608173211050noreply@blogger.com1tag:blogger.com,1999:blog-6862508.post-17086270717488089762009-01-08T10:01:00.003+01:002010-01-21T10:32:50.992+01:00Small blorg.el hackingSlightly hacked the blorg.el package, that I use to generate blog on my site (it is used mostly for article announcements, etc). Following changes were made:<br />
<ul><li>Proper generation of links to files, without explicit specification of the <span style="font-family: courier new;">file:// <span style="font-family: georgia;">scheme</span><br />
</span></li>
<li>Copying of files into blorg directories was removed - i don't want to copy files, that are already on my site<br />
</li>
<li>Proper escaping of the <, >, &, ", was implemented (although may be not in all places - please let me know, if you'll find, that text is generated improperly)<br />
</li>
</ul>Another thing that I want to make is generation of the file names for notes with non-latin symbols in titles. After this change, package will almost ready to use. For my site I also need to align HTML template to match design of the my site, and make proper generation of links for <a href="http://js-kit.com/comments/">JS-Kit Comment Widget</a>.Alex Otthttp://www.blogger.com/profile/13001951608173211050noreply@blogger.com0tag:blogger.com,1999:blog-6862508.post-86800753207294012972009-01-04T16:48:00.001+01:002009-01-04T16:51:32.330+01:00Article about working with Scheme from EmacsJust uploaded to my site <a href="http://xtalk.msk.su/%7Eott/en/writings/emacs-devenv/EmacsScheme.html">a second part</a> of article about Emacs as development environment. This part is dedicated to work with Scheme programming language and describes many packages - from well-known cmuscheme & quack, to GCA, GDS & bmacs, and some other...<br />You can leave comments directly on my site, so i can improve this article ;-)Alex Otthttp://www.blogger.com/profile/13001951608173211050noreply@blogger.com0tag:blogger.com,1999:blog-6862508.post-69087365302840123262008-12-18T09:45:00.002+01:002008-12-18T09:50:54.737+01:00Switched from Aquamacs to CarbonEMacsAt home computer I switched from Aquamacs to fresh build of CarbonEmacs. Main reason - Aquamacs has too many additional packages that conflicts with packages, that i have in my own repository of Emacs code (my packages either additionaly hacked, either this is versions from CVS/SVN/...).<br />I also tried to switch to fresh build of GNU Emacs, built was successful, but it crashed almost immediately after start, so i decided to wait some time, but I'll try to investigate problem in my free timeAlex Otthttp://www.blogger.com/profile/13001951608173211050noreply@blogger.com3tag:blogger.com,1999:blog-6862508.post-87028126147862398222008-12-15T09:11:00.003+01:002008-12-15T09:16:02.230+01:00Work with Erlang from EmacsI upload to my site new article about <a href="http://xtalk.msk.su/%7Eott/en/writings/emacs-devenv/EmacsErlang.html">work with Erlang from Emacs</a>, previously available only in Russian. This article describe different packages providing not only editing of source code written in Erlang, but also providing support for debugging, profiling, on fly code checking, etc. You can leave comments directly on my site, using link at the bottom of page...<br />This article is a part of planned big article (and may be part of a book) about "Emacs as development environment", but work is still in early stages.<br />P.S. the next translated article will about support for Scheme programming in EmacsAlex Otthttp://www.blogger.com/profile/13001951608173211050noreply@blogger.com0tag:blogger.com,1999:blog-6862508.post-36894720573959295962008-12-11T14:00:00.002+01:002008-12-11T14:03:56.455+01:00One more time about CedetIn latest versions of Cedet support of GNU Global was introduced, and very useful command - <span style="font-family:courier new;">semantic-symref</span>, was implemented. It allows to find places in source code (for C & C++ now) where given function is used. And if GTAGS database wasn't found, then this command tries to find occurrences with <span style="font-family:courier new;">find-grep</span> command.<br />As result, user gets something like this...<br /><a o href="http://xtalk.msk.su/%7Eott/common/writings/emacs-devenv/cedet-symref.png"><img width="500" src="http://xtalk.msk.su/%7Eott/common/writings/emacs-devenv/cedet-symref.png" alt="" border="0" /></a>Alex Otthttp://www.blogger.com/profile/13001951608173211050noreply@blogger.com2tag:blogger.com,1999:blog-6862508.post-75006508363971064592008-11-19T16:33:00.003+01:002010-01-21T10:33:24.433+01:00Updates to the article about Emacs & GitI updated the <a href="http://alexott.net/en/writings/emacs-vcs/EmacsGit.html">article about Emacs & Git</a> with description of the magit, git-emacs, and some auxiliary packages - gitsum, egit & git-blame.<br />
The comments and additions are welcomeAlex Otthttp://www.blogger.com/profile/13001951608173211050noreply@blogger.com1tag:blogger.com,1999:blog-6862508.post-51046137741011065902008-11-12T10:19:00.005+01:002010-01-21T10:33:12.435+01:00Emacs + GitI slowly migrate to <a href="http://zagadka.vm.bytemark.co.uk/magit/">magit</a> and at the same time I'm trying to describe it in my <a href="http://alexott.net/en/writings/emacs-vcs/EmacsGit.html">article about Emacs & Git integration</a>. Working with this package, i understood, that sometimes i switch to console, just to run some commands from git-svn. Than i decided to add missing functionality, and implement simple support of git-svn in magit. Repository with my changes could be found <a href="http://repo.or.cz/w/magit.git">here</a>.<br />
I like Emacs for this - in many cases i can easily extend it's functionality without restarting it, or compiling and installing separate pluginsAlex Otthttp://www.blogger.com/profile/13001951608173211050noreply@blogger.com0tag:blogger.com,1999:blog-6862508.post-68908826216684948182008-11-03T16:12:00.000+01:002008-11-03T16:13:44.955+01:00Working with Growl from EmacsFor Mac OS X there is separate package <a href="http://growl.info/">Growl</a>, that provides notification services for different programs. Notifications are represented as floating windows, containing text and icon. There notifications could be very useful for some things, like notifications from <em>org-mode</em>.<br />After some search, I found information how I can output notifications <a href="http://growl.info/documentation/applescript-support.php">using AppleSript interface to Growl</a>. To make this work, you need to perform two things — first you need to register your application and notifications types, produced by this application, and than you can send notifications to Growl.<br />To register application you will need following script, that declares notification types and register them, together with application in Growl:<sup><a class="footref" name="fnr.1" href="http://www2.blogger.com/post-create.g?blogID=6862508#fn.1">1</a></sup><br /><pre class="src">tell application <span style="color: rgb(0, 139, 0);">"GrowlHelperApp"</span><br />-- Declare a list of notification types<br />set the allNotificationsList to {<span style="color: rgb(0, 139, 0);">"Emacs Notification"</span>}<br /><br />-- Declare list of active notifications. If some of them<br />-- isn't activated, user can do this later via preferences<br />set the enabledNotificationsList to {<span style="color: rgb(0, 139, 0);">"Emacs Notification"</span>}<br /><br />-- Register our application in Growl.<br />register as application <span style="color: rgb(0, 139, 0);">"Aquamacs Emacs"</span> all notifications allNotificationsList \<br /> default notifications enabledNotificationsList \<br /> icon of application <span style="color: rgb(0, 139, 0);">"Aquamacs Emacs"</span><br />end tell</pre>You can execute this script with <code>osascript</code> command from command line, or put it into <code>Script Editor</code> and execute it directly. After registration, user can customize look of the registered notification via <code>Applications</code> tab at preference pane of Growl.<br />And after registration, user can send notifications with following script, that is a base of our Emacs's interface to Growl.<br /><pre class="src"> tell application <span style="color: rgb(0, 139, 0);">"GrowlHelperApp"</span><br /> notify with name <span style="color: rgb(0, 139, 0);">"Emacs Notification"</span> title <span style="color: rgb(0, 139, 0);">"Emacs alert"</span> \<br /> description <span style="color: rgb(0, 139, 0);">"Message!!!"</span> application name <span style="color: rgb(0, 139, 0);">"Aquamacs Emacs"</span><br /> end tell</pre>This script also could be executed via <code>osascript</code>, and it'll output message <code>Message!!!</code> with title <code>Emacs alert</code>, but to output non-Latin1 symbols from AppleScript, you'll need to encode them using UTF-16 and represent them as hexadecimal string, so we'll going to add special code, that will recode message strings to corresponding format.<br />To interact with AppleScript from Emacs we'll could use <code>do-applescript</code> function, but I found, that it doesn't properly handle multi-byte symbols <code>«</code> and <code>»</code>, that are used to specify text in multi-byte encoding. So we'll form script in temporary file, and than execute it with <code>osascript</code>, and delete temporary file. This executed with following function:<br /><pre class="src">(<span style="color: rgb(160, 32, 240);">defun</span> <span style="color: rgb(0, 0, 255);">output-to-growl</span> (msg)<br /> (<span style="color: rgb(160, 32, 240);">let</span> ((fname (make-temp-file <span style="color: rgb(0, 139, 0);">"/tmp/growlXXXXXX"</span>)))<br /> (<span style="color: rgb(160, 32, 240);">with-temp-file</span> fname<br /> (setq coding-system-for-write 'utf-16)<br /> (insert (format <span style="color: rgb(0, 139, 0);">"tell application \"GrowlHelperApp\"<br /> notify with name \"Emacs Notification\" title \"Emacs alert\" \<br /> description «data utxt%s» as Unicode text \<br /> application name \"Aquamacs Emacs\"<br /> end tell"</span> (osd-text-to-utf-16-hex msg))))<br /> (shell-command (format <span style="color: rgb(0, 139, 0);">"osascript %s"</span> fname))<br /> (delete-file fname)))</pre>To proper output of strings, containing Cyrillic & other non-Latin1 symbols, AppleScript requires, that data should be encoded in UTF-16, and presented as string <code>data utxtXXXXXX</code>, where <code>utxtXXXXXXX</code> — hexadecimal representation of corresponding bytes of string in UTF-16 encoding. To do this task, I wrote function <code>osd-text-to-utf-16-hex</code>, that is called from <code>output-to-growl</code> function:<br /><pre class="src">(<span style="color: rgb(160, 32, 240);">defun</span> <span style="color: rgb(0, 0, 255);">osd-text-to-utf-16-hex</span> (text)<br /> (<span style="color: rgb(160, 32, 240);">let*</span> ((utext (encode-coding-string text 'utf-16))<br /> (ltext (string-to-list utext)))<br /> (apply #'concat<br /> (mapcar (<span style="color: rgb(160, 32, 240);">lambda</span> (x) (format <span style="color: rgb(0, 139, 0);">"%02x"</span> x)) ltext))))</pre>And that's all. Now you can call <code>output-to-growl</code> from any place. I use it to get notifications from <em>org-mode</em>.<br /><hr /><a class="footnum" name="fn.1" href="http://www2.blogger.com/post-create.g?blogID=6862508#fnr.1">1.</a> I need to mention, that long lines were split with <code>\</code> just to get proper formatting on the screen. In script, you need to combine them into one long line!Alex Otthttp://www.blogger.com/profile/13001951608173211050noreply@blogger.com3