* Is there any elisp functions to tell whether the cursor is in a comment block?
@ 2008-07-13 5:06 sunway
2008-07-13 9:53 ` Johan Bockgård
0 siblings, 1 reply; 31+ messages in thread
From: sunway @ 2008-07-13 5:06 UTC (permalink / raw)
To: help-gnu-emacs
for example, if the cursor is in a normal c code block, I want 'if '
to be expanded to 'if () {}', if it is in the comment block, I prefer
'if ' not be expanded.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: Is there any elisp functions to tell whether the cursor is in a comment block?
2008-07-13 5:06 Is there any elisp functions to tell whether the cursor is in a comment block? sunway
@ 2008-07-13 9:53 ` Johan Bockgård
2008-07-13 17:55 ` Joe Bloggs
0 siblings, 1 reply; 31+ messages in thread
From: Johan Bockgård @ 2008-07-13 9:53 UTC (permalink / raw)
To: help-gnu-emacs
sunway <sunwayforever@gmail.com> writes:
> for example, if the cursor is in a normal c code block, I want 'if '
> to be expanded to 'if () {}', if it is in the comment block, I prefer
> 'if ' not be expanded.
;; Non-nil when inside comment or string
(nth 8 (syntax-ppss (point)))
--
Johan Bockgård
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: Is there any elisp functions to tell whether the cursor is in a comment block?
2008-07-13 9:53 ` Johan Bockgård
@ 2008-07-13 17:55 ` Joe Bloggs
2008-07-13 19:03 ` Johan Bockgård
2008-07-14 1:36 ` sunway
0 siblings, 2 replies; 31+ messages in thread
From: Joe Bloggs @ 2008-07-13 17:55 UTC (permalink / raw)
To: help-gnu-emacs
bojohan+news@dd.chalmers.se (Johan Bockgård) writes:
> sunway <sunwayforever@gmail.com> writes:
>
>> for example, if the cursor is in a normal c code block, I want 'if '
>> to be expanded to 'if () {}', if it is in the comment block, I prefer
>> 'if ' not be expanded.
>
> ;; Non-nil when inside comment or string
> (nth 8 (syntax-ppss (point)))
>
> --
> Johan Bockgård
I want to do that too, how do I do a conditional abbrev?
Currently I have:
(define-abbrev c-mode-abbrev-table "for"
"" 'c-style-for-loop)
(define-abbrev c++-mode-abbrev-table "for"
"" 'c-style-for-loop)
how would I make it only expand in uncommented code?
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: Is there any elisp functions to tell whether the cursor is in a comment block?
2008-07-13 17:55 ` Joe Bloggs
@ 2008-07-13 19:03 ` Johan Bockgård
2008-07-14 1:36 ` Joe Bloggs
2008-07-14 1:36 ` sunway
1 sibling, 1 reply; 31+ messages in thread
From: Johan Bockgård @ 2008-07-13 19:03 UTC (permalink / raw)
To: help-gnu-emacs
Joe Bloggs <who@cares.invalid> writes:
> bojohan+news@dd.chalmers.se (Johan Bockgård) writes:
>
>> sunway <sunwayforever@gmail.com> writes:
>>
>>> for example, if the cursor is in a normal c code block, I want 'if '
>>> to be expanded to 'if () {}', if it is in the comment block, I prefer
>>> 'if ' not be expanded.
>>
>> ;; Non-nil when inside comment or string
>> (nth 8 (syntax-ppss (point)))
>>
>> --
>> Johan Bockgård
>
> I want to do that too, how do I do a conditional abbrev?
> Currently I have:
>
> (define-abbrev c-mode-abbrev-table "for"
> "" 'c-style-for-loop)
> (define-abbrev c++-mode-abbrev-table "for"
> "" 'c-style-for-loop)
>
> how would I make it only expand in uncommented code?
;; Emacs 22 has `looking-back' and `syntax-ppss'.
;; Emacs 23 has much more powerful abbrevs; we could simply use the
;; `:enable-function' property.
(defmacro define-expander (name predicate expander)
`(progn (put ',name 'no-self-insert t)
(defun ,name ()
(when (and ,predicate
(re-search-backward "\\<\\w+\\=" nil t))
(delete-region (match-beginning 0) (match-end 0))
,expander
t))))
(define-expander
FOR-LOOP
(not (nth 8 (parse-partial-sexp
(save-excursion (beginning-of-defun) (point))
(point))))
(c-style-for-loop))
(define-abbrev c-mode-abbrev-table "for" t 'FOR-LOOP)
--
Johan Bockgård
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: Is there any elisp functions to tell whether the cursor is in a comment block?
2008-07-13 19:03 ` Johan Bockgård
@ 2008-07-14 1:36 ` Joe Bloggs
2008-07-14 1:49 ` Johan Bockgård
0 siblings, 1 reply; 31+ messages in thread
From: Joe Bloggs @ 2008-07-14 1:36 UTC (permalink / raw)
To: help-gnu-emacs
bojohan+news@dd.chalmers.se (Johan Bockgård) writes:
> Joe Bloggs <who@cares.invalid> writes:
>
>> bojohan+news@dd.chalmers.se (Johan Bockgård) writes:
>>
>>> sunway <sunwayforever@gmail.com> writes:
>>>
>>>> for example, if the cursor is in a normal c code block, I want 'if '
>>>> to be expanded to 'if () {}', if it is in the comment block, I prefer
>>>> 'if ' not be expanded.
>>>
>>> ;; Non-nil when inside comment or string
>>> (nth 8 (syntax-ppss (point)))
>>>
>>> --
>>> Johan Bockgård
>>
>> I want to do that too, how do I do a conditional abbrev?
>> Currently I have:
>>
>> (define-abbrev c-mode-abbrev-table "for"
>> "" 'c-style-for-loop)
>> (define-abbrev c++-mode-abbrev-table "for"
>> "" 'c-style-for-loop)
>>
>> how would I make it only expand in uncommented code?
>
>
> ;; Emacs 22 has `looking-back' and `syntax-ppss'.
> ;; Emacs 23 has much more powerful abbrevs; we could simply use the
> ;; `:enable-function' property.
>
> (defmacro define-expander (name predicate expander)
> `(progn (put ',name 'no-self-insert t)
> (defun ,name ()
> (when (and ,predicate
> (re-search-backward "\\<\\w+\\=" nil t))
> (delete-region (match-beginning 0) (match-end 0))
> ,expander
> t))))
>
> (define-expander
> FOR-LOOP
> (not (nth 8 (parse-partial-sexp
> (save-excursion (beginning-of-defun) (point))
> (point))))
> (c-style-for-loop))
>
>
> (define-abbrev c-mode-abbrev-table "for" t 'FOR-LOOP)
>
>
> --
> Johan Bockgård
any possibilities with emacs 21?
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: Is there any elisp functions to tell whether the cursor is in a comment block?
2008-07-13 17:55 ` Joe Bloggs
2008-07-13 19:03 ` Johan Bockgård
@ 2008-07-14 1:36 ` sunway
2008-07-14 15:05 ` Joe Bloggs
1 sibling, 1 reply; 31+ messages in thread
From: sunway @ 2008-07-14 1:36 UTC (permalink / raw)
To: help-gnu-emacs
I will recommend YAsnippet package to you [ code.google.com/p/
yasnippet ]
and
(add-hook 'c-mode-hook
'(lambda ()
(setq yas/buffer-local-condition
'(if (nth 8 (syntax-ppss (point)))
'(require-snippet-condition . force-in-
comment)
t))))
will do what you want.
On Jul 14, 1:55 am, Joe Bloggs <w...@cares.invalid> wrote:
> bojohan+n...@dd.chalmers.se (Johan Bockgård) writes:
> > sunway <sunwayfore...@gmail.com> writes:
>
> >> for example, if the cursor is in a normal c code block, I want 'if '
> >> to be expanded to 'if () {}', if it is in the comment block, I prefer
> >> 'if ' not be expanded.
>
> > ;; Non-nil when inside comment or string
> > (nth 8 (syntax-ppss (point)))
>
> > --
> > Johan Bockgård
>
> I want to do that too, how do I do a conditional abbrev?
> Currently I have:
>
> (define-abbrev c-mode-abbrev-table "for"
> "" 'c-style-for-loop)
> (define-abbrev c++-mode-abbrev-table "for"
> "" 'c-style-for-loop)
>
> how would I make it only expand in uncommented code?
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: Is there any elisp functions to tell whether the cursor is in a comment block?
2008-07-14 1:36 ` sunway
@ 2008-07-14 15:05 ` Joe Bloggs
2008-07-14 15:44 ` Lennart Borgman (gmail)
[not found] ` <mailman.14707.1216050306.18990.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 31+ messages in thread
From: Joe Bloggs @ 2008-07-14 15:05 UTC (permalink / raw)
To: help-gnu-emacs
sunway <sunwayforever@gmail.com> writes:
> I will recommend YAsnippet package to you [ code.google.com/p/
> yasnippet ]
> and
> (add-hook 'c-mode-hook
> '(lambda ()
> (setq yas/buffer-local-condition
> '(if (nth 8 (syntax-ppss (point)))
> '(require-snippet-condition . force-in-
> comment)
> t))))
> will do what you want.
>
Thanks for the tip, that's a great package! Just what I need.
The code you give above doesn't work for me (emacs 21),
it doesn't recognize 'syntax-ppss'.
I guess I would have to adapt Johan's code to get it to work in
emacs 21, but thanks anyway.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: Is there any elisp functions to tell whether the cursor is in a comment block?
2008-07-14 15:05 ` Joe Bloggs
@ 2008-07-14 15:44 ` Lennart Borgman (gmail)
[not found] ` <mailman.14707.1216050306.18990.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 31+ messages in thread
From: Lennart Borgman (gmail) @ 2008-07-14 15:44 UTC (permalink / raw)
Cc: help-gnu-emacs
Joe Bloggs wrote:
> I guess I would have to adapt Johan's code to get it to work in
> emacs 21, but thanks anyway.
Just out of curiosity: Why don't you upgrade to Emacs 22?
^ permalink raw reply [flat|nested] 31+ messages in thread
[parent not found: <mailman.14707.1216050306.18990.help-gnu-emacs@gnu.org>]
* Re: Is there any elisp functions to tell whether the cursor is in a comment block?
[not found] ` <mailman.14707.1216050306.18990.help-gnu-emacs@gnu.org>
@ 2008-07-14 20:10 ` Joe Bloggs
2008-07-14 23:20 ` Lennart Borgman (gmail)
2008-07-17 17:30 ` Giorgos Keramidas
0 siblings, 2 replies; 31+ messages in thread
From: Joe Bloggs @ 2008-07-14 20:10 UTC (permalink / raw)
To: help-gnu-emacs
"Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:
> Joe Bloggs wrote:
>> I guess I would have to adapt Johan's code to get it to work in
>> emacs 21, but thanks anyway.
>
> Just out of curiosity: Why don't you upgrade to Emacs 22?
I tried, but couldn't get it to work properly.
I wasted a whole day ****ing around with my .emacs, load-path etc.
I use quite a lot of packages and I'm not sure which ones are
compatible or not. So for the moment I'm sticking with what works (i.e. emacs 21).
Actually maybe you could give me some tips on a smooth transition?
My OS is Debian Etch.
Currently I get the following error when I start up emacs 22.2:
"File error: Cannot open load file, tramp-gw"
which means I can't use tramp.
Wouldn't mind trying out emacs 23 at some point either.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: Is there any elisp functions to tell whether the cursor is in a comment block?
2008-07-14 20:10 ` Joe Bloggs
@ 2008-07-14 23:20 ` Lennart Borgman (gmail)
2008-07-14 23:43 ` Drew Adams
2008-07-15 1:27 ` Tom Tromey
2008-07-17 17:30 ` Giorgos Keramidas
1 sibling, 2 replies; 31+ messages in thread
From: Lennart Borgman (gmail) @ 2008-07-14 23:20 UTC (permalink / raw)
To: Tom Tromey; +Cc: help-gnu-emacs
Joe Bloggs wrote:
> "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:
>
>> Joe Bloggs wrote:
>>> I guess I would have to adapt Johan's code to get it to work in
>>> emacs 21, but thanks anyway.
>> Just out of curiosity: Why don't you upgrade to Emacs 22?
>
> I tried, but couldn't get it to work properly.
> I wasted a whole day ****ing around with my .emacs, load-path etc.
> I use quite a lot of packages and I'm not sure which ones are
> compatible or not. So for the moment I'm sticking with what works (i.e. emacs 21).
> Actually maybe you could give me some tips on a smooth transition?
Unfortunately I am not the right person for that. I have hardly ever
used Emacs 21. I started with CVS Emacs 22.
I have been thinking of putting up a page with information about which
packages works with which version of Emacs. Of course I can not populate
such a page myself. People who are actually using a package must tell
about there success/problems. For such a page to be really useful I
think it should be structured both with free text and structured text
that makes it possible for package helpers like ELPA to use it.
> My OS is Debian Etch.
> Currently I get the following error when I start up emacs 22.2:
>
> "File error: Cannot open load file, tramp-gw"
>
> which means I can't use tramp.
>
> Wouldn't mind trying out emacs 23 at some point either.
It could be a good idea trying CVS Emacs 23 instead of Emacs 22. Emacs
23 is not too far from a release and in most respect stable.
^ permalink raw reply [flat|nested] 31+ messages in thread
* RE: Is there any elisp functions to tell whether the cursor is in a comment block?
2008-07-14 23:20 ` Lennart Borgman (gmail)
@ 2008-07-14 23:43 ` Drew Adams
2008-07-14 23:49 ` Lennart Borgman (gmail)
` (2 more replies)
2008-07-15 1:27 ` Tom Tromey
1 sibling, 3 replies; 31+ messages in thread
From: Drew Adams @ 2008-07-14 23:43 UTC (permalink / raw)
To: 'Lennart Borgman (gmail)', 'Tom Tromey'; +Cc: help-gnu-emacs
> Emacs 23 is not too far from a release and in most respect stable.
Sorry, but I, for one, cannot agree with that part.
Emacs 22 is stable; Emacs 23 is not at all, AFAICT.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: Is there any elisp functions to tell whether the cursor is in a comment block?
2008-07-14 23:43 ` Drew Adams
@ 2008-07-14 23:49 ` Lennart Borgman (gmail)
2008-07-15 6:02 ` Drew Adams
[not found] ` <mailman.14727.1216079418.18990.help-gnu-emacs@gnu.org>
2008-07-20 13:59 ` Eli Zaretskii
2 siblings, 1 reply; 31+ messages in thread
From: Lennart Borgman (gmail) @ 2008-07-14 23:49 UTC (permalink / raw)
To: Drew Adams; +Cc: 'Tom Tromey', help-gnu-emacs
Drew Adams wrote:
>> Emacs 23 is not too far from a release and in most respect stable.
>
> Sorry, but I, for one, cannot agree with that part.
> Emacs 22 is stable; Emacs 23 is not at all, AFAICT.
I guess you might be right, Drew, you use Emacs in a different way than
I do, but which parts do users who want to try CVS Emacs 23 now have to
worry about?
^ permalink raw reply [flat|nested] 31+ messages in thread
* RE: Is there any elisp functions to tell whether the cursor is in a comment block?
2008-07-14 23:49 ` Lennart Borgman (gmail)
@ 2008-07-15 6:02 ` Drew Adams
0 siblings, 0 replies; 31+ messages in thread
From: Drew Adams @ 2008-07-15 6:02 UTC (permalink / raw)
To: 'Lennart Borgman (gmail)'; +Cc: help-gnu-emacs
> >> Emacs 23 is not too far from a release and in most respect stable.
> >
> > Sorry, but I, for one, cannot agree with that part.
> > Emacs 22 is stable; Emacs 23 is not at all, AFAICT.
>
> I guess you might be right, Drew, you use Emacs in a
> different way than I do, but which parts do users who
> want to try CVS Emacs 23 now have to worry about?
I didn't mean to start a discussion about this. I meant only to dampen some
expectations you might have set - I don't think of Emacs 23 as close to release
or particularly stable.
I don't know all the areas where there might be problems or instability. Reading
emacs-devel or looking at the pretest bug list would give a better idea of the
status than I could give.
When I try to use Emacs 23 (on Windows), frame parameters are still completely
messed up (gratuitous and multiple incorrect parameter values added somehow etc.
- bug #117).
The completion code (minibuffer.el) has been changing and is apparently still
changing. I've had to adjust the Icicles code several times for that. Stefan was
supposedly going to add the general `completion-read-function' variable we asked
for months ago, as soon as he finished moving `completing-read' to minibuffer.el
(emacs-devel thread "completing-read-function variable for completing-read").
That variable is still not added, so I guess that evolution/migration is not
finished.
The font stuff has been volatile for some time now, judging from the traffic on
emacs-devel. I have no direct experience with that, personally. Maybe that's all
over now - dunno. However, I see some problems now in the treatment of certain
characters/keys (e.g. 67108911, 67108923) during Icicles key completion.
I haven't followed it, but there is also apparently a change afoot now to
eliminate frame parameters that are also attributes of face `default' (?). It's
not clear to me just what that change might entail; I'm not sure it's been
specified.
Emacs 23 is quite slow, on Windows at least. I imagine that there will be a
period of optimization before Emacs 23 is near releasable.
Don't get me wrong: I wouldn't discourage anyone from _trying_ Emacs 23. But I
also wouldn't say it's "not too far from a release and in most respect stable".
Maybe it's a question of seeing the glass half full or half empty.
I would recommend Emacs 22.
^ permalink raw reply [flat|nested] 31+ messages in thread
[parent not found: <mailman.14727.1216079418.18990.help-gnu-emacs@gnu.org>]
* Re: Is there any elisp functions to tell whether the cursor is in a comment block?
[not found] ` <mailman.14727.1216079418.18990.help-gnu-emacs@gnu.org>
@ 2008-07-15 22:27 ` David Kastrup
0 siblings, 0 replies; 31+ messages in thread
From: David Kastrup @ 2008-07-15 22:27 UTC (permalink / raw)
To: help-gnu-emacs
"Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:
> Drew Adams wrote:
>>> Emacs 23 is not too far from a release and in most respect stable.
>>
>> Sorry, but I, for one, cannot agree with that part.
>> Emacs 22 is stable; Emacs 23 is not at all, AFAICT.
>
> I guess you might be right, Drew, you use Emacs in a different way
> than I do, but which parts do users who want to try CVS Emacs 23 now
> have to worry about?
Uh, currently pretty much every week the font configuration of last week
may stop working.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: Is there any elisp functions to tell whether the cursor is in a comment block?
2008-07-14 23:43 ` Drew Adams
2008-07-14 23:49 ` Lennart Borgman (gmail)
[not found] ` <mailman.14727.1216079418.18990.help-gnu-emacs@gnu.org>
@ 2008-07-20 13:59 ` Eli Zaretskii
2 siblings, 0 replies; 31+ messages in thread
From: Eli Zaretskii @ 2008-07-20 13:59 UTC (permalink / raw)
To: help-gnu-emacs
> From: "Drew Adams" <drew.adams@oracle.com>
> Date: Mon, 14 Jul 2008 16:43:52 -0700
> Cc: help-gnu-emacs@gnu.org
>
> > Emacs 23 is not too far from a release and in most respect stable.
>
> Sorry, but I, for one, cannot agree with that part.
> Emacs 22 is stable; Emacs 23 is not at all, AFAICT.
I agree with Drew. Not only is Emacs 23 not stable yet, especially
after the latest radical changes in the font backend, but I very much
doubt that it's ``not too far from a release''. My hat off if Emacs
23.1 will be released less than 6 months from now. I've seen quite a
few releases since Emacs 19.2x 15 years ago, and none of them was
released as soon as it seemed when the pretest began. I hope the new
maintainers will change that, but the cynic inside me sincerely doubts
that.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: Is there any elisp functions to tell whether the cursor is in a comment block?
2008-07-14 23:20 ` Lennart Borgman (gmail)
2008-07-14 23:43 ` Drew Adams
@ 2008-07-15 1:27 ` Tom Tromey
2008-07-15 7:31 ` Lennart Borgman (gmail)
1 sibling, 1 reply; 31+ messages in thread
From: Tom Tromey @ 2008-07-15 1:27 UTC (permalink / raw)
To: Lennart Borgman (gmail); +Cc: help-gnu-emacs
>>>>> "Lennart" == Lennart Borgman (gmail) <lennart.borgman@gmail.com> writes:
Lennart> I have been thinking of putting up a page with information about which
Lennart> packages works with which version of Emacs. Of course I can not
Lennart> populate such a page myself. People who are actually using a package
Lennart> must tell about there success/problems. For such a page to be really
Lennart> useful I think it should be structured both with free text and
Lennart> structured text that makes it possible for package helpers like ELPA
Lennart> to use it.
Yeah -- this particular problem is something I did not try to solve
with ELPA/package.el. I just don't see a very good way to solve it,
beyond documentation.
I'm open to suggestions.
Tom
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: Is there any elisp functions to tell whether the cursor is in a comment block?
2008-07-15 1:27 ` Tom Tromey
@ 2008-07-15 7:31 ` Lennart Borgman (gmail)
2008-07-15 14:15 ` Drew Adams
0 siblings, 1 reply; 31+ messages in thread
From: Lennart Borgman (gmail) @ 2008-07-15 7:31 UTC (permalink / raw)
To: Tom Tromey; +Cc: help-gnu-emacs
Tom Tromey wrote:
>>>>>> "Lennart" == Lennart Borgman (gmail) <lennart.borgman@gmail.com> writes:
>
> Lennart> I have been thinking of putting up a page with information about which
> Lennart> packages works with which version of Emacs. Of course I can not
> Lennart> populate such a page myself. People who are actually using a package
> Lennart> must tell about there success/problems. For such a page to be really
> Lennart> useful I think it should be structured both with free text and
> Lennart> structured text that makes it possible for package helpers like ELPA
> Lennart> to use it.
>
> Yeah -- this particular problem is something I did not try to solve
> with ELPA/package.el. I just don't see a very good way to solve it,
> beyond documentation.
>
> I'm open to suggestions.
Hi Tom,
I am thinking about a page on EmacsWiki that holds the information. This
page could for example have entries like
=== Tabkey2.el 21=n 22=y 23=y ===
elisp:tabkey2.el
comment ... comment ...
ELPA could then fetch information from this page. And users could too.
The elisp pages on EmacsWiki could at the bottom have a link to this page.
^ permalink raw reply [flat|nested] 31+ messages in thread
* RE: Is there any elisp functions to tell whether the cursor is in a comment block?
2008-07-15 7:31 ` Lennart Borgman (gmail)
@ 2008-07-15 14:15 ` Drew Adams
2008-07-15 20:50 ` Lennart Borgman (gmail)
0 siblings, 1 reply; 31+ messages in thread
From: Drew Adams @ 2008-07-15 14:15 UTC (permalink / raw)
To: 'Lennart Borgman (gmail)', 'Tom Tromey'; +Cc: help-gnu-emacs
> I am thinking about a page on EmacsWiki that holds the
> information. This page could for example have entries like
>
> === Tabkey2.el 21=n 22=y 23=y ===
> elisp:tabkey2.el
>
> comment ... comment ...
>
> ELPA could then fetch information from this page. And users could too.
>
> The elisp pages on EmacsWiki could at the bottom have a link
> to this page.
A file-header field in each library file can give the same information. I use
this field, for example:
;; Compatibility: GNU Emacs 20.x, GNU Emacs 21.x, GNU Emacs 22.x
However, the field value is free-form at present. A conventional form would let
tools pick up the value.
An advantage is locality of reference and update: some developers are more
likely to update a file header field than a separate wiki page.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: Is there any elisp functions to tell whether the cursor is in a comment block?
2008-07-15 14:15 ` Drew Adams
@ 2008-07-15 20:50 ` Lennart Borgman (gmail)
2008-07-15 21:21 ` Drew Adams
0 siblings, 1 reply; 31+ messages in thread
From: Lennart Borgman (gmail) @ 2008-07-15 20:50 UTC (permalink / raw)
To: Drew Adams; +Cc: 'Tom Tromey', help-gnu-emacs
Drew Adams wrote:
>> I am thinking about a page on EmacsWiki that holds the
>> information. This page could for example have entries like
>>
>> === Tabkey2.el 21=n 22=y 23=y ===
>> elisp:tabkey2.el
>>
>> comment ... comment ...
>>
>> ELPA could then fetch information from this page. And users could too.
>>
>> The elisp pages on EmacsWiki could at the bottom have a link
>> to this page.
>
>
> A file-header field in each library file can give the same information. I use
> this field, for example:
>
> ;; Compatibility: GNU Emacs 20.x, GNU Emacs 21.x, GNU Emacs 22.x
>
> However, the field value is free-form at present. A conventional form would let
> tools pick up the value.
>
> An advantage is locality of reference and update: some developers are more
> likely to update a file header field than a separate wiki page.
Yes, that might be good too, but it can't be used for packages.
^ permalink raw reply [flat|nested] 31+ messages in thread
* RE: Is there any elisp functions to tell whether the cursor is in a comment block?
2008-07-15 20:50 ` Lennart Borgman (gmail)
@ 2008-07-15 21:21 ` Drew Adams
2008-07-15 21:34 ` Lennart Borgman (gmail)
0 siblings, 1 reply; 31+ messages in thread
From: Drew Adams @ 2008-07-15 21:21 UTC (permalink / raw)
To: 'Lennart Borgman (gmail)'; +Cc: 'Tom Tromey', help-gnu-emacs
> >> I am thinking about a page on EmacsWiki that holds the
> >> information. This page could for example have entries like
> >>
> >> === Tabkey2.el 21=n 22=y 23=y ===
> >> elisp:tabkey2.el
> >> comment ... comment ...
> >>
> >> ELPA could then fetch information from this page. And
> >> users could too.
> >>
> >> The elisp pages on EmacsWiki could at the bottom have a link
> >> to this page.
> >
> > A file-header field in each library file can give the same
> > information. I use this field, for example:
> >
> > ;; Compatibility: GNU Emacs 20.x, GNU Emacs 21.x, GNU Emacs 22.x
> >
> > However, the field value is free-form at present. A
> > conventional form would let tools pick up the value.
> >
> > An advantage is locality of reference and update: some
> > developers are more likely to update a file header field than
> > a separate wiki page.
>
> Yes, that might be good too, but it can't be used for packages.
Why not?
If a tool (e.g. ELPA) can pick up the info from a wiki page, as you suggest, why
can't it pick it up from an elisp file (which can also be a wiki page) or a
"package file" or whatever. IOW, whatever info you would provide in the form you
suggested could alternatively be provided in the source code itself. No?
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: Is there any elisp functions to tell whether the cursor is in a comment block?
2008-07-15 21:21 ` Drew Adams
@ 2008-07-15 21:34 ` Lennart Borgman (gmail)
2008-07-15 22:06 ` Drew Adams
0 siblings, 1 reply; 31+ messages in thread
From: Lennart Borgman (gmail) @ 2008-07-15 21:34 UTC (permalink / raw)
To: Drew Adams; +Cc: 'Tom Tromey', help-gnu-emacs
Drew Adams wrote:
>>>> I am thinking about a page on EmacsWiki that holds the
>>>> information. This page could for example have entries like
>>>>
>>>> === Tabkey2.el 21=n 22=y 23=y ===
>>>> elisp:tabkey2.el
>>>> comment ... comment ...
>>>>
>>>> ELPA could then fetch information from this page. And
>>>> users could too.
>>>>
>>>> The elisp pages on EmacsWiki could at the bottom have a link
>>>> to this page.
>>> A file-header field in each library file can give the same
>>> information. I use this field, for example:
>>>
>>> ;; Compatibility: GNU Emacs 20.x, GNU Emacs 21.x, GNU Emacs 22.x
>>>
>>> However, the field value is free-form at present. A
>>> conventional form would let tools pick up the value.
>>>
>>> An advantage is locality of reference and update: some
>>> developers are more likely to update a file header field than
>>> a separate wiki page.
>> Yes, that might be good too, but it can't be used for packages.
>
> Why not?
>
> If a tool (e.g. ELPA) can pick up the info from a wiki page, as you suggest, why
> can't it pick it up from an elisp file (which can also be a wiki page) or a
> "package file" or whatever. IOW, whatever info you would provide in the form you
> suggested could alternatively be provided in the source code itself. No?
Yes, you are right. It can be done. For a package consisting of several
files there can be a file, say this-package-compatibility.el, that
contains this information.
For a single elisp file I think the compatibility info can be in the
file itself.
So maybe your suggestion is better.
I would suggest a shorter version of the compatibility line, like
;; Compatibility: Emacs=20.*,21.*,22.* XEmacs=unknown
I would also suggest adding this information to all elisp files on
EmacsWiki. Perhaps this can be done automatically using the dates the
files where added and assuming the files only works for the then current
released version of Emacs?
^ permalink raw reply [flat|nested] 31+ messages in thread
* RE: Is there any elisp functions to tell whether the cursor is in a comment block?
2008-07-15 21:34 ` Lennart Borgman (gmail)
@ 2008-07-15 22:06 ` Drew Adams
2008-07-15 22:19 ` Lennart Borgman (gmail)
[not found] ` <mailman.14800.1216160423.18990.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 31+ messages in thread
From: Drew Adams @ 2008-07-15 22:06 UTC (permalink / raw)
To: 'Lennart Borgman (gmail)'; +Cc: 'Tom Tromey', help-gnu-emacs
> Yes, you are right. It can be done. For a package consisting
> of several files there can be a file, say
> this-package-compatibility.el, that contains this information.
> For a single elisp file I think the compatibility info can be
> in the file itself. So maybe your suggestion is better.
>
> I would suggest a shorter version of the compatibility line, like
> ;; Compatibility: Emacs=20.*,21.*,22.* XEmacs=unknown
If the info is to be used in some automatic way, perhaps a convention could be
used that corresponds to the form of `emacs-major-version' and
`emac-minor-version', or `emacs-version', perhaps with wild cards.
One library might be compatible with all minor versions for Emacs 21, and
another might be compatible with all minor versions of Emacs 21 after 21.1.2,
and a third might be compatible with only 21.3.1...
That kind of thing is not much of a problem if it is only people that read a
Compatibility field. But if tools do that, then there would need to be a
well-defined syntax to communicate the various possibilities unambiguously.
`unknown' doesn't seem useful to me. But how should absence be interpreted, in
general: as unknown or incompatible?
> I would also suggest adding this information to all elisp files on
> EmacsWiki. Perhaps this can be done automatically
That doesn't sound like a good idea to me. I think you're asking for trouble,
here.
> using the dates the files where added
That's definitely a bad idea, IMO - no necessary relation.
> and assuming the files only works for the
> then current released version of Emacs?
Bad assumption. And what is the "current released version" - moving
target/interpretation.
I would advise against trying to guess compatibility like that. Let library
authors determine and specify the compatibilities explicitly. Else assume
nothing.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: Is there any elisp functions to tell whether the cursor is in a comment block?
2008-07-15 22:06 ` Drew Adams
@ 2008-07-15 22:19 ` Lennart Borgman (gmail)
2008-07-15 22:32 ` Drew Adams
[not found] ` <mailman.14800.1216160423.18990.help-gnu-emacs@gnu.org>
1 sibling, 1 reply; 31+ messages in thread
From: Lennart Borgman (gmail) @ 2008-07-15 22:19 UTC (permalink / raw)
To: Drew Adams; +Cc: 'Tom Tromey', help-gnu-emacs
Drew Adams wrote:
>> I would suggest a shorter version of the compatibility line, like
>> ;; Compatibility: Emacs=20.*,21.*,22.* XEmacs=unknown
>
...
> That kind of thing is not much of a problem if it is only people that read a
> Compatibility field. But if tools do that, then there would need to be a
> well-defined syntax to communicate the various possibilities unambiguously.
Sure.
> `unknown' doesn't seem useful to me. But how should absence be interpreted, in
> general: as unknown or incompatible?
Maybe
;; Compatible: Emacs=21.*,22.*
;; Incompatible: Emacs=20.*, XEmacs
And absence == unknown.
>> I would also suggest adding this information to all elisp files on
>> EmacsWiki. Perhaps this can be done automatically
>
> That doesn't sound like a good idea to me. I think you're asking for trouble,
> here.
>
>> using the dates the files where added
>
> That's definitely a bad idea, IMO - no necessary relation.
>
>> and assuming the files only works for the
>> then current released version of Emacs?
>
> Bad assumption. And what is the "current released version" - moving
> target/interpretation.
>
> I would advise against trying to guess compatibility like that. Let library
> authors determine and specify the compatibilities explicitly. Else assume
> nothing.
I have asked for that before, but nothing happened. That means that the
burden is now on the users.
Maybe something like this can be used then:
1) Announce that an automatic change as above will be made unless
package authors (or someone else) adds the Compatible label.
2) Do the automatic change after some weeks.
^ permalink raw reply [flat|nested] 31+ messages in thread
* RE: Is there any elisp functions to tell whether the cursor is in a comment block?
2008-07-15 22:19 ` Lennart Borgman (gmail)
@ 2008-07-15 22:32 ` Drew Adams
2008-07-15 22:47 ` Lennart Borgman (gmail)
0 siblings, 1 reply; 31+ messages in thread
From: Drew Adams @ 2008-07-15 22:32 UTC (permalink / raw)
To: 'Lennart Borgman (gmail)'; +Cc: 'Tom Tromey', help-gnu-emacs
> >> I would also suggest adding this information to all elisp files on
> >> EmacsWiki. Perhaps this can be done automatically
> >
> > I would advise against trying to guess compatibility like
> > that. Let library authors determine and specify the compatibilities
> > explicitly. Else assume nothing.
>
> I have asked for that before, but nothing happened. That
> means that the burden is now on the users.
> Maybe something like this can be used then:
>
> 1) Announce that an automatic change as above will be made unless
> package authors (or someone else) adds the Compatible label.
> 2) Do the automatic change after some weeks.
This is a discussion for Emacs Wiki, not here.
Personally, I disagree with any automatic messing with source code contributed
to the wiki. Please leave the source code as its contributors wrote it.
Anyway, if a tool can automatically massage source code to produce input for
another tool, then the second tool can do its own automatic massaging. IOW, do
this on the fly, if you must do it, but leave the contributed source code alone.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: Is there any elisp functions to tell whether the cursor is in a comment block?
2008-07-15 22:32 ` Drew Adams
@ 2008-07-15 22:47 ` Lennart Borgman (gmail)
2008-07-15 22:53 ` Drew Adams
0 siblings, 1 reply; 31+ messages in thread
From: Lennart Borgman (gmail) @ 2008-07-15 22:47 UTC (permalink / raw)
To: Drew Adams; +Cc: 'Tom Tromey', help-gnu-emacs
Drew Adams wrote:
>>>> I would also suggest adding this information to all elisp files on
>>>> EmacsWiki. Perhaps this can be done automatically
>>> I would advise against trying to guess compatibility like
>>> that. Let library authors determine and specify the compatibilities
>>> explicitly. Else assume nothing.
>> I have asked for that before, but nothing happened. That
>> means that the burden is now on the users.
>> Maybe something like this can be used then:
>>
>> 1) Announce that an automatic change as above will be made unless
>> package authors (or someone else) adds the Compatible label.
>> 2) Do the automatic change after some weeks.
>
> This is a discussion for Emacs Wiki, not here.
>
> Personally, I disagree with any automatic messing with source code contributed
> to the wiki. Please leave the source code as its contributors wrote it.
Well, the automatic procedure could instead produce a wiki page with the
compatibility information. Would that be good?
^ permalink raw reply [flat|nested] 31+ messages in thread
* RE: Is there any elisp functions to tell whether the cursor is in a comment block?
2008-07-15 22:47 ` Lennart Borgman (gmail)
@ 2008-07-15 22:53 ` Drew Adams
0 siblings, 0 replies; 31+ messages in thread
From: Drew Adams @ 2008-07-15 22:53 UTC (permalink / raw)
To: 'Lennart Borgman (gmail)'; +Cc: 'Tom Tromey', help-gnu-emacs
> Well, the automatic procedure could instead produce a wiki
> page with the compatibility information. Would that be good?
Dunno. When info is created automatically, there is a risk that it be wrong.
When info is duplicated outside the source file, there is a risk that it be
different (not up-to-date). I don't really have more to say about this.
^ permalink raw reply [flat|nested] 31+ messages in thread
[parent not found: <mailman.14800.1216160423.18990.help-gnu-emacs@gnu.org>]
* Re: Is there any elisp functions to tell whether the cursor is in a comment block?
[not found] ` <mailman.14800.1216160423.18990.help-gnu-emacs@gnu.org>
@ 2008-07-17 17:40 ` Giorgos Keramidas
0 siblings, 0 replies; 31+ messages in thread
From: Giorgos Keramidas @ 2008-07-17 17:40 UTC (permalink / raw)
To: help-gnu-emacs
On Wed, 16 Jul 2008 00:19:26 +0200, "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> wrote:
> Drew Adams wrote:
>>> I would suggest a shorter version of the compatibility line, like
>>> ;; Compatibility: Emacs=20.*,21.*,22.* XEmacs=unknown
>>
> ...
>> That kind of thing is not much of a problem if it is only people that read a
>> Compatibility field. But if tools do that, then there would need to be a
>> well-defined syntax to communicate the various possibilities unambiguously.
>
> Sure.
>
>> `unknown' doesn't seem useful to me. But how should absence be interpreted, in
>> general: as unknown or incompatible?
>
> Maybe
>
> ;; Compatible: Emacs=21.*,22.*
> ;; Incompatible: Emacs=20.*, XEmacs
>
> And absence == unknown.
That's probably a good idea. Something like the Debian dependency
system, with tags like
>= GNU Emacs 21.1
may also be nice. The FreeBSD ports have a ${CONFLICTS} makefile
convention that may be useful too. The editors/emacs and
editors/emacs-devel ports install files with the same name, so they
include ${CONFLICTS} like this:
CONFLICTS= emacs-19.* emacs-21.* emacs-22.* \
xemacs-[0-9]* xemacs-devel-[0-9]* \
xemacs-mule-[0-9]* xemacs-devel-mule-[0-9]*
We could probably use something similar to mark up compatibility
comments, i.e.:
;; Compatible: emacs-21.*, emacs-22.*, xemacs-21.3
;; Incompatible: emacs-19.*, emacs-20.*, xemacs-21.4
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: Is there any elisp functions to tell whether the cursor is in a comment block?
2008-07-14 20:10 ` Joe Bloggs
2008-07-14 23:20 ` Lennart Borgman (gmail)
@ 2008-07-17 17:30 ` Giorgos Keramidas
2008-07-19 15:17 ` Joe Bloggs
1 sibling, 1 reply; 31+ messages in thread
From: Giorgos Keramidas @ 2008-07-17 17:30 UTC (permalink / raw)
To: help-gnu-emacs
On Mon, 14 Jul 2008 21:10:56 +0100, Joe Bloggs <who@cares.invalid> wrote:
>"Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:
>> Just out of curiosity: Why don't you upgrade to Emacs 22?
>
> I tried, but couldn't get it to work properly. I wasted a whole day
> ****ing around with my .emacs, load-path etc. I use quite a lot of
> packages and I'm not sure which ones are compatible or not. So for the
> moment I'm sticking with what works (i.e. emacs 21). Actually maybe
> you could give me some tips on a smooth transition? My OS is Debian
> Etch. Currently I get the following error when I start up emacs 22.2:
>
> "File error: Cannot open load file, tramp-gw"
>
> which means I can't use tramp.
You can definitely use tramp with Emacs 22. [I've been using it ever
since it became part of the CVS tree of Emacs 22, before it was actually
released as Emacs 22.1.]
The only caveat is that it is now part of Emacs itself, so if you are
using a custom installation of tramp for Emacs 21.X it may be worth
*removing* the custom local tramp package from the default load-path;
this way the default tramp package that is now part of Emacs will take
over and it should Just Work(TM) out of the box.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: Is there any elisp functions to tell whether the cursor is in a comment block?
2008-07-17 17:30 ` Giorgos Keramidas
@ 2008-07-19 15:17 ` Joe Bloggs
2008-07-20 0:10 ` Giorgos Keramidas
0 siblings, 1 reply; 31+ messages in thread
From: Joe Bloggs @ 2008-07-19 15:17 UTC (permalink / raw)
To: help-gnu-emacs
Giorgos Keramidas <keramida@ceid.upatras.gr> writes:
> On Mon, 14 Jul 2008 21:10:56 +0100, Joe Bloggs <who@cares.invalid> wrote:
>>"Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:
>>> Just out of curiosity: Why don't you upgrade to Emacs 22?
>>
>> I tried, but couldn't get it to work properly. I wasted a whole day
>> ****ing around with my .emacs, load-path etc. I use quite a lot of
>> packages and I'm not sure which ones are compatible or not. So for the
>> moment I'm sticking with what works (i.e. emacs 21). Actually maybe
>> you could give me some tips on a smooth transition? My OS is Debian
>> Etch. Currently I get the following error when I start up emacs 22.2:
>>
>> "File error: Cannot open load file, tramp-gw"
>>
>> which means I can't use tramp.
>
> You can definitely use tramp with Emacs 22. [I've been using it ever
> since it became part of the CVS tree of Emacs 22, before it was actually
> released as Emacs 22.1.]
>
> The only caveat is that it is now part of Emacs itself, so if you are
> using a custom installation of tramp for Emacs 21.X it may be worth
> *removing* the custom local tramp package from the default load-path;
> this way the default tramp package that is now part of Emacs will take
> over and it should Just Work(TM) out of the box.
Did that thanks and now it works fine, apart from integration with gud & gdb.
I have no indication in the source buffer of where the current line of execution is.
Have you got this working?
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: Is there any elisp functions to tell whether the cursor is in a comment block?
2008-07-19 15:17 ` Joe Bloggs
@ 2008-07-20 0:10 ` Giorgos Keramidas
0 siblings, 0 replies; 31+ messages in thread
From: Giorgos Keramidas @ 2008-07-20 0:10 UTC (permalink / raw)
To: help-gnu-emacs
On Sat, 19 Jul 2008 16:17:07 +0100, Joe Bloggs <who@cares.invalid> wrote:
>Giorgos Keramidas <keramida@ceid.upatras.gr> writes:
>> You can definitely use tramp with Emacs 22. [I've been using it ever
>> since it became part of the CVS tree of Emacs 22, before it was
>> actually released as Emacs 22.1.]
>>
>> The only caveat is that it is now part of Emacs itself, so if you are
>> using a custom installation of tramp for Emacs 21.X it may be worth
>> *removing* the custom local tramp package from the default load-path;
>> this way the default tramp package that is now part of Emacs will
>> take over and it should Just Work(TM) out of the box.
>
> Did that thanks and now it works fine, apart from integration with gud
> & gdb. I have no indication in the source buffer of where the current
> line of execution is. Have you got this working?
Mmm, no, not really. I'm sorry about that regression.
I'm rarely using gud/gdb from within Emacs, so someone else with more
experience using those tools should help :/
^ permalink raw reply [flat|nested] 31+ messages in thread
end of thread, other threads:[~2008-07-20 13:59 UTC | newest]
Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-13 5:06 Is there any elisp functions to tell whether the cursor is in a comment block? sunway
2008-07-13 9:53 ` Johan Bockgård
2008-07-13 17:55 ` Joe Bloggs
2008-07-13 19:03 ` Johan Bockgård
2008-07-14 1:36 ` Joe Bloggs
2008-07-14 1:49 ` Johan Bockgård
2008-07-14 1:36 ` sunway
2008-07-14 15:05 ` Joe Bloggs
2008-07-14 15:44 ` Lennart Borgman (gmail)
[not found] ` <mailman.14707.1216050306.18990.help-gnu-emacs@gnu.org>
2008-07-14 20:10 ` Joe Bloggs
2008-07-14 23:20 ` Lennart Borgman (gmail)
2008-07-14 23:43 ` Drew Adams
2008-07-14 23:49 ` Lennart Borgman (gmail)
2008-07-15 6:02 ` Drew Adams
[not found] ` <mailman.14727.1216079418.18990.help-gnu-emacs@gnu.org>
2008-07-15 22:27 ` David Kastrup
2008-07-20 13:59 ` Eli Zaretskii
2008-07-15 1:27 ` Tom Tromey
2008-07-15 7:31 ` Lennart Borgman (gmail)
2008-07-15 14:15 ` Drew Adams
2008-07-15 20:50 ` Lennart Borgman (gmail)
2008-07-15 21:21 ` Drew Adams
2008-07-15 21:34 ` Lennart Borgman (gmail)
2008-07-15 22:06 ` Drew Adams
2008-07-15 22:19 ` Lennart Borgman (gmail)
2008-07-15 22:32 ` Drew Adams
2008-07-15 22:47 ` Lennart Borgman (gmail)
2008-07-15 22:53 ` Drew Adams
[not found] ` <mailman.14800.1216160423.18990.help-gnu-emacs@gnu.org>
2008-07-17 17:40 ` Giorgos Keramidas
2008-07-17 17:30 ` Giorgos Keramidas
2008-07-19 15:17 ` Joe Bloggs
2008-07-20 0:10 ` Giorgos Keramidas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).