all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: pietru@caramail.com
To: Arthur Miller <arthur.miller@live.com>
Cc: Michael Heerdegen <michael_heerdegen@web.de>, help-gnu-emacs@gnu.org
Subject: Re: Optional Arguments
Date: Mon, 7 Dec 2020 22:21:22 +0100	[thread overview]
Message-ID: <trinity-88893a75-18fa-4bc2-8dfe-a1b039e7fdf2-1607376082779@3c-app-mailcom-bs08> (raw)
In-Reply-To: <AM0PR06MB6577C119DB37574B55C77FD996CE0@AM0PR06MB6577.eurprd06.prod.outlook.com>

> Sent: Monday, December 07, 2020 at 9:52 PM
> From: "Arthur Miller" <arthur.miller@live.com>
> To: "Michael Heerdegen" <michael_heerdegen@web.de>
> Cc: help-gnu-emacs@gnu.org
> Subject: Re: Optional Arguments
>
> Michael Heerdegen <michael_heerdegen@web.de> writes:
>
> > pietru@caramail.com writes:
> >
> >> Am getting an error with the following.
> >>
> >> (defun word-markers ()
> >>    (let ((ma mb)) <--

I see it now, the parenthesis was assigning to ma other than nil.
Thank you so very much.

> > You bind `ma' to the value of `mb'.  That's not what you want.
> Exactly; this is what I had in my scratch when I tested: I just didn't
> copy everything in previous answer:
>
> (defun word-markers ()
>   (let (ma mb)
>     (skip-chars-backward "[:alpha:]")
>     (setq ma (point))
>     (skip-chars-forward "[:alpha:]")
>     (setq mb (point))
>     (cons ma mb)))
>
> (defun test ()
>    (interactive)
>    (let ((deactivate-mark nil)
>          bounds ma mb)
>      (if (use-region-p)
>          (setq ma (region-beginning) mb (region-end))
>        (save-excursion
>          (setq bounds (word-markers))
>          (setq ma (car bounds))
>          (setq mb (cdr bounds))))
>    (message "Bounds: %s" (pp bounds))
>    (message "Region: [%s %s]" ma mb)
>    (message "Region-string: [%s]" (buffer-substring-no-properties ma mb))))
>
> (test)
>
> Tou should drop one parenthesis around ma and mb in your let
> expression. That will declare two variables and initialize them to nil both.
>
>



  reply	other threads:[~2020-12-07 21:21 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-07  3:17 Optional Arguments pietru
2020-12-07  8:16 ` Alexis Roda
2020-12-07 12:37   ` pietru
2020-12-07 13:06     ` tomas
2020-12-07 13:35       ` Anders Dalskov
2020-12-07 14:24       ` pietru
2020-12-07 15:38         ` tomas
2020-12-07 18:13           ` pietru
2020-12-07 19:01             ` Arthur Miller
2020-12-07 19:42               ` pietru
2020-12-07 19:54                 ` Michael Heerdegen
2020-12-07 20:21                   ` pietru
2020-12-07 20:52                   ` Arthur Miller
2020-12-07 21:21                     ` pietru [this message]
2020-12-07 19:51             ` Alexis Roda
2020-12-07 15:06       ` pietru
2020-12-07 15:51         ` tomas
2020-12-07 17:51           ` pietru
2020-12-07 18:33             ` Arthur Miller
2020-12-07 18:49               ` pietru
2020-12-07 20:13             ` Stefan Monnier
2020-12-07 20:25               ` pietru
2020-12-07 20:39                 ` Christopher Dimech

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=trinity-88893a75-18fa-4bc2-8dfe-a1b039e7fdf2-1607376082779@3c-app-mailcom-bs08 \
    --to=pietru@caramail.com \
    --cc=arthur.miller@live.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=michael_heerdegen@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.