* function Qs
@ 2007-02-24 21:07 Dan Bensen
2007-02-24 21:18 ` weber
0 siblings, 1 reply; 11+ messages in thread
From: Dan Bensen @ 2007-02-24 21:07 UTC (permalink / raw)
To: help-gnu-emacs
Hi everybody. I have two questions, please:
1. It looks like set-mark-command and indent-region take arguments
when called from another function. Where's the documentation for
Emacs function signatures? They don't seem to be in the Emacs manual.
2. beginning-of-buffer, end-of-line, etc. all move point to the
specified position. Are there equivalent functions that return
the value of the corresponding position without side effects?
--
Dan
www.prairienet.org/~dsb
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: function Qs
2007-02-24 21:07 function Qs Dan Bensen
@ 2007-02-24 21:18 ` weber
2007-02-24 22:58 ` Dan Bensen
0 siblings, 1 reply; 11+ messages in thread
From: weber @ 2007-02-24 21:18 UTC (permalink / raw)
To: help-gnu-emacs
On 24 fev, 18:07, Dan Bensen <randomg...@cyberspace.net> wrote:
> Hi everybody. I have two questions, please:
>
> 1. It looks like set-mark-command and indent-region take arguments
> when called from another function. Where's the documentation for
> Emacs function signatures? They don't seem to be in the Emacs manual.
>
> 2. beginning-of-buffer, end-of-line, etc. all move point to the
> specified position. Are there equivalent functions that return
> the value of the corresponding position without side effects?
>
> --
> Danwww.prairienet.org/~dsb
1. Documentation for functions is easily accessed with Control-h f and
then enter the name of the function.
2. You can always do a "save-excursion" before calling those
functions... check it with C-h f as well.
Maybe it would be better if you told us what to you want to
accomplish... there might be an easier way.
Cheers,
weber
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: function Qs
2007-02-24 21:18 ` weber
@ 2007-02-24 22:58 ` Dan Bensen
2007-02-24 23:50 ` Drew Adams
0 siblings, 1 reply; 11+ messages in thread
From: Dan Bensen @ 2007-02-24 22:58 UTC (permalink / raw)
To: help-gnu-emacs
weber wrote:
> 1. Documentation for functions is easily accessed with Control-h f and
> then enter the name of the function.
Very nice. Thank you.
> Maybe it would be better if you told us what to you want to
> accomplish... there might be an easier way.
Nah, that's no fun* :) The current problem isn't nearly as important as
the general learning experience.
According to the help section for end-of-buffer,
point-max is the equivalent function I'm looking for.
Are there more functions like this? point-min? point-end-of-line? I
don't see them documented.
The help section for set-mark says to define your own variable instead
of using mark:
(let ((beg (point))) (forward-line 1) (delete-region beg (point)))
With return values, this could be written something like
(delete-region (point) (point-next-line))
So it sounds like changing point is standard procedure, but changing
mark is discouraged?
*This is what I've been trying to do (it seems to work now):
(defun indent-buffer ()
(interactive)
(indent-region 1 (point-max) nil))
--
Dan
www.prairienet.org/~dsb
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: function Qs
2007-02-24 22:58 ` Dan Bensen
@ 2007-02-24 23:50 ` Drew Adams
2007-02-25 3:19 ` Matthew Flaschen
[not found] ` <mailman.68.1172373580.7795.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 11+ messages in thread
From: Drew Adams @ 2007-02-24 23:50 UTC (permalink / raw)
To: Dan Bensen, help-gnu-emacs
> Are there more functions like this? point-min? point-end-of-line? I
> don't see them documented.
M-x apropos point
Command `apropos' is your friend.
The Elisp manual, not the Emacs manual, is the reference for Emacs-Lisp
code. All of the functions you have asked about are explained there. Both
manuals are available via `C-h i'.
> So it sounds like changing point is standard procedure, but changing
> mark is discouraged?
Correct. Actually, both are discouraged if the user doesn't expect any
change. To move point temporarily to obtain a location, wrap the movement in
`save-excursion'.
Again, this is explained in the Elisp manual.
> *This is what I've been trying to do (it seems to work now):
> (defun indent-buffer ()
> (interactive)
> (indent-region 1 (point-max) nil))
(point-min), not 1.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: function Qs
2007-02-24 23:50 ` Drew Adams
@ 2007-02-25 3:19 ` Matthew Flaschen
2007-02-25 4:37 ` Matthew Flaschen
[not found] ` <mailman.68.1172373580.7795.help-gnu-emacs@gnu.org>
1 sibling, 1 reply; 11+ messages in thread
From: Matthew Flaschen @ 2007-02-25 3:19 UTC (permalink / raw)
To: emacs
[-- Attachment #1.1: Type: text/plain, Size: 595 bytes --]
Drew Adams wrote:
>> Are there more functions like this? point-min? point-end-of-line? I
>> don't see them documented.
>
> M-x apropos point
>
> Command `apropos' is your friend.
>
> The Elisp manual, not the Emacs manual, is the reference for Emacs-Lisp
> code. All of the functions you have asked about are explained there. Both
> manuals are available via `C-h i'.
I searched apropos for point, and I can't find a point-end-of-line or
equivalent. Is there such a function? If not, do you know a way I
could get the full text of the current line?
Matthew Flaschen
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 254 bytes --]
[-- Attachment #2: Type: text/plain, Size: 152 bytes --]
_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: function Qs
2007-02-25 3:19 ` Matthew Flaschen
@ 2007-02-25 4:37 ` Matthew Flaschen
0 siblings, 0 replies; 11+ messages in thread
From: Matthew Flaschen @ 2007-02-25 4:37 UTC (permalink / raw)
To: emacs
[-- Attachment #1.1: Type: text/plain, Size: 758 bytes --]
Matthew Flaschen wrote:
> Drew Adams wrote:
>>> Are there more functions like this? point-min? point-end-of-line? I
>>> don't see them documented.
>> M-x apropos point
>>
>> Command `apropos' is your friend.
>>
>> The Elisp manual, not the Emacs manual, is the reference for Emacs-Lisp
>> code. All of the functions you have asked about are explained there. Both
>> manuals are available via `C-h i'.
>
> I searched apropos for point, and I can't find a point-end-of-line or
> equivalent. Is there such a function? If not, do you know a way I
> could get the full text of the current line?
I figured it out:
(buffer-substring-no-properties (line-beginning-position)
(line-end-position))
Is there a neater way?
Matt Flaschen
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 254 bytes --]
[-- Attachment #2: Type: text/plain, Size: 152 bytes --]
_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: function Qs
[not found] ` <mailman.68.1172373580.7795.help-gnu-emacs@gnu.org>
@ 2007-02-25 4:43 ` james
2007-02-25 6:57 ` Matthew Flaschen
2007-02-25 15:27 ` Drew Adams
0 siblings, 2 replies; 11+ messages in thread
From: james @ 2007-02-25 4:43 UTC (permalink / raw)
To: help-gnu-emacs
On Feb 24, 9:19 pm, Matthew Flaschen <matthew.flasc...@gatech.edu>
wrote:
>
> I searched apropos for point, and I can't find a point-end-of-line or
> equivalent. Is there such a function? If not, do you know a way I
> could get the full text of the current line?
>
> Matthew Flaschen
apropos only searches interactive functions (those that can be called
by M-x) by default... but if you give it a parameter:
C-u C-h a point
(I just discovered this myself by: C-h f apropos)
Looks like what you're looking for is point-at-bol and point-at-eol:
(setq line-string
(buffer-substring (point-at-bol) (point-at-eol)))
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: function Qs
2007-02-25 4:43 ` james
@ 2007-02-25 6:57 ` Matthew Flaschen
2007-02-25 15:27 ` Drew Adams
1 sibling, 0 replies; 11+ messages in thread
From: Matthew Flaschen @ 2007-02-25 6:57 UTC (permalink / raw)
To: emacs
[-- Attachment #1.1: Type: text/plain, Size: 944 bytes --]
james wrote:
> On Feb 24, 9:19 pm, Matthew Flaschen <matthew.flasc...@gatech.edu>
> wrote:
>> I searched apropos for point, and I can't find a point-end-of-line or
>> equivalent. Is there such a function? If not, do you know a way I
>> could get the full text of the current line?
>>
>> Matthew Flaschen
>
> apropos only searches interactive functions (those that can be called
> by M-x) by default... but if you give it a parameter:
Yes, I figured that out myself, and just changed it by setting
apropos-do-all (non-interactive functions are kind of important when
you're coding elisp).
> Looks like what you're looking for is point-at-bol and point-at-eol:
>
> (setq line-string
> (buffer-substring (point-at-bol) (point-at-eol)))
Thanks, I ended up using the unaliased versions of those (however, that
method will copy text properties into the string, which may not be what
you want).
Matthew Flaschen
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 254 bytes --]
[-- Attachment #2: Type: text/plain, Size: 152 bytes --]
_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: function Qs
2007-02-25 4:43 ` james
2007-02-25 6:57 ` Matthew Flaschen
@ 2007-02-25 15:27 ` Drew Adams
2007-02-25 15:36 ` Matthew Flaschen
1 sibling, 1 reply; 11+ messages in thread
From: Drew Adams @ 2007-02-25 15:27 UTC (permalink / raw)
To: help-gnu-emacs
> apropos only searches interactive functions (those that can be called
> by M-x) by default... but if you give it a parameter:
> C-u C-h a point
> (I just discovered this myself by: C-h f apropos)
> Looks like what you're looking for is point-at-bol and point-at-eol:
Absolutely untrue. `C-h f apropos' gives this:
Show all meaningful Lisp symbols whose names match PATTERN.
Symbols are shown if they are defined as functions, variables, or
faces, or if they have nonempty property lists....
Both `point-at-bol' and `point-at-eol' are listed with `M-x apropos'.
Using `C-u' with `apropos', or setting `apropos-do-all' to non-nil gives you
info about *all* symbols, not just "functions, variables, or faces,..." But
all functions are treated by `apropos' even without `C-u'.
Do not confuse `C-h a', which is bound to command `apropos-command', with
command `apropos'. There are other apropos commands as well: `C-h a
apropos'.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: function Qs
2007-02-25 15:27 ` Drew Adams
@ 2007-02-25 15:36 ` Matthew Flaschen
2007-02-25 22:54 ` Kevin Rodgers
0 siblings, 1 reply; 11+ messages in thread
From: Matthew Flaschen @ 2007-02-25 15:36 UTC (permalink / raw)
To: emacs
[-- Attachment #1.1: Type: text/plain, Size: 827 bytes --]
Drew Adams wrote:
>> apropos only searches interactive functions (those that can be called
>> by M-x) by default... but if you give it a parameter:
>> C-u C-h a point
>> (I just discovered this myself by: C-h f apropos)
>> Looks like what you're looking for is point-at-bol and point-at-eol:
>
> Absolutely untrue. `C-h f apropos' gives this:
Yes, but C-h f apropros-command gives:
Show commands (interactively callable functions) that match APROPOS-REGEXP.
With optional prefix DO-ALL, or if `apropos-do-all' is non-nil, also
show noninteractive functions.
> Do not confuse `C-h a', which is bound to command `apropos-command', with
> command `apropos'. There are other apropos commands as well: `C-h a
> apropos'.
Thanks, I never noticed that. I just rebound C-h a to apropos.
Matthew Flaschen
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 254 bytes --]
[-- Attachment #2: Type: text/plain, Size: 152 bytes --]
_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: function Qs
2007-02-25 15:36 ` Matthew Flaschen
@ 2007-02-25 22:54 ` Kevin Rodgers
0 siblings, 0 replies; 11+ messages in thread
From: Kevin Rodgers @ 2007-02-25 22:54 UTC (permalink / raw)
To: help-gnu-emacs
Matthew Flaschen wrote:
> Drew Adams wrote:
>> Do not confuse `C-h a', which is bound to command `apropos-command', with
>> command `apropos'. There are other apropos commands as well: `C-h a
>> apropos'.
>
> Thanks, I never noticed that. I just rebound C-h a to apropos.
You can have both:
(global-set-key "\C-hA" 'apropos)
--
Kevin Rodgers
Denver, Colorado, USA
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2007-02-25 22:54 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-24 21:07 function Qs Dan Bensen
2007-02-24 21:18 ` weber
2007-02-24 22:58 ` Dan Bensen
2007-02-24 23:50 ` Drew Adams
2007-02-25 3:19 ` Matthew Flaschen
2007-02-25 4:37 ` Matthew Flaschen
[not found] ` <mailman.68.1172373580.7795.help-gnu-emacs@gnu.org>
2007-02-25 4:43 ` james
2007-02-25 6:57 ` Matthew Flaschen
2007-02-25 15:27 ` Drew Adams
2007-02-25 15:36 ` Matthew Flaschen
2007-02-25 22:54 ` Kevin Rodgers
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.