Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
flet is obsolete, but...
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  11 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Sebastien Vauban  
View profile  
 More options Oct 10 2012, 8:39 am
Newsgroups: gnu.emacs.help
From: "Sebastien Vauban" <wxhgmqzgw...@spammotel.com>
Date: Wed, 10 Oct 2012 14:39:23 +0200
Local: Wed, Oct 10 2012 8:39 am
Subject: flet is obsolete, but...
Hello,

`flet' is an obsolete macro (as of 24.3); use either `cl-flet' or `cl-letf'.

But doing so in the following code:

--8<---------------cut here---------------start------------->8---
  (defun my/revert-buffer ()
    "Unconditionally revert current buffer."
    (interactive)
    (flet ((yes-or-no-p (msg) t))
      (revert-buffer)))
--8<---------------cut here---------------end--------------->8---

does not lead to the right things:

- use cl-flet, and the code doesn't behave as it should (i.e., it does ask for
  a confirmation, before reverting)

- use cl-letf, and you've got an error:
  cl-letf: `let' bindings can have only one value-form: yes-or-no-p, (msg), t

What should I do?

Best regards,
  Seb

--
Sebastien Vauban


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jambunathan K  
View profile  
 More options Oct 10 2012, 9:16 am
Newsgroups: gnu.emacs.help
From: Jambunathan K <kjambunat...@gmail.com>
Date: Wed, 10 Oct 2012 18:47:57 +0530
Local: Wed, Oct 10 2012 9:17 am
Subject: Re: flet is obsolete, but...

Use the NOCONFIRM of revert-buffer.

> Best regards,
>   Seb

--

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jambunathan K  
View profile  
 More options Oct 10 2012, 9:17 am
Newsgroups: gnu.emacs.help
From: Jambunathan K <kjambunat...@gmail.com>
Date: Wed, 10 Oct 2012 18:48:15 +0530
Local: Wed, Oct 10 2012 9:18 am
Subject: Re: flet is obsolete, but...

Use the NOCONFIRM argument of revert-buffer.

> Best regards,
>   Seb

--

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Barry Margolin  
View profile  
 More options Oct 10 2012, 10:31 am
Newsgroups: gnu.emacs.help
From: Barry Margolin <bar...@alum.mit.edu>
Date: Wed, 10 Oct 2012 10:31:18 -0400
Local: Wed, Oct 10 2012 10:31 am
Subject: Re: flet is obsolete, but...
In article <804nm2zekk....@somewhere.org>,
 "Sebastien Vauban" <wxhgmqzgw...@spammotel.com> wrote:

cl-flet does lexical binding, not dynamic.

> - use cl-letf, and you've got an error:
>   cl-letf: `let' bindings can have only one value-form: yes-or-no-p, (msg), t

> What should I do?

Sounds like you didn't write your cl-letf correctly. Did you read its
documentation? It's not a drop-in replacement for flet, since it's more
general than this (it's used to temporarily assign to any place that can
be set with setf).

(letf (((symbol-function 'yes-or-no-p)
           #'(lambda (msg) t)))
  (revert-buffer))

--
Barry Margolin, bar...@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sebastien Vauban  
View profile  
 More options Oct 11 2012, 4:04 am
Newsgroups: gnu.emacs.help
From: "Sebastien Vauban" <wxhgmqzgw...@spammotel.com>
Date: Thu, 11 Oct 2012 10:04:21 +0200
Local: Thurs, Oct 11 2012 4:04 am
Subject: Re: flet is obsolete, but...
Hi Jambunathan,

Jambunathan K wrote:
>> `flet' is an obsolete macro (as of 24.3); use either `cl-flet' or `cl-letf'.

>> But doing so in the following code:

>>   (defun my/revert-buffer ()
>>     "Unconditionally revert current buffer."
>>     (interactive)
>>     (flet ((yes-or-no-p (msg) t))
>>       (revert-buffer)))

>> does not lead to the right things:
>> What should I do?

> Use the NOCONFIRM argument of revert-buffer.

I tried another way:

--8<---------------cut here---------------start------------->8---
  (defun my/revert-buffer ()
    "Unconditionally revert current buffer."
    (interactive)
    (let ((revert-without-query t))
      (revert-buffer)))
--8<---------------cut here---------------end--------------->8---

but I don't understand why it does not work:

--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (wrong-type-argument listp t)
  byte-code(" \304\211\205 \n@\305  \"\203


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tassilo Horn  
View profile  
 More options Oct 11 2012, 4:10 am
Newsgroups: gnu.emacs.help
From: Tassilo Horn <t...@gnu.org>
Date: Thu, 11 Oct 2012 10:10:24 +0200
Local: Thurs, Oct 11 2012 4:10 am
Subject: Re: flet is obsolete, but...
"Sebastien Vauban"

<wxhgmqzgw...@spammotel.com> writes:
>> Use the NOCONFIRM argument of revert-buffer.

> I tried another way:

What's wrong with NOCONFIRM?

>   (defun my/revert-buffer ()
>     "Unconditionally revert current buffer."
>     (interactive)
>     (let ((revert-without-query t))
>       (revert-buffer)))

> but I don't understand why it does not work:

> --8<---------------cut here---------------start------------->8---
> Debugger entered--Lisp error: (wrong-type-argument listp t)
>   byte-code(" \304\211\205 \n@\305     \"\203

Because t is not a list.  The docs clearly state that
`revert-without-query' has to be a list of regular expressions.

,----[ C-h v revert-without-query RET ]
| revert-without-query is a variable defined in `files.el'.
| Its value is nil
|
| Documentation:
| Specify which files should be reverted without query.
| The value is a list of regular expressions.
| If the file name matches one of these regular expressions,
| then `revert-buffer' reverts the file without querying
| if the file has changed on disk and you have not edited the buffer.
`----

Bye,
Tassilo


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jambunathan K  
View profile  
 More options Oct 11 2012, 4:16 am
Newsgroups: gnu.emacs.help
From: Jambunathan K <kjambunat...@gmail.com>
Date: Thu, 11 Oct 2012 13:47:34 +0530
Local: Thurs, Oct 11 2012 4:17 am
Subject: Re: flet is obsolete, but...
"Sebastien Vauban"

listp in above Lisp error gives a clue that a list is expected.

A describe variable confirms that it is indeed a list regexes.  Regex is
a Emacs regex and NOT a shell-regex.

,----[ C-h v revert-without-query RET ]
| revert-without-query is a variable defined in `files.el'.
| Its value is nil
|
| Documentation:
| Specify which files should be reverted without query.
| The value is a list of regular expressions.
| If the file name matches one of these regular expressions,
| then `revert-buffer' reverts the file without querying
| if the file has changed on disk and you have not edited the buffer.
|
| You can customize this variable.
|
| [back]
`----

--


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Drew Adams  
View profile  
 More options Oct 11 2012, 9:49 am
Newsgroups: gnu.emacs.help
From: "Drew Adams" <drew.ad...@oracle.com>
Date: Thu, 11 Oct 2012 06:48:48 -0700
Local: Thurs, Oct 11 2012 9:48 am
Subject: RE: flet is obsolete, but...

>   (defun my/revert-buffer ()
>     "Unconditionally revert current buffer."
>     (interactive)
>     (let ((revert-without-query t)) (revert-buffer)))

> but I don't understand why it does not work:

Others have explained why it does not work.
Here's another way:

(defun revert-buffer-no-confirm ()
  "Revert buffer without confirmation."
  (interactive) (revert-buffer t t))

(I bind it to `f5', in keeping with the MS Windows use of that key.)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ludwig, Mark  
View profile  
 More options Oct 11 2012, 10:33 am
Newsgroups: gnu.emacs.help
From: "Ludwig, Mark" <ludwig.m...@siemens.com>
Date: Thu, 11 Oct 2012 14:33:41 +0000
Local: Thurs, Oct 11 2012 10:33 am
Subject: RE: flet is obsolete, but...

> -----Original Message-----
> From: Drew Adams
> Sent: Thursday, October 11, 2012 8:49 AM
> To: 'Sebastien Vauban'; help-gnu-em...@gnu.org
> Subject: RE: flet is obsolete, but...

> (I bind [revert-buffer-no-confirm] to `f5', in keeping with the MS Windows use of that key.)

That's the best idea I've seen in a /long/ time.  Why didn't /I/ think of that?!  

Thanks!
Mark


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sebastien Vauban  
View profile  
 More options Oct 11 2012, 10:55 am
Newsgroups: gnu.emacs.help
From: "Sebastien Vauban" <wxhgmqzgw...@spammotel.com>
Date: Thu, 11 Oct 2012 16:55:22 +0200
Local: Thurs, Oct 11 2012 10:55 am
Subject: Re: flet is obsolete, but...
Hello all,

Thanks for your answers. It helped a lot, even if the above is still a bit
cryptic to me.

And, yes, I thought that the replacement was purely a syntaxical exchange of
words...

Best regards,
  Seb

--
Sebastien Vauban


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "`f5' for refreshing/reverting without confirmation [was: flet is obsolete, but...]" by Drew Adams
Drew Adams  
View profile  
 More options Oct 11 2012, 11:18 am
Newsgroups: gnu.emacs.help
From: "Drew Adams" <drew.ad...@oracle.com>
Date: Thu, 11 Oct 2012 08:18:16 -0700
Local: Thurs, Oct 11 2012 11:18 am
Subject: `f5' for refreshing/reverting without confirmation [was: flet is obsolete, but...]

> > (I bind [revert-buffer-no-confirm] to `f5', in keeping with
> > the MS Windows use of that key.)

> That's the best idea I've seen in a /long/ time.
> Why didn't /I/ think of that?!  

You're welcome.  Sometimes a trivial change can make a difference.

I must say that "wasting" an easy, repeatable key such as `f5' on this (as
opposed to binding it to a command that could take advantage of holding down the
key to repeat) goes against my general guidelines.

But in this case I made an exception because I already have the habit of using
it in Windows apps, so it is handy (for me).


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »