Re: Remember 2.0 released

2008-04-18 Thread Tassilo Horn
Uwe Brauer <[EMAIL PROTECTED]> writes:

Hi Uwe,

> There is already a package called remember.el by 
> ;;; remember.el --- a mode for quickly jotting down things to remember
> ;; Copyright (C) 1999, 2000, 2001 John Wiegley
>
> May be you could use another name?

It's the same.  John is the original author, but since then its
maintainers were John Sullivan, Sacha Chua and Michael Olson.

Bye,
Tassilo
-- 
Richard Stallman can solve the halting problem... in polynomial time.



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: Remember 2.0 released

2008-04-17 Thread Tassilo Horn
William Xu <[EMAIL PROTECTED]> writes:

> Does it support Org-mode? 

,[ (info "(org)Remember") ]
| The Remember package by John Wiegley lets you store quick notes with
| little interruption of your work flow.  See
| `http://www.emacswiki.org/cgi-bin/wiki/RememberMode' for more
| information.  It is an excellent way to add new notes and tasks to
| Org-mode files.  Org-mode significantly expands the possibilities of
| remember: You may define templates for different note types, and
| associate target files and headlines with specific templates.  It also
| allows you to select the location where a note should be stored
| interactively, on the fly.
`

Bye,
Tassilo
-- 
Richard  Stallman  eats  ethernet   cables.  That's  why  they  invented
wireless.



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: Bookmarks in doc-view -- dv-bmk.el

2007-12-25 Thread Tassilo Horn
thorne <[EMAIL PROTECTED]> writes:

Hi Evans,

> This should be taken mostly in the spirit of a feature request,

Ok, I took it mostly is the spirit of a feature request and added
support for doc-view in bookmark.el.  See the message
<[EMAIL PROTECTED]> on emacs-devel.  If nobody complains
I'll install the patch in the main branch in a few days.

It would be cool if you could try the patch and report if it works for
you.

Bye,
Tassilo



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-08-31 Thread Tassilo Horn
[EMAIL PROTECTED] (Michaël Cadilhac) writes:

Hi Michaël,

>>> (defvar anything-locate-options (if (eq system-type 'darwin)
>>> '("locate")
>>>   '("locate" "-i " "-r"))
>>>   "A list where the `car' is the name of the locat program
>>> followed by options. The search pattern will be appended, so the
>>> \"-r\" option should be the last option.")
>>
>> Added.
>
> Unfortunately, you've also added the typo ;-) "-i " instead of "-i".

Ah, cool.  Since I added it I was curious what locate complains about an
unknown option.

It's fixed in Git now and I'll upload it to emacswiki in a second.

Bye,
Tassilo
-- 
A morning without coffee is like something without something else.



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: doc-view.el --- View PDF/PostStript/DVI files in Emacs

2007-08-27 Thread Tassilo Horn
Bill Clementson <[EMAIL PROTECTED]> writes:

Hi Bill,

> Just another small point - you use process-file-shell-command in
> doc-view.el but that command is only available in recent CVS emacs and
> not in 22.1. You might want to consider using process-file instead.

No, that's not possible.  `process-file' wants a PROGRAM whereas
`process-file-shell-command' accepts a whole command line.  Because the
somewhat strange order dvipdfm accepts its aruments it seems to be not
doable with `process-file' and its arguments.

But I can use `shell-command' (and I do it now).

BTW: We really should move the discussion to gnu.emacs.help now.

Bye,
Tassilo
-- 
 My software never has bugs. It just develops random features.



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: doc-view.el --- View PDF/PostStript/DVI files in Emacs

2007-08-26 Thread Tassilo Horn
Bill Clementson <[EMAIL PROTECTED]> writes:

Hi Bill,

> Wow, the performance increase with gs is incredible! That's really
> amazing. :-)

Yep, but it's a bummer that I dunno how to cut of the margins.

> BTW, you might want to add the following bindings to
> doc-view-mode-map:
>
> (define-key map (kbd "C-p")   'scroll-down)
> (define-key map (kbd "C-n")   'scroll-up)

Nope. :-)

I'll make C-v and M-v for scrolling, because that's the default.  C-p
and C-n will move to the previous/next page.

BTW: Please open a new thread on gnu.emacs.help for further discussions.
It seems that this group is not intended therfore and I don't want to
hijack it.

Bye,
Tassilo
-- 
When Chuck Norris works out on the Total Gym, the Total Gym feels like
it's been raped.



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: doc-view.el --- View PDF/PostStript/DVI files in Emacs

2007-08-26 Thread Tassilo Horn
Bill Clementson <[EMAIL PROTECTED]> writes:

Hi Bill,

> I am new to git, so maybe I'm doing something wrong.

No, the problem was on my side.  Please try again.

Bye,
Tassilo
-- 
Writing  a   newsreader  isn't   hard,  any  dwep   can  do   it.   And,
unfortunately, a lot  of them does.  Even worse, some  of them works for
Microsoft or Netscape.  Writing a *good* newsreader is hard, and writing
the perfect newsreader is Lars Magne Ingebrigtsen. (Per Abrahamsen)



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: doc-view.el --- View PDF/PostStript/DVI files in Emacs

2007-08-26 Thread Tassilo Horn
Tim X <[EMAIL PROTECTED]> writes:

Hi Tim,

 5. Dired key: It would be nice to have a defcustom value that would
 specify a dired map key that would call doc-view on a file (with a
 new doc-view function that doesn't prompt for the file name). This
 would make it easier to "browse" pdf files in dired.
>>>
>>> Good idea.  I'll add that.  Do you have a good suggestion what key
>>> could be used and is free?
>>
>> How about "b" (for browse) or "V" (for View)?
>
> I think 'b' is available. However, you may find it useful to do what I
> did in my txutils.el package. I used defadvice around view-file (which
> is bound to v in dired).

Since I was asked to include doc-view.el in Emacs I'm not sure if
defadvice would be too good.  AFAIK RMS doesn't like it too much.

> So, now if I hit v on a pdf, ps, doc, ppt html etc file, it converts
> the file to either text or html and then displays it in a buffer (in
> the case of html output and .html files, it just uses browse-url to
> display the rendered version).

At least for PS files that may not be the right thing.  Users might want
to view it with `ps-mode' instead.

Bye,
Tassilo
-- 
GNU Emacs is a text editor for Über-Geeks.



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: doc-view.el --- View PDF/PostStript/DVI files in Emacs

2007-08-26 Thread Tassilo Horn
Bill Clementson <[EMAIL PROTECTED]> writes:

Hi Bill,

>>> 1. It is slow: It would probably be better to provide an async mode
>>> option. In other words, instead of waiting for the convert process
>>> to complete, let the user view the pages that have been generated
>>> and periodically, have doc-view automatically update the
>>> doc-view-current-files variable with the updated list of pages.
>>
>> I don't think that would help much.  The generation of the pictures
>> is about the last 5-10% of the transformation.

Please update.  I changed it to use plain ghostscript now, which makes
it about 10 times faster.  The results are nearly as good.  The only
real downside is that I didn't figure out how I can trim the margins,
yet.

Bye,
Tassilo



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: doc-view.el --- View PDF/PostStript/DVI files in Emacs

2007-08-25 Thread Tassilo Horn
Bill Clementson <[EMAIL PROTECTED]> writes:

Hi Bill,

> Only the Macports install worked on my Powerbook G4 (and that took
> ages to build all the dependencies because Macports builds versions of
> the dependencies that work with the package you're installing even if
> you have non-Macports versions of the same progs installed and in your
> path). Tassilo, please forgive me for all the names I called you this
> afternoon for using git! ;-)

Haha, forgiven.

> But, back to doc-view.el. Did I mention that it is way cool? :-)

Thanks!

> There are a few ways that it could probably be made better though:
>
> 1. It is slow: It would probably be better to provide an async mode
> option. In other words, instead of waiting for the convert process to
> complete, let the user view the pages that have been generated and
> periodically, have doc-view automatically update the
> doc-view-current-files variable with the updated list of pages.

I don't think that would help much.  The generation of the pictures is
about the last 5-10% of the transformation.

> 2. Cancel key: There should be a key binding to cancel the convert
> process and (optionally) view what has been generated so far.

I've done that yesterday.  Get the current version.

> 3. Page count: It would be useful to have a running update of how many
> pages have been converted so far in the minibuffer (or maybe the mode
> line so that the minibuffer isn't being continually updated and can be
> used for other commands).

See my answer to point 1.

> 4. Batch mode: It would be nice to have an option to kick off a batch
> background process to do the conversion. For big documents, it isn't
> really practical to wait till it's been converted.

Well, why do you think you have to wait?  Go on with your work and
eventually the *DocView* buffer pops up.  (That's much better in the
current version now.)

> 5. Dired key: It would be nice to have a defcustom value that would
> specify a dired map key that would call doc-view on a file (with a new
> doc-view function that doesn't prompt for the file name). This would
> make it easier to "browse" pdf files in dired.

Good idea.  I'll add that.  Do you have a good suggestion what key could
be used and is free?

> Did I mention that doc-view is way cool? :-)

And think of how cool it will be in 5 or ten years when we all have
64-core 50 GHz computers with 512 GB RAM!!!

Bye,
Tassilo
-- 
Scotty in Star  Trek often says "Ye cannae change  the laws of physics."
This is  untrue. Chuck Norris can  change the laws of  physics. With his
fists.



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-08-24 Thread Tassilo Horn
Mark Plaksin <[EMAIL PROTECTED]> writes:

Hi Mark,

> A friend of mine wants to be able to press the "anything key" twice in
> a row to swap between the two most recent buffers.  This should be
> easy but my solution is convoluted.

Tell your friend he should use `anything-c-source-buffers' as buffer
source.  There the `other-buffer' will always be on top of the buffer
listing.  So switching between 2 buffers is simply

   RET

So get anything-config.el [1]. :-)

Bye,
Tassilo

__
[1] http://www.emacswiki.org/cgi-bin/wiki/anything-config.els
-- 
  "OS's and GUI's come and go, only Emacs has lasting power."
  Per Abrahamsen in <[EMAIL PROTECTED]>



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: doc-view.el --- View PDF/PostStript/DVI files in Emacs

2007-08-24 Thread Tassilo Horn
Xavier Maillard <[EMAIL PROTECTED]> writes:

Hi Xavier,

> I'll try to do that this evening.

Ok.  Today I made some major changes to make it more convenient to use,
because doc-view.el is going to be part of GNU Emacs in the near
future.  The current version is in my Git repository and a patch is sent
to emacs-devel. :-)

Bye,
Tassilo
-- 
The  desire  to  be  rewarded  for one's  creativity  does  not  justify
depriving  the world  in  general of  all  or part  of that  creativity.
(Richard M. Stallman)



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-08-24 Thread Tassilo Horn
Bill Clementson <[EMAIL PROTECTED]> writes:

Hi Bill,

>> Or do you have a better idea?
>
> Something like the following should work:
>
> (defvar anything-c-man-pages nil "All man pages on system")
>
> (defvar anything-c-source-man-pages
>   `((name . "Manual Pages")
> (candidates . (lambda ()
>   (if (not anything-c-man-pages)
>   (when (require 'woman nil t)
> (woman-file-name "")
> (setq anything-c-man-pages 
>   (sort (mapcar 'car
> woman-topic-all-completions)
> 'string-lessp)))
> anything-c-man-pages)))
> (action . (("Show with Woman" . woman)))
> (requires-pattern . 2)))

Oh, yes.  I added something like this for the man and the info source.

Bye,
Tassilo
-- 
Fighting patents one by one  will never eliminate the danger of software
patents,  any  more than  swatting  mosquitoes  will eliminate  malaria.
(Richard M. Stallman)



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-08-24 Thread Tassilo Horn
Bill Clementson <[EMAIL PROTECTED]> writes:

Hi Bill,

> By the way, another thing that used to bug me was having the woman
> initialization done when I didn't configure the man pages source. In
> the end, I got around it by defining the vars in my .emacs file before
> the anything-config require - eg:
>
> (defvar anything-sources nil "Prevent loading of woman")
> (defvar anything-c-source-man-pages nil "Prevent loading of woman")
> (require 'anything-config)
>
> but, anything and anything-config should probably be making certain
> that they don't load things that the user doesn't want loaded.

I really think that's the best you can do.  The only thing to stop
evaluation of those defvars is to wrap them in a

  (when do-i-wanna-use-this-foo-source
 (defvar foo-source ...

which the user would have to set before requiring anything-config.  I
don't think that would be better.

Or do you have a better idea?

Bye,
Tassilo
-- 
Thousands  of years  ago Chuck  Norris  came across  a bear.  It was  so
terrified that it  fled north into the arctic. It  was also so terrified
that all of its decendents now have white hair.



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-08-23 Thread Tassilo Horn
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:

Hi Tamas,

>> I need to look through your newes changes and see how I can make some
>> sane defaults for anything-config.  Especially the dynamic source
>> selection is cool.  Does it only suppress listing of source results
>> or does it suppress calculation, too?  The latter would be superb,
>> since I like so many sources that the calculations slow down emacs
>> considerably.
>
> If you mean anything-set-source-filter then only those sources are
> calculated which are in the filter.

Hey, I played a bit with them and they're great.  But I have another
suggestion: it would be mega-funky if you could ADD sources dynamically.
So you have a slick default anything-sources and if I don't find what
you're looking for, you hit a key and some very powerful but expensive
sources are added.

Oh, while I was typing those lines I realized that it's possible right
now!  Add every and each source to anything-sources and fire up anything
with

(defun th-anything ()
  (interactive)
  (anything-set-source-filter '(anything-c-source-foo
anything-c-source-bar
anything-c-source-baz))
  (anything))

Oh, doesn't work!  It errors!

--8<---cut here---start->8---
Debugger entered--Lisp error: (wrong-type-argument window-live-p nil)
  ad-Orig-select-window(nil nil)
  select-window(nil)
  (progn (select-window (get-buffer-window anything-buffer ...)) (case unit 
(line ...) (page ...) (source ...) (t ...)) (while (anything-pos-header-line-p) 
(forward-line ...)) (if (eobp) (forward-line -1)) (anything-mark-current-line))
  (unwind-protect (progn (select-window ...) (case unit ... ... ... ...) (while 
... ...) (if ... ...) (anything-mark-current-line)) (dolist (elt 
save-selected-window-alist) (and ... ... ...)) (if (window-live-p 
save-selected-window-window) (select-window save-selected-window-window)))
  (save-current-buffer (unwind-protect (progn ... ... ... ... ...) (dolist ... 
...) (if ... ...)))
  (let ((save-selected-window-window ...) (save-selected-window-alist ...)) 
(save-current-buffer (unwind-protect ... ... ...)))
  (save-selected-window (select-window (get-buffer-window anything-buffer ...)) 
(case unit (line ...) (page ...) (source ...) (t ...)) (while 
(anything-pos-header-line-p) (forward-line ...)) (if (eobp) (forward-line -1)) 
(anything-mark-current-line))
  (if (= (buffer-size ...) 0) nil (save-selected-window (select-window ...) 
(case unit ... ... ... ...) (while ... ...) (if ... ...) 
(anything-mark-current-line)))
  (unless (= (buffer-size ...) 0) (save-selected-window (select-window ...) 
(case unit ... ... ... ...) (while ... ...) (if ... ...) 
(anything-mark-current-line)))
  anything-move-selection(line next)
  anything-next-line()
  (let (delayed-sources) (dolist (source ...) (if ... ...)) (goto-char 
(point-min)) (run-hooks (quote anything-update-hook)) (anything-next-line) 
(anything-maybe-fit-frame) (run-with-idle-timer (if ... 0.1 0) nil (quote 
anything-process-delayed-sources) delayed-sources))
  (save-current-buffer (set-buffer anything-buffer) (erase-buffer) (if 
anything-enable-digit-shortcuts (dolist ... ...)) (let (delayed-sources) 
(dolist ... ...) (goto-char ...) (run-hooks ...) (anything-next-line) 
(anything-maybe-fit-frame) (run-with-idle-timer ... nil ... delayed-sources)))
  (with-current-buffer anything-buffer (erase-buffer) (if 
anything-enable-digit-shortcuts (dolist ... ...)) (let (delayed-sources) 
(dolist ... ...) (goto-char ...) (run-hooks ...) (anything-next-line) 
(anything-maybe-fit-frame) (run-with-idle-timer ... nil ... delayed-sources)))
  anything-update()
  anything-set-source-filter(("Emacs Functions"))
  th-anything()
  call-interactively(th-anything)
  execute-extended-command(nil)
  call-interactively(execute-extended-command)
--8<---cut here---end--->8---

And the other way round it has no effect.

(defun th-anything ()
  (interactive)
  (anything)
  (anything-set-source-filter '(anything-c-source-foo
anything-c-source-bar
anything-c-source-baz)))

:-(

Could this be done somehow?  Now that I imagined how useful it is, I
cannot live without it anymore. ;-)

Bye,
Tassilo
-- 
  "DRM manages rights in the same way a jail manages freedom"



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-08-23 Thread Tassilo Horn
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:

> On Aug 23, 6:54 pm, "[EMAIL PROTECTED]"
> <[EMAIL PROTECTED]> wrote:
>> Here's a Google Suggest source. Requires the latest anything.el.
>
> There may be a few linebreak errors in it due to Google Groups. Sorry
> about that.

I fixed them and added it in anything-config.el.  It's nice!

I need to look through your newes changes and see how I can make some
sane defaults for anything-config.  Especially the dynamic source
selection is cool.  Does it only suppress listing of source results or
does it suppress calculation, too?  The latter would be superb, since I
like so many sources that the calculations slow down emacs considerably.

BTW:  I noticed this typo. :-)

(defvar anything-iswitchb-dont-touch-iswithcb-keys nil
  ^^
  "If t then those commands are not bound from `anything-map'
  under iswitchb which would override standard iswithcb keys.
^^
Bye,
Tassilo



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: doc-view.el --- View PDF/PostStript/DVI files in Emacs

2007-08-23 Thread Tassilo Horn
Reiner Steib <[EMAIL PROTECTED]> writes:

Hi Reiner,

>> (defcustom doc-view-cache-directory "/tmp/doc-view"
>
> Maybe use `temporary-file-directory' or `make-temp-name'.

I use the former now.

>> (defun doc-view-file-name-to-directory-name (file)
>>   "Return the directory where the png files of FILE should be saved.
>>
>> It'a a subdirectory of `doc-view-cache-directory'."
>>   (concat (directory-file-name doc-view-cache-directory)
>>   "/"
>>   (replace-regexp-in-string "/" "!" file)))
>
> Probably not portable, I think.  Windows users may set the directory
> to "c:\foo\bar".

Winwhat?!? ;-)

> Maybe you could do like the package formerly knows as `tumme.el' does
> it.  Ah, it's `image-dired.el' now: `image-dired-thumb-name'.
>
>> (defun doc-view-convert-file (file)
> [...]
>>   (let* ((dir (doc-view-file-name-to-directory-name file))
>>  (png-file (concat dir "/" "page.png")))

Yes, now I do a bit as the package formely known as `tumme'.

--8<---cut here---start->8---
(defun doc-view-file-name-to-directory-name (file)
  "Return the directory where the png files of FILE should be saved.

It'a a subdirectory of `doc-view-cache-directory'."
  (concat (file-name-as-directory doc-view-cache-directory)
  (file-name-nondirectory file) "-"
  (md5 file)))
--8<---cut here---end--->8---


> ,[ (info "(elisp)Directory Names") ]
> |If you want to use a directory file name in making such a
> | combination, you must first convert it to a directory name using
> | `file-name-as-directory':
> | 
> |  (concat (file-name-as-directory DIRFILE) RELFILE)
> | 
> | Don't try concatenating a slash by hand, as in
> | 
> |  ;;; Wrong!
> |  (concat DIRFILE "/" RELFILE)
> | 
> | because this is not portable.  Always use `file-name-as-directory'.
> `

I'll try to memorize it.

Thanks for the pointers,
Tassilo
-- 
The  desire  to  be  rewarded  for one's  creativity  does  not  justify
depriving  the world  in  general of  all  or part  of that  creativity.
(Richard M. Stallman)



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: doc-view.el --- View PDF/PostStript/DVI files in Emacs

2007-08-23 Thread Tassilo Horn
Xavier Maillard <[EMAIL PROTECTED]> writes:

Hi Xavier,

>> $ git-clone http://www.tsdh.de/repos/git/doc-view.git
>
> Marvelous ! Just what I expected. Sole regret: the key binding's
> choice :)

What alternative bindings would you suggest?  There are lots of free
ones left. ;-)

Bye,
Tassilo
-- 
Chuck Norris once  invited all of the other badasses from  TV to duke it
out in  order to see  who was the  supreme badass. Only two  showed up--
Jack Bauer and MacGyver.



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: doc-view.el --- View PDF/PostStript/DVI files in Emacs

2007-08-23 Thread Tassilo Horn
Xavier Maillard <[EMAIL PROTECTED]> writes:

Hi Xavier,

> I've started to write something down onto emacwiki[1]. It needs still
> some work to be usefull.
>
> [1] http://www.emacswiki.org/cgi-bin/wiki/DocViewMode

I've seen it and I left a comment.  If you want you can upload it to
emacswiki and keep it current.  (I don't do that because I'm laz... ah,
too busy!)

Bye,
Tassilo
-- 
Chuck Norris is not Politically Correct. He is just Correct. Always. 



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: doc-view.el --- View PDF/PostStript/DVI files in Emacs

2007-08-22 Thread Tassilo Horn
Hi,

I fixed some bugs in the meantime.

This is the last version I'll post here.  Please get it from my Git
repository in the future.

$ git-clone http://www.tsdh.de/repos/git/doc-view.git

Bye,
Tassilo

--8<---cut here---start->8---
;;; doc-view.el --- View PDF/PostScript/DVI files in Emacs

;; Copyright (C) 2007 Tassilo Horn
;;
;; Author: Tassilo Horn <[EMAIL PROTECTED]>
;; Homepage: http://www.tsdh.de
;; Version: <2007-08-22 Wed 21:22>

;; This  program is free  software; you  can redistribute  it and/or  modify it
;; under the terms  of the GNU General Public License as  published by the Free
;; Software  Foundation;  either version  3,  or  (at  your option)  any  later
;; version.
;;
;; This program is distributed in the  hope that it will be useful, but WITHOUT
;; ANY  WARRANTY;  without even  the  implied  warranty  of MERCHANTABILITY  or
;; FITNESS FOR  A PARTICULAR PURPOSE.  See  the GNU General  Public License for
;; more details.
;;
;; You should have received a copy of the GNU General Public License along with
;; this program; if not, write to  the Free Software Foundation, Inc., 675 Mass
;; Ave, Cambridge, MA 02139, USA.

;;; Requirements:

;; I tested in on GNU Emacs 22, but maybe it works with older emacsen or
;; XEmacs, too.  You need ImageMagick's convert tool.

;;; Commentary:

;; DocView is a  document viewer for Emacs.  It converts PDF,  PS and DVI files
;; to a set  of PNG files, one PNG  for each page, and displays  the PNG images
;; inside  an Emacs buffer.   This buffer  uses `doc-view-mode'  which provides
;; convenient key bindings for browsing the document.
;;
;; To use it simply do
;;
;; M-x doc-view RET
;;
;; and you'll be queried for a document to open.
;;
;; Since  conversion may take  some time  all the  PNG images  are cached  in a
;; subdirectory of `doc-view-cache-directory' and  reused when you want to view
;; that  file again.   This  reusing can  be  omitted if  you  provide a  prefx
;; argumentto   `doc-view'. Todelete   allcached   filesuse
;; `doc-view-clear-cache'.  To open the cache  with dired, so that you can tidy
;; it out use `doc-view-dired-cache'.

;;; Code:

(defgroup doc-view
  nil
  "In-buffer viewer for PDF, PostScript and DVI files.")

(defcustom doc-view-converter-program "convert"
  "Program to convert doc files to png."
  :type '(file)
  :group 'doc-view)

(defcustom doc-view-cache-directory "/tmp/doc-view"
  "The base directory, where the PNG imoges will be saved."
  :type '(directory)
  :group 'doc-view)

(defcustom doc-view-display-size 114
  "The DPI your screen supports.
This value determinate how big the resulting PNG images are.  If
the value is too small, reading might become hard.  If it's too
big, the images won't fit into an Emacs buffer.  Fiddle with it!"
  :type '(integer)
  :group 'doc-view)

(defcustom doc-view-display-margin 5
  "The width of the margin put around the page's image."
  :type '(integer)
  :group 'doc-view)

(defvar doc-view-current-files nil
  "Only used internally.")

(defvar doc-view-current-page nil
  "Only used internally.")

(defvar doc-view-current-dir nil
  "Only used internally.")

(defvar doc-view-mode-map
  (let ((map (make-sparse-keymap)))
(define-key map (kbd "C-v") 'doc-view-next-page)
(define-key map (kbd "M-v") 'doc-view-previous-page)
(define-key map (kbd "M-<") 'doc-view-first-page)
(define-key map (kbd "M->") 'doc-view-last-page)
(define-key map (kbd "g")   'doc-view-goto-page)
(define-key map (kbd "k")   'doc-view-kill-buffer)
(define-key map (kbd "q")   'bury-buffer)
(suppress-keymap map)
map)
  "Keymap used by `doc-view-mode'.")

(defun doc-view-kill-buffer ()
  "Kill the current buffer."
  (interactive)
  (kill-buffer (current-buffer)))

(defun doc-view-goto-page (arg)
  "View the page given by ARG.
DocView numbers pages starting with zero!"
  (interactive "nPage: ")
  (doc-view-display-image (nth arg doc-view-current-files))
  (setq doc-view-current-page arg))

(defun doc-view-next-page (arg)
  "Browse ARG pages forward."
  (interactive "p")
  (let ((page (+ doc-view-current-page arg)))
(if (< page 0)
(setq page 0)
  (when (>= page (length doc-view-current-files))
(setq page (1- (length doc-view-current-files)
(doc-view-goto-page page)))

(defun doc-view-previous-page (arg)
  "Browse ARG pages backward."
  (interactive "p")
  (doc-view-next-page (* -1 arg)))

(defun doc-view-first-page ()
  "View the first page."
  (interactive)
  (doc-view-

doc-view.el --- View PDF/PostStript/DVI files in Emacs

2007-08-22 Thread Tassilo Horn
Hi all,

I think the subject says it all.  I took inspirations but no code from
John Sturdy's dvi-view.el, so thanks a lot to him.  It's meant to be as
simple as possible, so there are no fancy features like headers or
footers.

But it caches all images in a user configurable directory and reuses
those files when opening the same document again.  (Of course, this can
be suppressed.)

How to get future versions (get it from my Git repository) can be seen
on my homepage http://www.tsdh.de.

Bye,
Tassilo

--8<---cut here---start->8---
;;; doc-view.el --- View PDF/PostStript/DVI files in Emacs

;; Copyright (C) 2007 Tassilo Horn
;;
;; Author: Tassilo Horn <[EMAIL PROTECTED]>
;; Homepage: http://www.tsdh.de

;; This  program is free  software; you  can redistribute  it and/or  modify it
;; under the terms  of the GNU General Public License as  published by the Free
;; Software  Foundation;  either version  3,  or  (at  your option)  any  later
;; version.
;;
;; This program is distributed in the  hope that it will be useful, but WITHOUT
;; ANY  WARRANTY;  without even  the  implied  warranty  of MERCHANTABILITY  or
;; FITNESS FOR  A PARTICULAR PURPOSE.  See  the GNU General  Public License for
;; more details.
;;
;; You should have received a copy of the GNU General Public License along with
;; this program; if not, write to  the Free Software Foundation, Inc., 675 Mass
;; Ave, Cambridge, MA 02139, USA.

;;; Requirements:

;; I tested in on GNU Emacs 22, but maybe it works with older emacsen or
;; XEmacs, too.  You need ImageMagick's convert tool.

;;; Commentary:

;; DocView is a  document viewer for Emacs.  It converts PDF,  PS and DVI files
;; to a set  of PNG files, one PNG  for each page, and displays  the PNG images
;; inside  an Emacs buffer.   This buffer  uses `doc-view-mode'  which provides
;; convenient key bindings for browsing the document.
;;
;; To use it simply do
;;
;; M-x doc-view RET
;;
;; and you'll be queried for a document to open.
;;
;; Since  conversion may take  some time  all the  PNG images  are cached  in a
;; subdirectory of `doc-view-cache-directory' and  reused when you want to view
;; that  file again.   This  reusing can  be  omitted if  you  provide a  prefx
;; argumentto   `doc-view'. Todelete   allcached   filesuse
;; `doc-view-clear-cache'.  To open the cache  with dired, so that you can tidy
;; it out use `doc-view-dired-cache'.

;;; Version:

;; <2007-08-22 Wed 19:06>

;;; Code:

(defgroup doc-view
  nil
  "In-buffer viewer for PDF, PostScript and DVI files.")

(defcustom doc-view-converter-program "convert"
  "Program to convert doc files to png."
  :type '(file)
  :group 'doc-view)

(defcustom doc-view-cache-directory "/tmp/doc-view"
  "The base directory, where the PNG imoges will be saved."
  :type '(directory)
  :group 'doc-view)

(defcustom doc-view-display-size 114
  "The DPI your screen supports.
This value determinate how big the resulting PNG images are.  If
the value is too small, reading might become hard.  If it's too
big, the images won't fit into an Emacs buffer.  Fiddle with it!"
  :type '(integer)
  :group 'doc-view)

(defcustom doc-view-display-margin 5
  "The width of the margin put around the page's image."
  :type '(integer)
  :group 'doc-view)

(defvar doc-view-current-files nil
  "Only used internally.")

(defvar doc-view-current-page nil
  "Only used internally.")

(defvar doc-view-current-dir nil
  "Only used internally.")

(defparameter doc-view-mode-map
  (let ((map (make-sparse-keymap)))
(define-key map (kbd "C-v") 'doc-view-next-page)
(define-key map (kbd "M-v") 'doc-view-previous-page)
(define-key map (kbd "M-<") 'doc-view-first-page)
(define-key map (kbd "M->") 'doc-view-last-page)
(define-key map (kbd "g")   'doc-view-goto-page)
(define-key map (kbd "k")   'doc-view-kill-buffer)
(define-key map (kbd "q")   'bury-buffer)
(suppress-keymap map)
map)
  "Keymap used by `doc-view-mode'.")

(defun doc-view-kill-buffer ()
  "Kill the current buffer."
  (interactive)
  (kill-buffer (current-buffer)))

(defun doc-view-goto-page (arg)
  "View the page given by ARG.
DocView numbers pages starting with zero!"
  (interactive "nPage: ")
  (doc-view-display-image (nth arg doc-view-current-files))
  (setq doc-view-current-page arg))

(defun doc-view-next-page (arg)
  "Browse ARG pages forward."
  (interactive "p")
  (let ((page (+ doc-view-current-page arg)))
(if (< page 0)
(setq page 0)
  (when (>= page (length doc-view-current-files))
(setq page 

Re: In-buffer viewer for DVI files

2007-08-22 Thread Tassilo Horn
Tassilo Horn <[EMAIL PROTECTED]> writes:

Hi,

> that's really nice.  Indeed I wanted to write something like that for
> quite some time, but I never did so...
>
> Anyway, you could make it even better by making it a generic viewer
> for DVI, PostScript and PDF files.  ImageMagick's `convert' tool can
> convert any of those formats to PNG.
>
> $ convert  bar.png
>
> converts every page to a file bar-X.png in /some/dir/ where X is a
> number starting with 0 (page 1).

I started writing that mode and basically it works.  I need to fix some
things before it's really usable, but I think I can post it tomorrow.
:-)

Bye,
Tassilo



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: In-buffer viewer for DVI files

2007-08-21 Thread Tassilo Horn
John Sturdy <[EMAIL PROTECTED]> writes:

Hi John,

> I found a machine I was using didn't have xdvi, so I wrote some elisp
> to call dvipng and put the resulting pages together in an Emacs
> buffer; then I made it into a major mode, with "next" and "previous"
> commands, etc.

that's really nice.  Indeed I wanted to write something like that for
quite some time, but I never did so...

Anyway, you could make it even better by making it a generic viewer for
DVI, PostScript and PDF files.  ImageMagick's `convert' tool can convert
any of those formats to PNG.

$ convert  bar.png

converts every page to a file bar-X.png in /some/dir/ where X is a
number starting with 0 (page 1).

I'm pretty sure that convert has an option to crop parts of the margins
of the pdf/ps/dvi files, so that you can make best use of the emacs
window's space.

What do you think?

Bye,
Tassilo



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-08-19 Thread Tassilo Horn
[EMAIL PROTECTED] writes:

Hi Bill,

>> Do you use the latest version of anything-config? Tassilo fixed a bug
>> in it shortly after he uploaded the new version.

There was exactly the same bug in the action transformer, too.  I didn't
return the unmodified actions, if the special entry was not selected.

> Yep, I'm using the latest anything-config (anything-c-
> version="<2007-08-19 Sun 21:06>").

It's fixed now.

Bye,
Tassilo
-- 
Chuck Norris was what Willis was talkin' about. 



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-08-19 Thread Tassilo Horn
Tassilo Horn <[EMAIL PROTECTED]> writes:

Hi,

>> Tassilo's solution is good, but I also fixed anything.el, so that
>> filtered candidate transformer is run also if the candidate list is
>> empty. This is is alternative solution.
>>
>> So with the filtered-candidate-transformer attribute you can add an
>> "Add contact" candidate to the list of candidates if it is empty and
>> use the action-transformer attribute to change the action list if
>> this special candidate is the current selection.
>
> Hey, that's a very elegant solution.  I'll implement that in
> anything-config.el.

Done and uploaded.

@Tamas: Why is the `anything-pattern' cleared when you hit TAB on a
candidate?  I'd say it's a bug, isn't it?

Bye,
Tassilo
-- 
The  desire  to  be  rewarded  for one's  creativity  does  not  justify
depriving  the world  in  general of  all  or part  of that  creativity.
(Richard M. Stallman)



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-08-19 Thread Tassilo Horn
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:

Hi Tamas,

>> I just love the idea and the way it is currently working. I will try
>> to hack on it too to add my own sources.
>>
>> By the way, do you thing it is doable to add a contact just by
>> entering his name.
>>
>> Say for example, I am typing this after M-x anything RET:
>>
>> John Doe RET
>>
>> If John DOe is not in my contact base, I would like to be offered to
>> add it.
>
> Tassilo's solution is good, but I also fixed anything.el, so that
> filtered candidate transformer is run also if the candidate list is
> empty. This is is alternative solution.
>
> So with the filtered-candidate-transformer attribute you can add an
> "Add contact" candidate to the list of candidates if it is empty and
> use the action-transformer attribute to change the action list if this
> special candidate is the current selection.

Hey, that's a very elegant solution.  I'll implement that in
anything-config.el.

Bye,
Tassilo
-- 
  "Emacs is not a development tool but a way of life."
- David Kastrup in alt.religion.emacs -



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-08-19 Thread Tassilo Horn
Xavier Maillard <[EMAIL PROTECTED]> writes:

Hi Xavier,

> I just love the idea and the way it is currently working. I will try
> to hack on it too to add my own sources.

I'd be happy if you send me your sources so that I can add them in
anything-config.el.

> By the way, do you thing it is doable to add a contact just by
> entering his name.
>
> Say for example, I am typing this after M-x anything RET:
>
> John Doe RET
>
> If John DOe is not in my contact base, I would like to be offered to
> add it.

That's possible.  You need to redefine `anything-c-bbdb-candidates' so
that it adds a special "*Add to contacts*" entry.  Furthermore you need
to add a custom `match' function so that this special entry doesn't get
filtered out and an action that adds the current `anything-pattern' to
your bbdb.  But I really don't think that this would be more comfortable
than

M-x bbdb-create RET


or

C-x x bc RET

if you use my exec-abbrev-cmd.el.


> P.S: it would be cool to have a dedicated mailing list for anything as
> it is growing and this thread is err, really too big for this
> newsgroup, I guess.

Most of the time it's only Tamas, Bill and me discussing anything, so I
don't see a real cause for an extra list.  But maybe we should move over
to gnu.emacs.help or comp.emacs?

Bye,
Tassilo



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-08-19 Thread Tassilo Horn
Hi Bill,

bugs one and three should be fixed now.  For bug two, please tell me
exactly how you can reproduce it.  And do `M-x toggle-debug-on-error'
before.

Bye,
Tassilo
-- 
Chuck Norris runs on batteries. Specifically, Die Hards. 



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-08-19 Thread Tassilo Horn
[EMAIL PROTECTED] writes:

Hi Bill,

> I've been traveling the past week so have only just downloaded the
> latest versions of anything.el (revision 66) and anything-config.el
> (revision 34). I see that there have been some structural changes as
> well as some new functionality added. Unfortunately, a lot of things
> seem to be broken at the moment (yes, I have changed my .emacs to
> reflect the new anything-type-attributes layout and the new naming
> conventions). For example, here are a number of things that happen:
>
> 1. In the anything buffer, I press enter on a bbdb entry and am
> dropped into the debugger with the message "Debugger entered--Lisp
> error: (error "this command only works while in the \"*BBDB*\"
> buffer.")"

I can reproduce that.  Gosh, I thought I've fixed it...

> 2. I press TAB on ~/.bashrc in the anything buffer and am dropped into
> the debugger with the message "Debugger entered--Lisp error: (wrong-
> type-argument char-or-string-p action-transformer)"

That, I cannot reproduce.  I suspect it's a bug in your anything-sources
or anything-type-attributes.  Could you please post your settings?  And
which source is it that errors?

> 3. Files that match the regex in anything-c-boring-file-regexp are no
> longer being excluded (even though I have anything-c-skip-boring-files
> set up as a file candidate-transformer in my anything-type-attributes)

Oh, I can reproduce this, too.

I'll try to fix 1 and too right now.

Bye,
Tassilo
-- 
No person,  no idea, and no  religion deserves to be  illegal to insult,
not even the Church of Emacs. (Richard M. Stallman)



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-08-13 Thread Tassilo Horn
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:

Hi Tamas,

> One more unconventional example. :)

Indeed.

> It's an on-the-fly expression evaluator. You type the list expression
> and it shows the result instantly.
>
> (setq anything-sources
>   '(((name . "Calculation Result")
>  (requires-pattern)
>  (match (lambda (candidate)
>   t))
>  (candidates  "dummy")
>  (filtered-candidate-transformer .
>   (lambda (candidates source)
> (list
>  (condition-case nil
>  (prin1-to-string
>   (eval (read anything-pattern)))
>(error "error")
>  (action ("Do Nothing" . ignore)

I renamed it to "Evaluation Result" and added it.  And I added an
on-the-fly math expression evaluator using `calc-eval' as "Calculation
Result" source.

Bye,
Tassilo
-- 
VI VI VI - The Roman Number Of The Beast



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-08-07 Thread Tassilo Horn
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:

>> I think that would make sense.  But how would you go with sources
>> that don't have a type field?
>
> I plan to generalize source attributes, so that type would be a
> fallback for those attributes which are not specified by the source.
>
> So, for example, instead of using anything-candidate-transformers,
> candidate transformation would be a simple source attribute which the
> source could specify directly, or via its type.
>
> So instead of
>
> (setq anything-candidate-transformers
>   '((file . some-func)))
>
> it would either be
>
> (setq anything-sources '((name . "Some Source")
>  ...
>  (candidate-transformer . some-func)))
>
> or
>
> (setq anything-sources '((name . "Some Source")
>  ...
>  (type . file)))
>
> (setq anything-type-attributes
>   '((file ((candidate-transformer . some-func)
>...
>   )))

Shouldn't it be `candidate-transformers' and a list of transformer
functions?  Then there would be no need to add `some-func' whose only
purpose is to aggregate the effects of some other transformer functions.
Then I simply could say

(defvar anything-type-attributes
'((file . (candidate-transformers
   ((anything-c-shadow-boring-files
 anything-c-shorten-home-path
  ...))

> And it would be the same for anything-candidate-transformers and
> anything-action-transformers, so these would all be obsoleted.
>
> That's of course impacts anything-config.el heavily, so I only want to
> do it if you agree

I agree. I'm not too happy with the current approach because there's
quite a lot duplicate code for action and candidate transformers.

> and when you have the time to work on it.

Well, the changes are not too complex, so I think I could port it to the
new framework in two hours, say.  If you say that the new stuff won't
change in the next time, I'll do it.

> Naturally, everything will be backward compatible until the transition
> is complete, so I won't remove the existing framework until then.

Ok.

> I plan to do it in incremental steps. The first step will be
> generalizing anything-filtered-candidate-transformers. You don't use
> it yet in anything-config.el, so that's the simplest, and it will help
> to finalize the adaptive sorter.

Yeah, that would be good.  I haven't looked into these till now.  Could
you PING me when that's implemented and tell me what source could
benefit from it, so that I can implement it to get a feeling.

> When it's done then the rest can be done incrementally.
>
> What do you think of this plan?

I think it's a good idea, so lets do it. ;-)

Bye,
Tassilo
-- 
According to  the Bible,  God created the  universe in six  days. Before
that, Chuck Norris created God by snapping his fingers.



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-08-06 Thread Tassilo Horn
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:

Hi Tamas,

>> So it's an adaptive candidate sorter which learns which candidates
>> you select frequently and makes them more accessible for you.
>
> Currently, the history of selections is stored and used per source, so
> for example a different entry is stored when something is selected
> from the File Name History or Recentf and such stored entries are used
> only when sorting File Name History or Recentf, respectively.
>
> I vaguely remember there was some reason why I selected history
> handling by source, but now I don't really know what's the advantage.
> Shouldn't selection history be stored by type instead, so that for
> example a selection from any file providing source would contribute to
> the common knowledge of what files one selects most frequently?
>
> What do you think?

I think that would make sense.  But how would you go with sources that
don't have a type field?

BTW: I think I let anything-adaptive out of anything-config as long as
heavy changes and enhancements are likely to happen.  When stuff has
matured, I'm happy to include it.

Bye,
Tassilo
-- 
If Chuck Norris wants your opinion, he'll beat it into you. 



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-08-04 Thread Tassilo Horn
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:

Hi Tamas,

> Can't you do that with a defadvice?

Sure I can.

Bye,
Tassilo



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-08-04 Thread Tassilo Horn
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:

> Yeah, I also thought about the long names. Maybe the prefix should be
> simply anything-conf- or anything-c- or something.

Now it's anything-config- and it's acceptable.

Another thing: Could you provide a hook that is run after
anything-pattern changes but before the candidates are calculated?

Currently I'm implementing a source that lists functions by their
abbreviation first (as you suggested in your comment on emacswiki).  In
order to achieve that efficiently I need to recalculate the abbrev
regexp whenever the pattern changes.

Since `anything-update-hook' runs after the candidate calculation I
calculate the regexp in the match function currently and that is awfully
slow.

Bye,
Tassilo
-- 
According to Einstein's theory  of relativity, Chuck Norris can actually
roundhouse kick you yesterday.



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-08-04 Thread Tassilo Horn
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:

He Tamas,

> BTW, shouldn't all symbols (except those overwriting anything.el
> values) in anything-config be prefixed with anything-config- instead
> of simply anything- ?
>
> If they had been then functions wouldn't have overdefined each other
> in the first place and it could prevent possible clashes of symbols in
> the future.

That's true, but I boggled to do that because many names already are
quite longish. But I guess having longer names is much better than
having troubles because of redefinitions.

The next version will have anything prefixed with anything-config.

Bye,
Tassilo
-- 
Chuck Norris  does not  eat. Food understands  that the only  safe haven
from Chuck Norris' fists is inside his own body.



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-08-03 Thread Tassilo Horn
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:

Hi all,

the adaptive sorting thingy sounds great and of course I'm happy to
include it.  But this weekend is full of other tasks and I'm not even
sure if I have any network connection till monday, so this probably has
to wait a bit.

> I plan to remove all the example values and defuns from anything.el
> (except for anything-sources), since Tassilo does a great job with
> anything-config and there is no need to duplicate stuff.

Ah, that would be great.  After Bill told me that he had problems with
the latest changes in anything-config.el (I've removed the
eval-after-load [which was malformed, anyway] and required anything as
last operation in the file) I found out that I can choose between cancer
and pestilence:

  - If I load anything first, I cannot overwrite defvars, which is bad.
  - If I load anything after anything-config, all the defuns will be
redefined by anything which bad, too.

So in either case there are problems.

So if you remove the duplicate functions that would solve all problems
for us.  Could you please copy functions that are needed by
`anything-sources', e.g.  `anything-buffer-list' from anything-config?

I'm not sure, but I think that's the only one.  My version puts the
current buffer to the back of the list, so that you can easily switch
between two buffers without any keys except invoking anything and RET
(assuming the buffer source comes first).

I'll upload a new anything-config.el in 5 minutes that has a correctly
working eval-after-load to ensure that anything is loaded after
anything-config.  Everything should work fine when the functions that
are duplicated are removed from anything.el.

Have a nice weekend!
Tassilo
-- 
If programmers deserve to  be rewarded for creating innovative programs,
by the same  token they deserve to be punished if  they restrict the use
of these programs. (Richard M. Stallman)



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-08-03 Thread Tassilo Horn
[EMAIL PROTECTED] writes:

Hi Bill,

> Restoring the eval-after-load statement at the top of the code and
> eliminating the (require 'anything) at the bottom of the code fixes
> things.

But with the eval-after-load anything.el was loaded before
anything-config.el and then the keymaps of anything.el were used.

I think I have to read through the docs of eval-after-load a bit mare
carefully...

(I'll do that as soon as possible.)

Bye,
Tassilo
-- 
VI VI VI - The Roman Number Of The Beast



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-08-02 Thread Tassilo Horn
[EMAIL PROTECTED] writes:

Hi Bill,

> Great, that works nicely - thanks!
>
> Could you also add the following:
>   (define-key map (kbd "C-n")  'anything-next-line)
>   (define-key map (kbd "C-p")  'anything-previous-line)

Sure. Will be done and uploaded in 5 minutes.

Bye,
Tassilo
-- 
A child of five could understand this! Fetch me a child of five!



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-08-02 Thread Tassilo Horn
[EMAIL PROTECTED] writes:

Hi Bill,

>> Now you've heard it. I'll add an option that will define standard
>> keymaps before loading anything.el.
>>
>> What do you think should be its default? Standard keymaps would be more
>> logical for new users whereas the anything bindings would be good for
>> compatibility.
>
> IMO, the standard keymaps (if that means the ones with overrides
> similar to what you indicated above) should be the defaults since
> iswitchb isn't turned on by default in anything. Therefore, if someone
> decides to turn on iswitchb in their .emacs file, they can also turn
> on the iswitchb-compatible bindings.

Done! See the variable `anything-use-standard-keys'.

Bye,
Tassilo
-- 
The square  root of  Chuck Norris is  pain. Do  not try to  square Chuck
Norris, the result is death.



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-08-02 Thread Tassilo Horn
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:

Hi,

>> Is there some reason why the following 2 bindings aren't part of
>> anything-map:
>>
>> (define-key map (kbd "M-v") 'anything-previous-page)
>> (define-key map (kbd "C-v") 'anything-next-page)
>>
>
> The only reason is I saw no need, since it's very easy to customize
> the keyboard bindings.
>
> I don't use the default bindings either and I don't expect others to
> do so. People should tune them to their needs, similarly to anything
> sources, because there is no single default which would appeal to most
> users considering some use iswitchb and some doesn't and even those
> who do use it may or may not use
> anything-iswitchb-dont-touch-iswithcb- keys, etc.
>
> Actually, the thought already occurred to me anything-config could
> also offer custom keyboard configurations. For example, you could
> submit a configuration to Tassilo for people who prefer the standard
> Emacs bindings and don't use iswitchb, so they don't care if some of
> the bindings override iswitchb functions, because they don't use it.
>
> Similarly, other alternative keyboard configurations could also be
> offered and people simply would pick what they prefer.

IMHO it's faster to redefine the keymaps to whatever you like than to
read through three or for different keymap definitions to pick one that
fits only most of my needs.

As I don't use iswitchb I've overwritten those bindings:

(define-key anything-map (kbd "M-p") 'anything-previous-history-element)
(define-key anything-map (kbd "M-n") 'anything-next-history-element)
(define-key anything-map (kbd "C-s") 'anything-isearch)
(define-key anything-map (kbd "M-v") 'anything-previous-page)
(define-key anything-map (kbd "C-v") 'anything-next-page)
(define-key anything-isearch-map (kbd "C-s") 'anything-isearch-again)

On the other hand I think that using default keys by default would be
more sensible, because not too much people use iswitchb, I guess. So
maybe it'll be a good idea to add an option to anything-config.el that
defines standard keymaps.

> For example, I use a configuration which respects anything-iswitchb-
> dont-touch-iswithcb-keys, so I can use the standard iswitchb bindings,
> but override those bindings which I don't use in iswitchb.
>
>> I would also like to have the default bindings for "C-n" & "C-p" in
>> anything-map; however, I guess there's a conflict with binding "C-n"
>> since iswitchb binds it. However, "C-v" & "M-v" should be ok to bind.
>>
>> If there's no good reason not to bind them, could you please add them
>> to anything-map?
>
> Well, let's see first what Tassilo thinks about the idea above.

Now you've heard it. I'll add an option that will define standard
keymaps before loading anything.el.

What do you think should be its default? Standard keymaps would be more
logical for new users whereas the anything bindings would be good for
compatibility.

Bye,
Tassilo
-- 
Chuck Norris describes human beings as "a sociable holder for blood and guts". 



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-07-31 Thread Tassilo Horn
[EMAIL PROTECTED] writes:

Hi Bill,

>> Hey, that's nice. I'll integrate it in anything-config.el, but I'll
>> modify it a bit to have the same interface as the action
>> transformers.

Done!

> That would be nice - it would keep the action and candidate transform
> definitions consistent.

Yep.

> If you plan to add my code as an example transform, you probably
> should add "delete-dups" to it too:

No, I didn't do that, but you can easily add `delete-duplicates' as a
transformer to `anything-candidate-transformers-file'.

Not making it a default operation may save some processing costs for
users that don't need it.

Bye,
Tassilo
-- 
A morning without coffee is like something without something else.



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-07-31 Thread Tassilo Horn
[EMAIL PROTECTED] writes:

Hi Bill,

> (setq anything-transform-files-excludes (list "/Applications/cache/"
> "/.backups"
> "/.svn"
> "/CVS"
> "/.DS_Store"
> "/.cvsignore"))
>
> (defun anything-transform-files (files)
>   "Transform file candidates."
>
>   (if anything-transform-files-excludes
>   (setq files (let ((filtered-files nil))
>   (loop for file in files
> do (if (loop for regexp in 
> anything-transform-files-excludes
>  do (if (string-match regexp file) 
> (return nil))
>  finally (return file))
>(setq filtered-files (append (list file) 
> filtered-files)))
> finally (return filtered-files)
>
>   (let ((boring-file-regexp
>  (concat "\\(?:" (regexp-opt completion-ignored-extensions) "\
> \)\\'")))
> (mapcar (lambda (file)
>   ;; Add shadow face property to boring files.
>   (let ((face (if (facep 'file-name-shadow)
>   'file-name-shadow
> ;; fall back to default on XEmacs
> 'default)))
> (if (string-match boring-file-regexp file)
> (setq file (propertize file 'face face
>
>   ;; replace path of HOME directory in paths with the
> string
>   ;; 
>   (let ((home (replace-regexp-in-string "" "/" ;
> stupid Windows...
> (getenv "HOME"
> (if (string-match home file)
> (cons (replace-match "" nil nil file) file)
>   file)))
> files)))

Hey, that's nice. I'll integrate it in anything-config.el, but I'll
modify it a bit to have the same interface as the action transformers.

Bye,
Tassilo
-- 
The movie "Delta Force" was extremely  hard to make because Chuck had to
downplay his abilities. The first few cuts were completely unbelievable.



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-07-28 Thread Tassilo Horn
[EMAIL PROTECTED] writes:

Hi Bill,

> (defvar anything-locate-options (if (eq system-type 'darwin)
>   '("locate")
> '("locate" "-i " "-r"))
>   "A list where the `car' is the name of the locat program
> followed by options. The search pattern will be appended, so the
> \"-r\" option should be the last option.")

Added.

Bye,
Tassilo
-- 
A morning without coffee is like something without something else.



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-07-28 Thread Tassilo Horn
[EMAIL PROTECTED] writes:

Hi Bill,

> It looks like anything-source-imenu was the cause of problems #1, #2,
> & #3. A #4 issue that occurs with the anything-source-imenu code in
> anything-config.el is that it causes anything to not work if you call
> anything in a dired buffer. I've commented out the definition in
> anything-config.el and put the following replacement definition for
> anything-source-imenu in my .emacs file - it works ok for me and
> eliminates the 4 problems:

[...]

Thanks, I'll take your version. The imenu thing didn't work for me, too,
and I wanted to take it out again, because it only works if you invoke
anything from source cod buffers.

Thanks,
Tassilo
-- 
People sometimes  ask me if it  is a sin in  the Church of  Emacs to use
vi. Using a free  version of vi is not a sin; it  is a penance. So happy
hacking. (Richard M. Stallman)



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-07-27 Thread Tassilo Horn
Hi,

now there are the variables

anything-action-transformers-file
anything-action-transformers-buffer
anything-action-transformers-function
...

which should be lists of functions with parameters ACTIONS (the list of
actions so far) and CANDIDATE (the selected file / buffer / function /
...). Those functions may modify the list of actions somehow and return
it.

The function

anything-transform-file-actions

calls each function in `anything-action-transformers-file' and builds
the list of actions then. It's the same for all other types.

So now you can easily write transformer function an add them to the
appropriate `anything-action-transformers-TYPE' list.

Bye,
Tassilo
-- 
Every time  Chuck Norris  smiles, someone dies.  Unless he  smiles while
he's roundhouse kicking someone in the face. Then two people die.



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-07-27 Thread Tassilo Horn
[EMAIL PROTECTED] writes:

Hi Bill,

>>> (defmacro anything-add-to-actions (var action)
>>>   `(setq ,var (cons (car ,var)
>>> (append
>>>  (cdr ,var)
>>>  (list ',action)
>>
>> Yep, that looks nice. I made some little changes, so that multiple
>> evaluations don't add an action several times and added
>> documentation.
>
> Thanks for adding it to anything-config.el - that's one less thing I
> need to have in my .emacs file! ;-)

Yesterday I enhanced it so that it can add an action to both a source or
a type actions variable. See its docstring for examples.

> An alternative would be to provide (in anything-config.el) a
> "standard" transformer function for a "type" and some example
> transforms that others can model their transforms after. For example,
> for the file transforms:
>
> (defvar anything-transform-actions-file nil "Transforms for files.")
>
> (defun anything-transform-file-actions (actions candidate)
>   "Append useful actions to the list of actions."
>   (when (and (listp actions)
>anything-transform-actions-file)
> (loop for func in anything-transform-actions-file
> do (setq actions (or (funcall func actions candidate) actions))
> finally (return actions
>
> (setq anything-transform-actions-file
>   (append anything-transform-actions-file
> '((lambda (actions candidate)
> (if (or (string= (file-name-extension candidate) "el")
> (string= (file-name-extension candidate) "elc"))
> (append actions '(("Load Emacs Lisp File" . 
> load-file
>
> (setq anything-transform-actions-file
>   (append anything-transform-actions-file
> '((lambda (actions candidate)
> (if (string= "darwin" (symbol-name system-type))
> (append actions
> '(("Open File with default Tool" .
>(lambda (filename)
>  (call-process "/usr/bin/open" nil 0 nil 
> filename))
>
> Then, it's just a matter of appending additonal transformers to the
> list.
>
> What do you think?

I've though about it already, and it's clear to me that some mechanism
like that has to be implemented. I'll give it a try today.

Bye,
Tassilo
-- 
Little  Miss Muffet  sat on  her tuffet,  until Chuck  Norris roundhouse
kicked her into a glacier.



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


exec-abbrev-cmd.el: Execute commands by giving an abbreviation

2007-07-26 Thread Tassilo Horn
Hi all,

because there are some commands I use quite regularly but not often
enough to justify a global keybinding, I hacked up this little
mode. Have fun with it!

--8<---cut here---start->8---
;;; exec-abbrev-cmd.el --- Execute commands by giving an abbreviation

;; Copyright 2007 Tassilo Horn
;;
;; Author: Tassilo Horn <[EMAIL PROTECTED]>
;; Version: 0.1
;; Homepage: http://www.tsdh.de/repos/darcs/elisp/exec-abbrev-cmd.el

;; This  program is free  software; you  can redistribute  it and/or  modify it
;; under the terms  of the GNU General Public License as  published by the Free
;; Software  Foundation;  either version  3,  or  (at  your option)  any  later
;; version.
;;
;; This program is distributed in the  hope that it will be useful, but WITHOUT
;; ANY  WARRANTY;  without even  the  implied  warranty  of MERCHANTABILITY  or
;; FITNESS FOR  A PARTICULAR PURPOSE.  See  the GNU General  Public License for
;; more details.
;;
;; You should have received a copy of the GNU General Public License along with
;; this program; if not, write to  the Free Software Foundation, Inc., 675 Mass
;; Ave, Cambridge, MA 02139, USA.

;;; Commentary:

;; This file  includes the command  `exec-abbrev-cmd' which lets you  execute a
;; command by  giving it in an  abbreviated form, where  the abbreviation takes
;; the first character of each word in the command name.  For example "g" is an
;; abbreviation  for   the  command  `gnus',   "eb"  is  an   abbreviation  for
;; `emms-browser'  and "omm"  is an  abbreviation for  `outline-minor-mode'. Of
;; course  it  is possible,  that  an  abbreviation  matches several  commands,
;; e.g. "g" matches  not only `gnus' but `grep', `gdb' and  some more.  In such
;; cases you will be queried, which command to use.
;;
;; To have this  functionality quickly accessible you might want  to bind it to
;; some key.  That's what I use:
;;
;; (add-to-list 'load-path "~/elisp") ;; Where is exec-abbrev-cmd.el?
;; (require 'exec-abbrev-cmd) ;; Load it.
;; (global-set-key (kbd "C-x x") 'exec-abbrev-cmd)
;;
;; Now you'll say,  "Wow, what a nice feature!", but  it's even getting better.
;; Let's say  you often invoke  `customize-face' with `C-x  x cf RET'  and then
;; choosing from the completion  list between `copy-file' and `customize-face'.
;; Always `copy-file' is selected  first, because it's lexicographically before
;; `customize-face'. Asasolutionto   thisproblemthere's
;; `exec-abbrev-cmd-mode', a global minor  mode that does bookkeeping how often
;; you invoke  a command with `exec-abbrev-cmd',  so that the  list of commands
;; you have  to choose from is  sorted by the frequency  of command invokation.
;; After a while in most cases `C-x x  RET RET' will do what you want.
;;
;; If you want to enable this feature put this in your ~/.emacs:
;;
;; (exec-abbrev-cmd-mode 1)
;;
;; Have fun!

;;; Notes:

;; You should have a look  at `partial-completion-mode' which comes with emacs,
;; too. I like this  mode better because `partial-completion-mode' doesn't play
;; well with `ido-mode', but your mileage may vary.

;;; History:

;; Version 0.1: initial release

;;; Code:

(require 'cl)  ;; for remove-if-not
(require 'ido) ;; for ido-completing-read

(defvar exec-abbrev-cmd-file "~/.emacs.d/exec-abbrev-cmd.el"
  "The file where `exec-abbrev-cmd-alist' will be saved.")

(defvar exec-abbrev-cmd-alist
  (with-temp-buffer
(if (not (file-exists-p exec-abbrev-cmd-file))
nil
  (insert-file-contents exec-abbrev-cmd-file)
  (read (current-buffer
  "An alist with items of the form (COMMAND . NO-OF-EXECUTIONS)
that will be used to sort the possible completions of
`exec-abbrev-cmd' so that most frequently commands come first.")

(defun exec-abbrev-cmd-record (command)
  "Record the execution of COMMAND to `exec-abbrev-cmd-alist'."
  (let ((pair (assq command exec-abbrev-cmd-alist)))
(if (not pair)
;; Command was never used till now
(push (cons command 1) exec-abbrev-cmd-alist)
  ;; Ok, it's in, so we need to increase NO-OF-EXECUTIONS.
  (setq exec-abbrev-cmd-alist
(cons (cons command (1+ (cdr pair)))
  (delete pair exec-abbrev-cmd-alist))

(defun exec-abbrev-cmd-save ()
  "Save `exec-abbrev-cmd-alist' to `exec-abbrev-cmd-file'."
  (with-temp-buffer
(print exec-abbrev-cmd-alist (current-buffer))
(write-file exec-abbrev-cmd-file)))

(defun exec-abbrev-cmd-more-frequently-used-p (c1 c2)
  "Return t if C1 should be sorted before C2.
That is if C1 was more frequently used than C2 or both were used
equally often."
  

Re: ;;; anything.el --- open anything

2007-07-25 Thread Tassilo Horn
[EMAIL PROTECTED] writes:

Hi Bill,

> Actually, the macro should be:
>
> (defmacro anything-add-to-actions (var action)
>   `(setq ,var (cons (car ,var)
>   (append
>(cdr ,var)
>(list ',action)

Yep, that looks nice. I made some little changes, so that multiple
evaluations don't add an action several times and added documentation.

Thanks a lot,
Tassilo
-- 
[Emacs] is written in Lisp, which is the only computer language that is
beautiful.  -- Neal Stephenson, _In the Beginning was the Command Line_



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-07-24 Thread Tassilo Horn
[EMAIL PROTECTED] writes:

Hi Bill,

> Where is the repository for anything-config.el? I found an emacs wiki
> page - is that it?

The page on emacswiki that lists all this is

  http://www.emacswiki.org/cgi-bin/wiki/Anything

> Also, what is the best forum for posting mods to anything-config.el?

You can poste additions on that wiki page. If you want to modify
existing code, please clone the git repository and send me a patch or
the url of your repository, so that I can pull your changes.

> Isn't gnu.emacs.sources just supposed to be for source posting and not
> discussions?

Hm, I don't know. Maybe comp.emacs would be more appropriate, or
gnu.emacs.help? (Does anything work on XEmacs?)

> I've added a Mac-specific action to my anything-actions-file:
> ("Open File with default Tool" . (lambda (filename)
>   (call-process "/usr/bin/open" nil 0
> nil filename)))

As open is not the default tool on all platforms, I thinkt the current
behavior of `anything-actions-file' is better. But you can

  (setq anything-external-commands-list '("open"))

so that you save some processing time and only get "open" as completion
possibility when you choose

  "Open File with external Tool".

> And, an action to find the source of an emacs function to the
> anything-actions-function file:
> ("Find Function" . (lambda (command-name)
> (find-function (intern command-name

Yes, why not? Of course fou could choose "Describe Function" and then
hit RET on the link...

But I'll add it.

Bye,
Tassilo
-- 
Chuck Norris does, in fact, live in a round house. 



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-07-24 Thread Tassilo Horn
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:

Hi Tamas,

>> I think it happens only if your start anything when then *anything*
>> buffer is current. Did you try it like this too?

Now I did so and it worked as expected.

> Hmm, my bug doesn't occur here anymore, so your bug is about something
> else. I can only do something with it if there is a way to reproduce
> it. I haven't encountered this assertion for quite a while.

Ok, the next time it happens I hope to find a way to reproduce it.

Bye,
Tassilo
-- 
Chuck Norris' tears cure cancer. Too bad he has never cried. Ever. 



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-07-24 Thread Tassilo Horn
Hi Tamas,

there's a little bug in anything.el. Sometimes when I invoke it several
times it'll error:

Debugger entered--Lisp error: (cl-assertion-failed header-pos)
  signal(cl-assertion-failed (header-pos))
  (or header-pos (signal (quote cl-assertion-failed) (list ...)))
  (progn (or header-pos (signal ... ...)) nil)
  (assert header-pos)
  (save-excursion (assert header-pos) (goto-char header-pos) 
(buffer-substring-no-properties (line-beginning-position) (line-end-position)))
  (let* ((header-pos ...) (source-name ...) (source ...) (action ...) (type 
...)) (unless action (unless type ...) (setq action ...)) (let* (...) (if 
transformer ... action)))
  (save-current-buffer (set-buffer anything-buffer) (let* (... ... ... ... ...) 
(unless action ... ...) (let* ... ...)))
  (with-current-buffer anything-buffer (let* (... ... ... ... ...) (unless 
action ... ...) (let* ... ...)))
  (if (= (buffer-size ...) 0) nil (with-current-buffer anything-buffer (let* 
... ... ...)))
  (unless (= (buffer-size ...) 0) (with-current-buffer anything-buffer (let* 
... ... ...)))
  anything-get-action()
  (if anything-saved-sources (anything-get-selection) (anything-get-action))
  (let* ((selection ...) (action ...)) (if (anything-list-but-not-lambda-p 
action) (setq action ...)) (if (and selection action) (funcall action 
selection)))
  anything-execute-selection-action()
  anything()
  call-interactively(anything)

If I kill the *anything* buffer it works again.

Bye,
Tassilo
-- 
People sometimes  ask me if it  is a sin in  the Church of  Emacs to use
vi. Using a free  version of vi is not a sin; it  is a penance. So happy
hacking. (Richard M. Stallman)



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-07-23 Thread Tassilo Horn
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:

Hi Tamas,

>> this may be useful for use in programming modes, but the candidate
>> creation function doesn't work here with a current CVS emacs. The
>> alist returned by `imenu--make-index-alist' has a different structure
>> than your code assumes, so that the `remove-if-not' always returns
>> nil.
>
> It worked with stable Emacs 22. Maybe it should be defined with
> version conditional (= emacs-major-version 22) if it's version
> dependent and someone will make a version for CVS Emacs (Emacs 23?)
> too if there is a need.

I use emacs 22, too. So it seems there is a change since the release of
emacs 22.1 and the current HEAD that is 22.1.50.1.

Bye,
Tassilo
-- 
In honor  of Chuck Norris, all  McDonald's in Texas have  an even larger
size than the super-size. When ordering, just ask to be "Norrisized".



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-07-23 Thread Tassilo Horn
Hi Tamas,

this may be useful for use in programming modes, but the candidate
creation function doesn't work here with a current CVS emacs. The alist
returned by `imenu--make-index-alist' has a different structure than
your code assumes, so that the `remove-if-not' always returns nil.

Bye,
Tassilo
-- 
 My software never has bugs. It just develops random features.



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-07-23 Thread Tassilo Horn
Tassilo Horn <[EMAIL PROTECTED]> writes:

Hi,

>> |   Recentf files
>> |  
>> |  (defvar anything-source-recentf
>> |'((name . "Recentf")
>> | -(candidates . recentf-list)
>> | +(candidates . (lambda ()
>> | +(ba-remove-duplicates-resolve-home recentf-list)))
>> |  (type . file)))
>
> For recent files, that's a good idea. I'll include it with
> `remove-duplicates' instead of `ba-remove-duplicates-resolve-home'.

It seems that recentf deletes duplicates by default.

Bye,
Tassilo
-- 
Thousands  of years  ago Chuck  Norris  came across  a bear.  It was  so
terrified that it  fled north into the arctic. It  was also so terrified
that all of its decendents now have white hair.



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-07-23 Thread Tassilo Horn
Benjamin Andresen <[EMAIL PROTECTED]> writes:

Hi Benjamin,

> I'm just going to post my (small) patches to anything (config mainly)
>
> I'm more interested in your feedback than in the inclusion, because
> the gnus one needs a small hack to work when gnus isn't running.  And
> it's obviously tinkered to my liking. (Opera ;-))
>
> The hack for gnus:
> (setq gnus-topic-alist nil), otherwise anything will complain that the
> variable is void.
>
> ,[ diff -u anything-config.el.1 anything-config.el ]
> | --- anything-config.el.12007-07-22 13:26:10.0 +0200
> | +++ anything-config.el  2007-07-22 22:27:23.0 +0200
> | @@ -58,14 +58,16 @@
> |  
> |  (defvar anything-source-file-name-history
> |'((name . "File Name History")
> | -(candidates . file-name-history)
> | +(candidates . (lambda ()
> | +(ba-remove-duplicates-resolve-home file-name-history)))
> |  (type . file)))

You can suppress duplicates in thi file-name-history with

,[ C-h v history-delete-duplicates RET ]
| history-delete-duplicates is a variable defined in `C source code'.
| Its value is t
| 
| 
| Documentation:
| *Non-nil means to delete duplicates in history.
| If set to t when adding a new history element, all previous identical
| elements are deleted from the history list.
| 
| You can customize this variable.
`

> |   Recentf files
> |  
> |  (defvar anything-source-recentf
> |'((name . "Recentf")
> | -(candidates . recentf-list)
> | +(candidates . (lambda ()
> | +(ba-remove-duplicates-resolve-home recentf-list)))
> |  (type . file)))

For recent files, that's a good idea. I'll include it with
`remove-duplicates' instead of `ba-remove-duplicates-resolve-home'.

> |   Files in current dir
> | @@ -126,7 +128,8 @@
> | "locate" "-i" "-r"
> | anything-pattern)))
> |  (type . file)
> | -(requires-pattern . 3))
> | +(requires-pattern . 3)
> | +(delayed))
> |"Source for retrieving files matching the current input pattern
> |with locate.")

That's a matter of taste, I guess.

> | @@ -212,6 +215,91 @@
> | 
> (anything-external-commands-list-1))
> |file))
> |  
> | +;;; Benny own thingies.
> | +
> | +(defvar anything-source-gnus
> | +  '((name . "Gnus")
> | +(candidates . (lambda ()
> | +(remove-duplicates
> | +  (apply 'append
> | + (mapcar 'cdr
> | + gnus-topic-alist))
> | +  :test #'equal)))
> | +(action . (lambda (x)
> | +(gnus-group-read-group nil nil x)

That won't work if you don't use gnus-topic-mode, I guess.

Bye,
Tassilo
-- 
[Emacs] is written in Lisp, which is the only computer language that is
beautiful.  -- Neal Stephenson, _In the Beginning was the Command Line_



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-07-22 Thread Tassilo Horn
Tassilo Horn <[EMAIL PROTECTED]> writes:

> Hi Vagn,
>
>>> Should I add this source to anything-config.el?
>>
>> Yes. Call it anything-source-mac-spotlight instead. Few people know
>> about mdfind. I only discovered it by accident.
>
> Ok.
>
>> Also I think you should remove the "Delete File" action in
>> anything-actions-file.
>
> At least I use it sometimes, but sorting in a dired action is a good
> idea, anyway.
>
>> It is more generic to go to a dired buffer:
>>
>>  ("Dired" . (lambda (filename)
>>   (dired (file-name-directory filename))
>>   (dired-goto-file filename)))
>>
>> Deleting a file in Dired also checks if a corresponding buffer is open
>> and offers to kill it.
>
> I could implement this behavior for "Delete File", too.
>
> Bye and thanks for the contribution,
> Tassilo

DONE!

Bye,
Tassilo
-- 
Little known  medical fact: Chuck Norris invented  the Caesarean section
when he roundhouse-kicked his way out of his monther's womb.



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-07-22 Thread Tassilo Horn
Vagn Johansen <[EMAIL PROTECTED]> writes:

Hi Vagn,

>> Should I add this source to anything-config.el?
>
> Yes. Call it anything-source-mac-spotlight instead. Few people know
> about mdfind. I only discovered it by accident.

Ok.

> Also I think you should remove the "Delete File" action in
> anything-actions-file.

At least I use it sometimes, but sorting in a dired action is a good
idea, anyway.

> It is more generic to go to a dired buffer:
>
>  ("Dired" . (lambda (filename)
>   (dired (file-name-directory filename))
>   (dired-goto-file filename)))
>
> Deleting a file in Dired also checks if a corresponding buffer is open
> and offers to kill it.

I could implement this behavior for "Delete File", too.

Bye and thanks for the contribution,
Tassilo
-- 
When Chuck Norris talks, everybody listens. And dies. 



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-07-22 Thread Tassilo Horn
Vagn Johansen <[EMAIL PROTECTED]> writes:

Hi Vagn,

> Just use the locate-like program mdfind.
>
> (defvar anything-source-mdfind
>   '((name . "mdfind")
>  (candidates . (lambda ()
>  (start-process "mdfind-process" nil
>"mdfind" anything-pattern)))
>  (action . (("Find file" . find-file)
>  ("Open" . 
>(lambda (file-name)
>  (shell-command
>(concat "open " (shell-quote-argument file-name))
>nil)
>  (type . file)
>  (requires-pattern . 3))
>   "Source for retrieving files via mdfind.")
>
> (add-to-list 'anything-sources anything-source-mdfind)

Should I add this source to anything-config.el?

Bye,
Tassilo
-- 
The  desire  to  be  rewarded  for one's  creativity  does  not  justify
depriving  the world  in  general of  all  or part  of that  creativity.
(Richard M. Stallman)



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-07-21 Thread Tassilo Horn
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:

Hi Tamas,

>> That's nice, really nice. I'll have a lot of fun adding stuff to
>> anything-config.el.
>
> BTW, don't you want to be in charge of anything-config.el?

Yes, why not? I'll create a emacswiki page for anything.el tomorrow (if
the weather is as bad as the news said).

> It may be better if its development is coordinated rather than
> everyone hacking away on it randomly.
>
> You seem to be suitable for the job if you're interested. ;)

Sure, I am.

Bye,
Tassilo
-- 
Most people fear the Reaper. Chuck Norris considers him "a promising Rookie". 



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-07-21 Thread Tassilo Horn
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:

Hi Tamas,

[snip]

> Now, how's THAT sound? ;)

That's nice, really nice. I'll have a lot of fun adding stuff to
anything-config.el. Who needs Spotlight if he has emacs, right? ;-)

Best regards,
Tassilo
-- 
No person,  no idea, and no  religion deserves to be  illegal to insult,
not even the Church of Emacs. (Richard M. Stallman)



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-07-20 Thread Tassilo Horn
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:

Hi Tamas,

> So, regarding the repository you suggested. I won't have too much time
> work on anything in the future, so I want to concentrate on the
> platform itself (anything.el) and let interested users to come up with
> ways to utilize it.

The problem with that no-vc-approach is, that users who extend
anything.el to fit their needs will have to redefine a bunch of
variables, e.g.

  (setq anything-sources '((...)))
  (setq anything-type-actions '((...)))

and so forth. If you now add a bugfix or little change to the original
definition, that won't propagate to the users. So I'd recommend to use a
distributed vc system nevertheless. Then any hackish user could use
their own branches and sync painlessly to incorporate the changes you
made.

To make anything.el better suited for extending it on the user side I'd
recommend to clean it up a bit, e.g. the example sources in
`anything-sources' should all be defined with `anything-source-FOO'
variables and the same for `anything-type-actions'.

Since you don't have "too much time" I volunteer to create a repository
for you and to make those little cleanups during this weekend.

How does that sound? C'mon, that's a offer you cannot decline. :-)

Bye,
Tassilo
-- 
  "Emacs is not a development tool but a way of life."
- David Kastrup in alt.religion.emacs -



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-07-20 Thread Tassilo Horn
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:

> On Jul 20, 12:05 pm, Tassilo Horn <[EMAIL PROTECTED]> wrote:
>> Hey Tamas,
>>
>> this patch adds a new buffer type with actions to switch or pop to it,
>> just displaying it or killing it.
>>
>
> Thanks! I added it to the code.

Yippie!

And here's a bit more. With this patch (against the current emacs wiki
version, I got it 5 mins ago) it's possible to open completions of type
file with an external tool. The external tools are completed like in
eshell, but with the advantage, that the calculation is only performed
once. It can be disabled completely by the user if she sets
`anything-external-commands-list' to a list of completions,
e.g. '("gimp" "xpdf" "gv").

This allows the user to use anything.el as application starter (best
used with the locate source).

And another thing: Would you mind setting up a repository for
anything.el, possibly with git, darcs or another distributed version
control system? I think it has a lot of potential, attracts many new
developers and would ease managing and distributing patchsets. The emacs
wiki file could then be used as a stable version.

If you don't have an account on some server, I'd be happy to set up an
account for you on www.tsdh.de.

Bye,
Tassilo

--8<---cut here---start->8---
diff -u /home/heimdall/elisp/anything.el.orig /home/heimdall/elisp/anything.el
--- /home/heimdall/elisp/anything.el.orig   2007-07-20 18:38:59.0 
+0200
+++ /home/heimdall/elisp/anything.el2007-07-20 18:40:06.0 +0200
@@ -58,7 +58,7 @@
 ;; This is only an example. Customize it to your own taste!
 (defvar anything-sources `(((name . "Buffers")
 (candidates . anything-buffer-list)
-   (type . buffer))
+(type . buffer))
 
((name . "File Name History")
 (candidates . file-name-history)
@@ -187,6 +187,50 @@
   character typed, only if the user hesitates a bit.")
 
 
+(defvar anything-external-commands-list nil
+  "A list of all external commands the user can execute. If this
+variable is not set by the user, it will be calculated
+automatically.")
+
+
+(defun anything-external-commands-list-1 ()
+  "Returns a list of all external commands the user can execute.
+
+If `anything-external-commands-list' is non-nil it will return
+its contents. Else it calculates all external commands and sets
+`anything-external-commands-list'.
+
+The code is ripped out of `eshell-complete-commands-list'."
+  (if anything-external-commands-list
+  anything-external-commands-list
+(setq anything-external-commands-list
+  (let* ((paths (split-string (getenv "PATH") path-separator))
+ (cwd (file-name-as-directory
+   (expand-file-name default-directory)))
+ (path "") (comps-in-path ())
+ (file "") (filepath "") (completions ()))
+;; Go thru each path in the search path, finding completions.
+(while paths
+  (setq path (file-name-as-directory
+  (expand-file-name (or (car paths) ".")))
+comps-in-path
+(and (file-accessible-directory-p path)
+ (file-name-all-completions "" path)))
+  ;; Go thru each completion found, to see whether it should be
+  ;; used, e.g. see if it's executable.
+  (while comps-in-path
+(setq file (car comps-in-path)
+  filepath (concat path file))
+(if (and (not (member file completions))
+ (or (string-equal path cwd)
+ (not (file-directory-p filepath)))
+ (file-executable-p filepath))
+(setq completions (cons file completions)))
+(setq comps-in-path (cdr comps-in-path)))
+  (setq paths (cdr paths)))
+completions
+
+
 ;; This value is only provided as an example. Customize it to your own
 ;; taste!
 (defvar anything-type-actions
@@ -194,12 +238,19 @@
  ("Delete File" . (lambda (file)
 (if (y-or-n-p (format "Really delete file %s? "
   file))
-(delete-file file))
+(delete-file file
+ ("Open File with external Tool" .
+  (lambda (file)
+(start-process "anything-open-file-externally"
+   nil
+

Re: ;;; anything.el --- open anything

2007-07-20 Thread Tassilo Horn
Hi,

this one adds the possibility to describe an emacs command to
`anything-source-emacs-commands'.

--8<---cut here---start->8---
diff -u /home/heimdall/elisp/anything.el.orig /home/heimdall/elisp/anything.el
--- /home/heimdall/elisp/anything.el.orig   2007-07-20 12:00:26.0 
+0200
+++ /home/heimdall/elisp/anything.el2007-07-20 16:26:31.0 +0200
@@ -58,8 +58,7 @@
 ;; This is only an example. Customize it to your own taste!
 (defvar anything-sources `(((name . "Buffers")
 (candidates . anything-buffer-list)
-(action . (("Switch to Buffer" . switch-to-buffer)
-   ("Kill Buffer" . kill-buffer
+(type . buffer))
 
((name . "File Name History")
 (candidates . file-name-history)
@@ -195,7 +194,11 @@
  ("Delete File" . (lambda (file)
 (if (y-or-n-p (format "Really delete file %s? "
   file))
-(delete-file file)))
+(delete-file file))
+(buffer . (("Switch to Buffer" . switch-to-buffer)
+   ("Pop to Buffer". pop-to-buffer)
+   ("Display Buffer"   . display-buffer)
+   ("Kill Buffer"  . kill-buffer
   "A list of (TYPE . ACTION) pairs specifying actions for sources
   which have no action defined. See the `action' attribute of
   `anything-sources' for possible action values.")
@@ -291,8 +294,12 @@
  (push (symbol-name a) 
commands 
  (sort commands 'string-lessp))) 
-(action . (lambda (command-name) 
-(call-interactively (intern command-name)
+(action . (("Execute Command" . (lambda (command-name) 
+  (call-interactively
+   (intern command-name
+   ("Describe Command" . (lambda (command-name)
+   (describe-function
+(intern command-name)))
   "Source for completing and invoking Emacs commands.")
 
 

Diff finished.  Fri Jul 20 16:27:22 2007
--8<---cut here---end--->8---

Bye,
Tassilo
-- 
VI VI VI - The Roman Number Of The Beast



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-07-20 Thread Tassilo Horn
Ups,

there was a paren bug in the patch. This one is correct:

--8<---cut here---start->8---
diff -u /home/heimdall/elisp/anything.el.orig /home/heimdall/elisp/anything.el
--- /home/heimdall/elisp/anything.el.orig   2007-07-20 12:00:26.0 
+0200
+++ /home/heimdall/elisp/anything.el2007-07-20 16:11:26.0 +0200
@@ -58,8 +58,7 @@
 ;; This is only an example. Customize it to your own taste!
 (defvar anything-sources `(((name . "Buffers")
 (candidates . anything-buffer-list)
-(action . (("Switch to Buffer" . switch-to-buffer)
-   ("Kill Buffer" . kill-buffer
+(type . buffer))
 
((name . "File Name History")
 (candidates . file-name-history)
@@ -195,7 +194,11 @@
  ("Delete File" . (lambda (file)
 (if (y-or-n-p (format "Really delete file %s? "
   file))
-(delete-file file)))
+(delete-file file))
+(buffer . (("Switch to Buffer" . switch-to-buffer)
+   ("Pop to Buffer". pop-to-buffer)
+   ("Display Buffer"   . display-buffer)
+   ("Kill Buffer"  . kill-buffer
   "A list of (TYPE . ACTION) pairs specifying actions for sources
   which have no action defined. See the `action' attribute of
   `anything-sources' for possible action values.")

Diff finished.  Fri Jul 20 16:11:58 2007
--8<---cut here---end--->8---

Bye,
Tassilo
-- 
Wenn Windows die Lösung ist, kann ich dann bitte
   das Problem zurück haben?



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-07-20 Thread Tassilo Horn
Hey Tamas,

this patch adds a new buffer type with actions to switch or pop to it,
just displaying it or killing it.

--8<---cut here---start->8---
diff -u /home/heimdall/elisp/anything.el.orig /home/heimdall/elisp/anything.el
--- /home/heimdall/elisp/anything.el.orig   2007-07-20 12:00:26.0 
+0200
+++ /home/heimdall/elisp/anything.el2007-07-20 11:59:14.0 +0200
@@ -58,8 +58,7 @@
 ;; This is only an example. Customize it to your own taste!
 (defvar anything-sources `(((name . "Buffers")
 (candidates . anything-buffer-list)
-(action . (("Switch to Buffer" . switch-to-buffer)
-   ("Kill Buffer" . kill-buffer
+(type . buffer))
 
((name . "File Name History")
 (candidates . file-name-history)
@@ -195,7 +194,11 @@
  ("Delete File" . (lambda (file)
 (if (y-or-n-p (format "Really delete file %s? "
   file))
-(delete-file file)))
+(delete-file file))
+(buffer . (("Switch to Buffer" . switch-to-buffer)
+   ("Pop to Buffer". pop-to-buffer)
+   ("Display Buffer"   . display-buffer)
+   ("Kill Buffer"  . kill-buffer)
   "A list of (TYPE . ACTION) pairs specifying actions for sources
   which have no action defined. See the `action' attribute of
   `anything-sources' for possible action values.")

Diff finished.  Fri Jul 20 12:00:44 2007
--8<---cut here---end--->8---

Bye,
Tassilo
-- 
A child of five could understand this! Fetch me a child of five!



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-07-17 Thread Tassilo Horn
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:

Hi Tamas,

>> I added a new asynchronous source for the tracker desktop search,
>> too, see `anything-source-tracker-search'. That's quite identical to
>> the locate source, but it doesn't refresh after the pattern
>> changes. It won't be displayed at all after the pattern changes after
>> the first search. Do you know what the problem could be?
>
> I don't really understand the problem. You used (requires-pattern .
> 3), so results from the source are shown only of there is a pattern
> and it's at least 3 characters long.

Ups, sorry. That was a misconfiguration in my ~/.emacs file. I had my
old attempt at the tracker search _and_ ,anything-source-tracer-search
in `anything-sources'. That confused `anything', but after deleting the
old version it works very nice.

Bye,
Tassilo
-- 
A morning without coffee is like something without something else.



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-07-17 Thread Tassilo Horn
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:

Hi Tamas,

>>   - Use a custom face for the headlines in the *anything* buffer. I saw
>> that was mentioned earlier and I'm ok with the "first functionality,
>> then eye-candy" approach.
>
> Eye candy gets implemented faster if patches are submitted. ;)

Ok, here's a patch that makes anything-header-face a face you can
customize with `customize-face'. By default it's bold and underlined.

In addition to that I reversed the args of `anything-source-locate' so
that the pattern follows directly the "-r" to make it work with GNU
slocate 3.1.

I added a new asynchronous source for the tracker desktop search, too,
see `anything-source-tracker-search'. That's quite identical to the
locate source, but it doesn't refresh after the pattern changes. It
won't be displayed at all after the pattern changes after the first
search. Do you know what the problem could be?

I tried the start-process line in *scratch* and it worked as expected...

Bye,
Tassilo
--8<---cut here---start->8---
diff -u /home/heimdall/elisp/anything.el.orig /home/heimdall/elisp/anything.el
--- /home/heimdall/elisp/anything.el.orig   2007-07-17 09:24:46.0 
+0200
+++ /home/heimdall/elisp/anything.el2007-07-17 09:29:05.0 +0200
@@ -51,7 +51,7 @@
 
 (require 'cl)
 
-;; User Configuration 
+;; User Configuration
 
 ;; This is only an example. Customize it to your own taste!
 (defvar anything-sources `(((name . "Buffers")
@@ -234,7 +234,7 @@
   "It's a list of (TYPE . FUNCTION) pairs. The function is called
   with two arguments when the action list from the source is
   assembled. The first argument is the list of actions, the
-  second is the current selection. 
+  second is the current selection.
 
   The function should return a transformed action list.
 
@@ -265,7 +265,8 @@
   "Keymap for anything.")
 
 
-(defvar anything-header-face 'header-line
+(defface anything-header-face
+  '((t (:bold t :underline t)))
   "Face for header lines in the anything buffer.")
 
 ;;--
@@ -275,28 +276,40 @@
 ;;--
 
 (defvar anything-source-emacs-commands
-  `((name . "Emacs Commands") 
-(candidates . ,(let (commands) 
- (mapatoms (lambda (a) 
- (if (commandp a) 
- (push (symbol-name a) 
-   commands 
- (sort commands 'string-lessp))) 
-(action . (lambda (command-name) 
+  `((name . "Emacs Commands")
+(candidates . ,(let (commands)
+ (mapatoms (lambda (a)
+ (if (commandp a)
+ (push (symbol-name a)
+   commands
+ (sort commands 'string-lessp)))
+(action . (lambda (command-name)
 (call-interactively (intern command-name)
   "Source for completing and invoking Emacs commands.")
 
 
-(defvar anything-source-locate 
-  '((name . "Locate")
+(defvar anything-source-locate
+  '((name . "Locate")
 (candidates . (lambda ()
 (start-process "locate-process" nil
-   "locate" "-r" "-i"
+   "locate" "-i" "-r"
anything-pattern)))
 (type . file)
 (requires-pattern . 3))
   "Source for retrieving files matching the current input pattern
-  with locate.")
+with locate.")
+
+
+(defvar anything-source-tracker-search
+  '((name . "Tracker Search")
+(candidates . (lambda ()
+(start-process "tracker-search-process" nil
+   "tracker-search"
+   anything-pattern)))
+(type . file)
+(requires-pattern . 3))
+  "Source for retrieving files matching the current input pattern
+with the tracker desktop search.")
 
 
 ;;--
@@ -345,7 +358,7 @@
(or (equal name anything-buffer)
(eq ?\  (aref name 0
  (mapcar 'buffer-name (buffer-list
-  
+
 
 (defun anything-check-minibuffer-input ()
   "Extract input string from the minibuffer and check if it needs
@@ -405,7 +418,7 @@
 (progn
   (setq matches (anything-get-cached-candidates source))
   (if (> (length matches) anything-candidate-number-limit)
-  (setq matches 
+  (setq matches
 (subseq matches 0 anything-candidate-number-limit
 
   (let ((item-count 0))
@@ -445,7 +458,7 @@
   (funcall insert-function match)
 
 (funcall insert-function (car match))
-(put-text-property (line-beginning-position) (line-end-position) 
+(put-text-proper

Re: ;;; anything.el --- open anything

2007-07-16 Thread Tassilo Horn
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:

Hi Tamas,

>> But the locate source lists always the same files, although none of
>> them matches the given pattern. Those are the listed files, I typed
>> the pattern "foobarbaz".
>
> Works for me. I started emacs with -q, loaded anything, did a (push
> anything-source-locate anything-sources) and anything listed the
> matching files with locate.

Ok, I tried emacs -Q as well, but still I get the same list of files.

> I use the locate source every day, so it should work. :) Maybe you
> should try starting the locate process manually with start-process to
> see if it returns the correct results.

Nope.

> Someone else also had a problem with the locate source and it turned
> out his locate didn't understand the options I used in the example
> anything-locate-source.

Ah, yes, that's it. I use GNU slocate version 3.1. The option -r has to
be followed by the regexp to search, so

   locate -r -i foobarbaz

will look for the regexp -i instead of foobarbaz. So the solution is to
reverse -r and -i:

--8<---cut here---start->8---
(defvar anything-source-locate
  '((name . "Locate")
(candidates . (lambda ()
(start-process "locate-process" nil
   "locate" "-i" "-r"
   anything-pattern)))
(type . file)
(requires-pattern . 3))
  "Source for retrieving files matching the current input pattern
  with locate.")
--8<---cut here---end--->8---

Bye,
Tassilo
-- 
  "DRM manages rights in the same way a jail manages freedom"



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources


Re: ;;; anything.el --- open anything

2007-07-16 Thread Tassilo Horn
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:

Hi,

>>   - Use a custom face for the headlines in the *anything* buffer. I
>>   saw that was mentioned earlier and I'm ok with the "first
>>   functionality, then eye-candy" approach.
>>
>
> Eye candy gets implemented faster if patches are submitted. ;)

Sure. Maybe I'll give it a try tomorrow.

>>   - Add an attribute that forbids removing elements that don't match
>>   the pattern. I want to add a source for the tracker desktop search,
>>   but files that contain the text "foo" probably don't have "foo" in
>>   their name and won't be displayed with the current implementation.
>>
> It's possible already. Simply implement an asynchronous source. See
> anything-source-locate as an example.

Ah, cool, but it doesn't work. :-)

,[ ~/.emacs ]
| (setq anything-sources
|   `(

[...]

| ,anything-source-locate

[...]

|))
`

But the locate source lists always the same files, although none of them
matches the given pattern. Those are the listed files, I typed the
pattern "foobarbaz".

,
| /sbin/grub-install
| /opt/googleearth/res/shapes/info-i.png
| /opt/googleearth/resources/googleearth-icon.png
| /opt/googleearth/resources/indxed-interlaced.png
| /opt/googleearth/resources/indxed-non-interlaced.png
| /opt/googleearth/resources/info-i.png
| /opt/sun-jdk-1.6.0.02/jre/lib/ext/meta-index
| /opt/sun-jdk-1.6.0.02/jre/lib/meta-index
| /opt/sun-jdk-1.6.0.02/jre/lib/deploy/java-icon.ico
| /zeugs/videos/fun/gute-idee.wmv
| 
/.emacs.d/image-dired/broken-image_d3c1d77d78eebc3c138e9021352a5379.thumb.gif
| 
/.emacs.d/image-dired/loading-image_d3c1d77d78eebc3c138e9021352a5379.thumb.gif
| /.newsticker-images
| /.newsticker-images/Emacs Wiki
| /.newsticker-images/Slashdot
| /.newsticker-images/Neuigkeiten der Linux Community
| /.newsticker-images/NewsForge
| 
/uni/repos/re-group/trunk/project/jgralab/src/jgralab/utilities/tgschema2java/package-info.java
| 
/uni/repos/re-group/trunk/project/jgralab/src/jgralab/utilities/tgschema2java/package-info.class
| 
/uni/repos/re-group/trunk/project/jgralab/src/jgralab/utilities/tgschema2java/.svn/text-base/package-info.java.svn-base
| 
/uni/repos/re-group/trunk/project/jgralab/src/jgralab/codegenerator/package-info.java
| 
/uni/repos/re-group/trunk/project/jgralab/src/jgralab/codegenerator/package-info.class
| 
/uni/repos/re-group/trunk/project/jgralab/src/jgralab/codegenerator/.svn/text-base/package-info.java.svn-base
| /uni/repos/re-group/trunk/project/jgralab/src/jgralab/package-info.java
| /uni/repos/re-group/trunk/project/jgralab/src/jgralab/package-info.class
| 
/uni/repos/re-group/trunk/project/jgralab/src/jgralab/impl/list/package-info.java
| 
/uni/repos/re-group/trunk/project/jgralab/src/jgralab/impl/list/package-info.class
| 
/uni/repos/re-group/trunk/project/jgralab/src/jgralab/impl/list/.svn/text-base/package-info.java.svn-base
| 
/uni/repos/re-group/trunk/project/jgralab/src/jgralab/impl/array/package-info.java
| 
/uni/repos/re-group/trunk/project/jgralab/src/jgralab/impl/array/package-info.class
| 
/uni/repos/re-group/trunk/project/jgralab/src/jgralab/impl/array/.svn/text-base/package-info.java.svn-base
| 
/uni/repos/re-group/trunk/project/jgralab/src/jgralab/impl/package-info.java
| 
/uni/repos/re-group/trunk/project/jgralab/src/jgralab/impl/package-info.class
| 
/uni/repos/re-group/trunk/project/jgralab/src/jgralab/impl/.svn/text-base/package-info.java.svn-base
| 
/uni/repos/re-group/trunk/project/jgralab/src/jgralab/.svn/text-base/package-info.java.svn-base
| /uni/repos/re-group/trunk/project/gcpp/testit/jason/gupro-include
| /uni/repos/re-group/trunk/project/gcpp/testit/jason/gupro-include/usr
| 
/uni/repos/re-group/trunk/project/gcpp/testit/jason/gupro-include/usr/include
| 
/uni/repos/re-group/trunk/project/gcpp/testit/jason/gupro-include/usr/include/endian.h
| 
/uni/repos/re-group/trunk/project/gcpp/testit/jason/gupro-include/usr/include/alloca.h
| 
/uni/repos/re-group/trunk/project/gcpp/testit/jason/gupro-include/usr/include/_G_config.h
| 
/uni/repos/re-group/trunk/project/gcpp/testit/jason/gupro-include/usr/include/gnu
| 
/uni/repos/re-group/trunk/project/gcpp/testit/jason/gupro-include/usr/include/gnu/stubs.h
| 
/uni/repos/re-group/trunk/project/gcpp/testit/jason/gupro-include/usr/include/gnu/.svn
| 
/uni/repos/re-group/trunk/project/gcpp/testit/jason/gupro-include/usr/include/gnu/.svn/props
| 
/uni/repos/re-group/trunk/project/gcpp/testit/jason/gupro-include/usr/include/gnu/.svn/tmp
| 
/uni/repos/re-group/trunk/project/gcpp/testit/jason/gupro-include/usr/include/gnu/.svn/tmp/props
| 
/uni/repos/re-group/trunk/project/gcpp/testit/jason/gupro-include/usr/include/gnu/.svn/tmp/text-base
| 
/uni/repos/re-group/trunk/project/gcpp/testit/jason/gupro-include/usr/include/gnu/.svn/tmp/prop-base
| 
/uni/repos/re-group/trunk/project/gcpp/testit/jason/gupro-include/usr/include/gnu/.svn/entries
`

What's wrong with it?

Bye,
Tassilo
-- 
Chuck Norris once rode a nine foot grizzly bear through a

Re: ;;; anything.el --- open anything

2007-07-16 Thread Tassilo Horn
Hi,

I started using anything.el today and really enjoy it. Nevertheless
there're some things that could be better.

  - Use a custom face for the headlines in the *anything* buffer. I saw
that was mentioned earlier and I'm ok with the "first functionality,
then eye-candy" approach.

  - Add an attribute that forbids removing elements that don't match the
pattern. I want to add a source for the tracker desktop search, but
files that contain the text "foo" probably don't have "foo" in their
name and won't be displayed with the current implementation.

Here's the snipped:

((name . "Tracker Search")
 (candidates . (lambda ()
 (split-string
  (shell-command-to-string
   (concat "tracker-search " anything-pattern 
   " | sort &")
 (type . file)
 (requires-pattern . 3)
 (delayed))

What do you think?

Bye,
Tassilo
-- 
Chuck Norris has a deep and  abiding respect for human life... unless it
gets in his way.



___
gnu-emacs-sources mailing list
gnu-emacs-sources@gnu.org
http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources