unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* two function requests
@ 2012-08-01 15:45 drain
  2012-08-01 16:11 ` Doug Lewan
  2012-08-01 16:24 ` PJ Weisberg
  0 siblings, 2 replies; 5+ messages in thread
From: drain @ 2012-08-01 15:45 UTC (permalink / raw)
  To: Help-gnu-emacs


(1) A command that deletes every instance of a certain char, e.g., "_" is
entered and every "_" is deleted from the text. Would be very useful when
formatting pdfs into orgs.

(2) (forward-clause), (backward-clause) commands, which would be much more
useful than (forward-sentence), (backward-sentence), particularly when
formatting / reading pre-20th century literature, with its page-length
Herman Melville sentences. 

I suppose a function that sets point to next comma is what I am looking for,
even if I'd be stuck incrementally moving inside of lists from time to time. 

I'm asking whether these functions or similar functions already exist. If I
were to write them myself, I also wouldn't mind being pointed in the right
direction for models. I'm sure this would require just slight modification
of the existing code base.
-- 
View this message in context: http://old.nabble.com/two-function-requests-tp34241363p34241363.html
Sent from the Emacs - Help mailing list archive at Nabble.com.




^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: two function requests
  2012-08-01 15:45 drain
@ 2012-08-01 16:11 ` Doug Lewan
  2012-08-01 16:24 ` PJ Weisberg
  1 sibling, 0 replies; 5+ messages in thread
From: Doug Lewan @ 2012-08-01 16:11 UTC (permalink / raw)
  To: drain, Help-gnu-emacs@gnu.org

(2) -- clause definition -- would be very useful.

Every time I land in a new work environment this comes to my mind (and then gets buried by the work at hand).

Here are some of the core ideas that I find in my current [lack of] design:

- Extend the logic of sentence definition to include commas, semicolons and colons. (There may be others.)
- Identify words and phrases that begin clauses (and, but, or, if, then, otherwise, when, whenever, etc.)
- Define the hierarchy that governs priority of those words and phrases.
- Define the rules governing clause definition given priorities.

Once you've got the above(!), then motion, intelligent wrapping, etc. should be easy.

Yours in deferred laziness,

,Doug

P.S. Is there a connection between your two requests?

> -----Original Message-----
> From: help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org
> [mailto:help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org] On
> Behalf Of drain
> Sent: Wednesday, 2012 August 01 11:46
> To: Help-gnu-emacs@gnu.org
> Subject: two function requests
> 
> 
> (1) A command that deletes every instance of a certain char, e.g., "_"
> is
> entered and every "_" is deleted from the text. Would be very useful
> when
> formatting pdfs into orgs.
> 
> (2) (forward-clause), (backward-clause) commands, which would be much
> more
> useful than (forward-sentence), (backward-sentence), particularly when
> formatting / reading pre-20th century literature, with its page-length
> Herman Melville sentences.
> 
> I suppose a function that sets point to next comma is what I am looking
> for,
> even if I'd be stuck incrementally moving inside of lists from time to
> time.
> 
> I'm asking whether these functions or similar functions already exist.
> If I
> were to write them myself, I also wouldn't mind being pointed in the
> right
> direction for models. I'm sure this would require just slight
> modification
> of the existing code base.
> --
> View this message in context: http://old.nabble.com/two-function-
> requests-tp34241363p34241363.html
> Sent from the Emacs - Help mailing list archive at Nabble.com.
> 




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: two function requests
  2012-08-01 15:45 drain
  2012-08-01 16:11 ` Doug Lewan
@ 2012-08-01 16:24 ` PJ Weisberg
  1 sibling, 0 replies; 5+ messages in thread
From: PJ Weisberg @ 2012-08-01 16:24 UTC (permalink / raw)
  To: drain; +Cc: Help-gnu-emacs

On Wed, Aug 1, 2012 at 8:45 AM, drain <aeuster@gmail.com> wrote:
>
> (1) A command that deletes every instance of a certain char, e.g., "_" is
> entered and every "_" is deleted from the text. Would be very useful when
> formatting pdfs into orgs.

`replace-string' (see also `replace-regexp')

The second argument can be an empty string.  It only replaces strings
*after* point, so you would have to move to the beginning of the
buffer first.

-PJ

Gehm's Corollary to Clark's Law: Any technology distinguishable from
magic is insufficiently advanced.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: two function requests
@ 2012-08-01 16:28 Dan Maftei
  2012-08-01 16:35 ` Alp Aker
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Maftei @ 2012-08-01 16:28 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1096 bytes --]

>
> From: drain <aeuster@gmail.com>
> To: Help-gnu-emacs@gnu.org
> Cc:
> Date: Wed, 1 Aug 2012 08:45:39 -0700 (PDT)
> Subject: two function requests
>
> (1) A command that deletes every instance of a certain char, e.g., "_" is
> entered and every "_" is deleted from the text. Would be very useful when
> formatting pdfs into orgs.
>

query-replace (M-%) and replace-regexp will do this for you, if you do not
enter anything in the replace string:

M-% _ <RET> <RET>


>
> (2) (forward-clause), (backward-clause) commands, which would be much more
> useful than (forward-sentence), (backward-sentence), particularly when
> formatting / reading pre-20th century literature, with its page-length
> Herman Melville sentences.
>
> I suppose a function that sets point to next comma is what I am looking
> for,
> even if I'd be stuck incrementally moving inside of lists from time to
> time.
>

Adapt forward-sentence and backward-sentence to your needs. C-h f <RET>
function-name will give you a link to the function code. Should be a fun
little project if you're new to emacs lisp (like I am!)

Dan

[-- Attachment #2: Type: text/html, Size: 1651 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: two function requests
  2012-08-01 16:28 two function requests Dan Maftei
@ 2012-08-01 16:35 ` Alp Aker
  0 siblings, 0 replies; 5+ messages in thread
From: Alp Aker @ 2012-08-01 16:35 UTC (permalink / raw)
  To: Dan Maftei; +Cc: help-gnu-emacs

>> (2) (forward-clause), (backward-clause) commands, which would be much more
>> useful than (forward-sentence), (backward-sentence), particularly when
>> formatting / reading pre-20th century literature, with its page-length
>> Herman Melville sentences.
>>
>> I suppose a function that sets point to next comma is what I am looking
>> for,
>> even if I'd be stuck incrementally moving inside of lists from time to
>> time.
>
> Adapt forward-sentence and backward-sentence to your needs. C-h f <RET>
> function-name will give you a link to the function code.

You don't need to alter the function itself for this sort of use.  All
you need to do is set the value of `sentence-end' to the appropriate
regex.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-08-01 16:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-01 16:28 two function requests Dan Maftei
2012-08-01 16:35 ` Alp Aker
  -- strict thread matches above, loose matches on Subject: below --
2012-08-01 15:45 drain
2012-08-01 16:11 ` Doug Lewan
2012-08-01 16:24 ` PJ Weisberg

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