- Subject: Re: Re: New LaTeX mode on CTAN
- From: Guenter Milde <milde@xxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 6 Dec 2002 11:16:37 +0100 (CET)
On Fri, 6 Dec 2002 09:31:48 +0100 (CET) wrote Guido Gonzato <ggonza@xxxxxx>:
...
> I'll have a look and apply the patch.
...
> some of the points you suggest are already in my to-do list. I'm going to
> add these features in the next few weeks.
Good news...
I forgot to mention the request for an integrated help_for_word_at_point
feature. (I remember you wrote about a solution once, but I could not
reproduce it then and by now I forgot what it was exactly.)
Günter
BTW, I consider Guidos context sensitive function_help to be one of the
most important improvements of jed in the last years. It is a pity, that the
patch to man.sl did not find its way to the 99.16 distribution.
Here is my extensible version: New modes can easily declare their own
help functions by, e.g.,
define python_mode_hook ()
{
define_blocal_var("help_for_word_hook", "py_help");
}
% --- excerpt from my new version of help.sl (to be published at jmr) ----
% valid chars in function and variable definitions
static variable Slang_word_chars = "A-Za-z0-9_";
%!%+
%\function{help_for_word_at_point}
%\synopsis{Give (mode dependend) help for word under cursor}
%\usage{Void help_for_word_at_point ()}
%\description
% Find the word under the cursor and give mode-dependend help.
%\seealso{describe_function, describe_variable}
%!%-
public define help_for_word_at_point ()
{
variable word_at_point = bget_word(Slang_word_chars);
% try blocal hook first
if (run_function(get_blocal("help_for_word_hook", NULL), word_at_point))
return;
% default
if (word_at_point == "")
error("don't know what to give help for");
describe_function(word_at_point);
}
% --- needed auxiliary functions from bufutils.sl and txtutils.sl ---
% (to be published at jmr) ---
% mark a word (going backward if between two words)
public define bmark_word () % bmark_word(word_chars = get_word_chars())
{
variable word_chars = get_word_chars();
if(_NARGS)
word_chars = ();
% go to end of word under cursor, stay when not in a word
skip_chars(word_chars);
% go to end of word before cursor, if not in a word
bskip_chars("^"+word_chars);
push_visible_mark();
bskip_chars(word_chars); % goto beg of word
check_region(0);
}
% return the word at point as string (going backward if between two words)
% if a visible region is defined, return it instead
public define bget_word()
{
% pass on optional arguments
variable args = __pop_args(_NARGS);
push_spot;
!if (is_visible_mark)
bmark_word (__push_args(args));
bufsubstr();
pop_spot();
}
% Run a function if it exists. Return whether it exists or not
% The function can be given by name or by reference (this allows both:
% yet undefined function (as string) as well as static functions
% (as reference)
% Any arguments following the function argument will be passed to the
% function. (if fun is an internal function, the optional arguments will
% be just popped.)
define run_function() % (fun, [args])
{
variable args = __pop_args(_NARGS-1);
variable fun = ();
if (typeof(fun) == String_Type)
{
if (is_defined(fun) > 0)
fun = __get_reference(fun);
else if (is_internal(fun))
{
call(fun);
return 1;
}
}
if (typeof(fun) == Ref_Type)
{
@fun(__push_args(args));
return 1;
}
return 0;
}
%!%+
%\function{get_blocal}
%\synopsis{return value of blocal variable or default value}
%\usage{Any get_blocal (String name, [Any default=NULL])}
%\description
% This function is similar to get_blocal_var, but if the local variable
% "name" doesnot exist, it returns the default value instead of an error.
% Default defaults to NULL.
%\example
%#v+
% if (get_blocal(foo), 0)
% message("this buffer is fooish");
%#v-
% will print the message if foo is a blocal variable with nonzero value.
%\seealso{get_blocal_var, blocal_var_exists}
%!%-
define get_blocal() % (name, default=NULL)
{
variable name, default=NULL;
if (_NARGS > 1)
default = ();
name = ();
if (blocal_var_exists(name))
return get_blocal_var(name);
return default;
}
--
Milde at ife.et.tu-dresden.de
--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.
[2002 date index]
[2002 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]