From: "B. T. Raven" <nihil@nihilo.net>
To: help-gnu-emacs@gnu.org
Subject: Re: Why won't this command kill a buffer?
Date: Fri, 11 Feb 2011 22:15:07 -0600 [thread overview]
Message-ID: <-vCdnWMUI_zQlMvQnZ2dnUVZ_sOdnZ2d@sysmatrix.net> (raw)
In-Reply-To: <ubp2iur0p.fsf@verizon.net>
Joe Fineman wrote:
> I am using Emacs 22.3.1 under Windows XP. I have used the following
> kluge for many years:
>
> (defun marklog ()
> "Insert a backslash into the Log file for the current directory, and into Today if it is in /b."
> (interactive)
> (save-window-excursion
> (let ((dir default-directory)
> (require-final-newline))
> (find-file "~/timing/Logmark")
> (write-region 1 2 (concat dir "Log") t 0)
> (if (equal (substring dir 0 15) "c:/usr/own/f/b/")
> (write-region 1 2 "~/b/Today" t 0))
> (kill-this-buffer))
> ))
>
> The Logmark file consists of a single backslash.
>
> The command kill-this-buffer does not work, and neither do attempts to
> use kill-buffer with an argument. The buffer hangs around and is
> sometimes a nuisance.
>
> And, incidentally, is there any simpler way to tell Emacs to append a
> character to a file?
If you really mean "append" (put at the end) then this works
(on msw2000 with Emacs 22.3):
"
append-to-file is an interactive compiled Lisp function in `files.el'.
It is bound to <f4>.
(append-to-file START END FILENAME)
Append the contents of the region to the end of file FILENAME.
When called from a function, expects three arguments,
START, END and FILENAME. START and END are buffer positions
saying what text to write.
"
Interactively I had bound this function to f4 in .emacs
(define-key global-map [f4] 'append-to-file)
I made a test file with a few chars in it and saved it.
Inserted backspace into buffer with C-q *backspacekey* and then made
that single character (shows as ^?) the region and pressed f4.
Inspection of the last character of the file appended to shows:
Char: DEL (127, #o177, #x7f) point=5 of 5 (80%) column=0
I assume that what can be done interactively can also be done
programmatically.
Ed
next prev parent reply other threads:[~2011-02-12 4:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-11 22:48 Why won't this command kill a buffer? Joe Fineman
2011-02-12 4:15 ` B. T. Raven [this message]
2011-02-12 4:19 ` B. T. Raven
2011-02-12 22:50 ` Joe Fineman
2011-02-15 2:23 ` B. T. Raven
2011-02-16 14:27 ` B. T. Raven
2011-02-12 7:47 ` Le Wang
[not found] ` <mailman.1.1297496838.19060.help-gnu-emacs@gnu.org>
2011-02-12 23:05 ` Joe Fineman
2011-02-13 7:07 ` Le Wang
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=-vCdnWMUI_zQlMvQnZ2dnUVZ_sOdnZ2d@sysmatrix.net \
--to=nihil@nihilo.net \
--cc=help-gnu-emacs@gnu.org \
/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.