help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to get around deprecated function


From: Emanuel Berg
Subject: Re: how to get around deprecated function
Date: Wed, 29 Apr 2015 01:29:45 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

B. T. Raven <btraven@nihil.net> writes:

> I am constantly losing short pieces of text left in
> *scratch* and I wrote this interactive function
> [...]
>
> It "works" but according to the docs
> mark-whole-buffer shouldn't be used this way.
> Is there an understandable (to me) right way of
> doing this or doing something else that can be
> invoked as easily?

In the help for `append-to-file', it says

    (append-to-file START END FILENAME) ... If START
    is nil, that means to use the entire
    buffer contents.

Also, instead of using `switch-to-buffer', use
`with-current-buffer'. And, instead of using `setq',
use `let'. Or - as the data doesn't reappear - you
might as well put the function invocations in the
append-to-file invocation itself.

Use the Emacs byte-compiler to get suggestions such as
these. You already found out they are in the help, but
the byte-compiler can be a way of not having to check
the help for every function used...

Meta hint: Don't quote things that haven't appeared in
the thread with the angle brackets. Either just yank
it or make it look like this if it appeals to you:

    Meta hint: don't quote things that haven't
    appeared in the thread with the angle brackets.
    Either just yank it or make it look like this if
    it appeals to you.

Dig deep!

-- 
underground experts united
http://user.it.uu.se/~embe8573


reply via email to

[Prev in Thread] Current Thread [Next in Thread]