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

2007-07-24 Thread billclem
[EMAIL PROTECTED] writes:

> Hmm, that requires 2 more keystrokes than my command, so I think I'll
> just keep it in my .emacs file as I use that action quite a
> lot. Incidentally, I wrote a little helper macro that adds new actions
> to the existing ones (I find the "standard" actions quite useful, so I
> don't want to do a reassignment that just replicates what's already in
> anything-config.el and I also I didn't want to have to clone the
> variable assignment every time a new version of anything-config.el
> came out with additional actions). You might want to add it to
> anything-config.el if you think others might also find it useful:
>
> (defmacro anything-add-to-actions (var field action)
>   `(setq ,var (cons ',field
>   (append
>(cdr ,var)
>(list ',action)
>
> To add the two actions I sent in earlier, one would do the following:
>
> (anything-add-to-actions anything-actions-file
>file
>("Open File with default Tool" .
>  (lambda (filename)
>(call-process "/usr/bin/open" nil 0 nil 
> filename
>
> (anything-add-to-actions anything-actions-function
>function
>("Find Function" .
> (lambda (command-name)
>   (find-function (intern command-name)
>

Actually, the macro should be:

(defmacro anything-add-to-actions (var action)
  `(setq ,var (cons (car ,var)
(append
 (cdr ,var)
 (list ',action)

And to add an action:

(anything-add-to-actions anything-actions-file
 ("Open File with default Tool" .
   (lambda (filename)
 (call-process "/usr/bin/open" nil 0 nil 
filename

--
Bill Clementson

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


etags-select v1.4

2007-07-24 Thread Scott Frazer

Fix filenames for tag files with absolute paths

;;; etags-select.el --- Select from multiple tags

;; Copyright (C) 2007  Scott Frazer

;; Author: Scott Frazer <[EMAIL PROTECTED]>
;; Maintainer: Scott Frazer <[EMAIL PROTECTED]>
;; Created: 07 Jun 2007
;; Version: 1.4
;; Keywords: etags tags tag select

;; This file 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 2, or (at your option)
;; any later version.

;; This file 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 GNU Emacs; see the file COPYING.  If not, write to
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.

;;; Commentary:

;; Open a buffer with file/lines of exact-match tags shown.  Select one by
;; going to a line and pressing return.  pop-tag-mark still works with this
;; code.
;;
;; If there is only one match, you can skip opening the selection window by
;; setting a custom variable.  This means you could substitute the key binding
;; for find-tag-at-point with etags-select-find-tag-at-point, although it
;; won't play well with tags-loop-continue.  On the other hand, if you like
;; the behavior of tags-loop-continue you probably don't need this code.
;;
;; I use this:
;; (global-set-key "\M-?" 'etags-select-find-tag-at-point)
;;
;; Contributers of ideas and/or code:
;; David Engster
;;
;;; Change log:
;;
;; 24 Jul 2007 -- v1.4
;;Fix filenames for tag files with absolute paths
;; 24 Jul 2007 -- v1.3
;;Handle qualified and implicit tags.
;;Add tag name to display.
;;Add tag numbers so you can jump directly to one.
;; 13 Jun 2007 -- v1.2
;;Need to regexp-quote the searched-for string.

;;; Code:

(require 'custom)
(require 'etags)

;;;
;;; Custom stuff

;;;###autoload
(defgroup etags-select-mode nil
  "*etags select mode."
  :group 'etags)

;;;###autoload
(defcustom etags-select-no-select-for-one-match t
  "*If non-nil, don't open the selection window if there is only one
matching tag."
  :group 'etags-select-mode
  :type '(boolean))

;;;###autoload
(defcustom etags-select-mode-hook nil
  "*List of functions to call on entry to etags-select-mode mode."
  :group 'etags-select-mode
  :type 'hook)

;;;
;;; Variables

(defvar etags-select-buffer-name "*etags-select*"
  "etags-select buffer name.")

(defvar etags-select-mode-font-lock-keywords nil
  "etags-select font-lock-keywords.")

(defvar etags-select-starting-buffer nil
  "etags-select buffer tag is being found from.")

(defconst etags-select-non-tag-regexp "\\(\\s-*$\\|In:\\|Finding tag:\\)"
  "etags-select non-tag regex.")

;;;
;;; Functions

(if (string-match "XEmacs" emacs-version)
(fset 'etags-select-match-string 'match-string)
  (fset 'etags-select-match-string 'match-string-no-properties))

;; I use Emacs, but with a hacked version of XEmacs' etags.el, thus this 
variable

(defvar etags-select-use-xemacs-etags-p (fboundp 'get-tag-table-buffer)
  "Use XEmacs etags?")

(defun etags-select-insert-matches (tagname tag-file tag-count)
  (let ((tag-table-buffer (if etags-select-use-xemacs-etags-p
  (get-tag-table-buffer tag-file)
(visit-tags-table-buffer tag-file)
(get-file-buffer tag-file)))
(tag-file-path (file-name-directory tag-file))
(tag-regex (concat "^.*?\\(" "\^?\\(.+[:.]" tagname "\\)\^A"
   "\\|" "\^?" tagname "\^A"
   "\\|" tagname "[ \f\t()=,;]*\^?[0-9,]"
   "\\)"))
full-tagname tag-line filename current-filename)
(set-buffer tag-table-buffer)
(goto-char (point-min))
(while (re-search-forward tag-regex nil t)
  (setq full-tagname (or (etags-select-match-string 2) tagname))
  (setq tag-count (1+ tag-count))
  (beginning-of-line)
  (re-search-forward "\\s-*\\(.*?\\)\\s-*\^?")
  (setq tag-line (etags-select-match-string 1))
  (end-of-line)
  (save-excursion
(re-search-backward "\f")
(re-search-forward "^\\(.*?\\),")
(setq filename (etags-select-match-string 1))
(unless (file-name-absolute-p filename)
  (setq filename (concat tag-file-path filename
  (save-excursion
(set-buffer etags-select-buffer-name)
(when (not (string= filename current-filename))
  (insert "\n

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

2007-07-24 Thread billclem
Hi Tassilo,

Tassilo Horn <[EMAIL PROTECTED]> writes:

> [EMAIL PROTECTED] writes:
>> 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

Ok, thanks.

>> 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?)

Whatever.

>> 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".

Hmm, that requires 2 more keystrokes than my command, so I think I'll
just keep it in my .emacs file as I use that action quite a
lot. Incidentally, I wrote a little helper macro that adds new actions
to the existing ones (I find the "standard" actions quite useful, so I
don't want to do a reassignment that just replicates what's already in
anything-config.el and I also I didn't want to have to clone the
variable assignment every time a new version of anything-config.el
came out with additional actions). You might want to add it to
anything-config.el if you think others might also find it useful:

(defmacro anything-add-to-actions (var field action)
  `(setq ,var (cons ',field
(append
 (cdr ,var)
 (list ',action)

To add the two actions I sent in earlier, one would do the following:

(anything-add-to-actions anything-actions-file
 file
 ("Open File with default Tool" .
   (lambda (filename)
 (call-process "/usr/bin/open" nil 0 nil 
filename

(anything-add-to-actions anything-actions-function
 function
 ("Find Function" .
  (lambda (command-name)
(find-function (intern command-name)

>> 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...

Yes, but that's more keystrokes than I want to use. ;-)

> But I'll add it.

Ok, thanks.

--
Bill Clementson

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


etags-select.el

2007-07-24 Thread Scott Frazer

Updates:
* Handle qualified and implicit tags.
* Add tag name to display.
* Add tag numbers so you can jump directly to one.

;;; etags-select.el --- Select from multiple tags

;; Copyright (C) 2007  Scott Frazer

;; Author: Scott Frazer <[EMAIL PROTECTED]>
;; Maintainer: Scott Frazer <[EMAIL PROTECTED]>
;; Created: 07 Jun 2007
;; Version: 1.3
;; Keywords: etags tags tag select

;; This file 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 2, or (at your option)
;; any later version.

;; This file 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 GNU Emacs; see the file COPYING.  If not, write to
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.

;;; Commentary:

;; Open a buffer with file/lines of exact-match tags shown.  Select one by
;; going to a line and pressing return.  pop-tag-mark still works with this
;; code.
;;
;; If there is only one match, you can skip opening the selection window by
;; setting a custom variable.  This means you could substitute the key binding
;; for find-tag-at-point with etags-select-find-tag-at-point, although it
;; won't play well with tags-loop-continue.  On the other hand, if you like
;; the behavior of tags-loop-continue you probably don't need this code.
;;
;; I use this:
;; (global-set-key "\M-?" 'etags-select-find-tag-at-point)
;;
;; Contributers of ideas and/or code:
;; David Engster
;;
;;; Change log:
;;
;; 24 Jul 2007 -- Handle qualified and implicit tags.
;;Add tag name to display.
;;Add tag numbers so you can jump directly to one.
;; 13 Jun 2007 -- Need to regexp-quote the searched-for string.

;;; Code:

(require 'custom)
(require 'etags)

;;;
;;; Custom stuff

;;;###autoload
(defgroup etags-select-mode nil
  "*etags select mode."
  :group 'etags)

;;;###autoload
(defcustom etags-select-no-select-for-one-match t
  "*If non-nil, don't open the selection window if there is only one
matching tag."
  :group 'etags-select-mode
  :type '(boolean))

;;;###autoload
(defcustom etags-select-mode-hook nil
  "*List of functions to call on entry to etags-select-mode mode."
  :group 'etags-select-mode
  :type 'hook)

;;;
;;; Variables

(defvar etags-select-buffer-name "*etags-select*"
  "etags-select buffer name.")

(defvar etags-select-mode-font-lock-keywords nil
  "etags-select font-lock-keywords.")

(defvar etags-select-starting-buffer nil
  "etags-select buffer tag is being found from.")

(defconst etags-select-non-tag-regexp "\\(\\s-*$\\|In:\\|Finding tag:\\)"
  "etags-select non-tag regex.")

;;;
;;; Functions

(if (string-match "XEmacs" emacs-version)
(fset 'etags-select-match-string 'match-string)
  (fset 'etags-select-match-string 'match-string-no-properties))

;; I use Emacs, but with a hacked version of XEmacs' etags.el, thus this 
variable

(defvar etags-select-use-xemacs-etags-p (fboundp 'get-tag-table-buffer)
  "Use XEmacs etags?")

(defun etags-select-insert-matches (tagname tag-file tag-count)
  (let ((tag-table-buffer (if etags-select-use-xemacs-etags-p
  (get-tag-table-buffer tag-file)
(visit-tags-table-buffer tag-file)
(get-file-buffer tag-file)))
(tag-file-path (file-name-directory tag-file))
(tag-regex (concat "^.*?\\(" "\^?\\(.+[:.]" tagname "\\)\^A"
   "\\|" "\^?" tagname "\^A"
   "\\|" tagname "[ \f\t()=,;]*\^?[0-9,]"
   "\\)"))
full-tagname tag-line filename current-filename)
(set-buffer tag-table-buffer)
(goto-char (point-min))
(while (re-search-forward tag-regex nil t)
  (setq full-tagname (or (etags-select-match-string 2) tagname))
  (setq tag-count (1+ tag-count))
  (beginning-of-line)
  (re-search-forward "\\s-*\\(.*?\\)\\s-*\^?")
  (setq tag-line (etags-select-match-string 1))
  (end-of-line)
  (save-excursion
(re-search-backward "\f")
(re-search-forward "^\\(.*?\\),")
(setq filename (concat tag-file-path (etags-select-match-string 1
  (save-excursion
(set-buffer etags-select-buffer-name)
(when (not (string= filename current-filename))
  (insert "\nIn: " filename "\n")
  (setq current-filename filename))
(insert (int-to-string tag-count) " [" full-tagname "] " tag-line 
"\

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

2007-07-24 Thread [EMAIL PROTECTED]
On Jul 24, 12:59 pm, Tassilo Horn <[EMAIL PROTECTED]> wrote:
>
> > 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 prefer staying here, but we can move too if people think we're
making too much noise. :)

Anything doesn't work on XEmacs (not yet at least). An XEmacs user is
trying to get it working, but as of now there are showstopper
problems, so it's not really usable.

___
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 [EMAIL PROTECTED]
On Jul 24, 10:53 am, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
>
> I think it happens only if your start anything when then *anything*
> buffer is current. Did you try it like this too?

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.

___
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 [EMAIL PROTECTED]
On Jul 24, 10:38 am, Tassilo Horn <[EMAIL PROTECTED]> wrote:
> 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))

Hi,

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

If so then it's a known error. II noticed this bug a while ago, but
postponed fixing it, because it's not usual the *anything* buffer is
the current one. Why would anyone switch to it?

I'll take a look when I have the time.

/Tamas

___
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 billclem
Tassilo Horn <[EMAIL PROTECTED]> writes:

> "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:
>>> 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.

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

Also, what is the best forum for posting mods to anything-config.el?
Isn't gnu.emacs.sources just supposed to be for source posting and not
discussions?

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)))

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

--
Bill Clementson

___
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