all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@users.sourceforge.net>
To: 23659@debbugs.gnu.org
Subject: bug#23659: 25.0.94; insert-file-contents with REPLACE gets confused by certain file contents
Date: Mon, 30 May 2016 20:11:16 -0400	[thread overview]
Message-ID: <CAM-tV-_BgCk_Do+vQSMHW=EW=nQkDOcMa=caNNvi-sdV7DrWUQ@mail.gmail.com> (raw)

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

Download all attached files into the same directory, then run

    emacs -Q -l test-insert-file-contents.el

The expected result is the text of "src" in "*a buffer*". The actual
result has the last line ending in "_SRE" instead of "_SRC".

I see this problem in 24.5 and 25.0.94, on both Windows and GNU/Linux.
Note that the test files "quote" and "src" have DOS line endings, and
don't have a newline at the end of the file.

This initially manifested as a yasnippet bug [1], it's easy to work
around though (just use `erase-buffer' instead of passing non-nil
REPLACE to `insert-file-contents').

[1]: https://github.com/joaotavora/yasnippet/issues/707

[-- Attachment #2: quote --]
[-- Type: application/octet-stream, Size: 107 bytes --]

# -*- require-final-newline: nil -*-
# name: org quote
# key: quote
# --
#+BEGIN_QUOTE
$0
#+END_QUOTE

[-- Attachment #3: src --]
[-- Type: application/octet-stream, Size: 102 bytes --]

# -*- require-final-newline: nil -*-
# name: org src
# key: src
# --
#+BEGIN_SRC $1
$0
#+END_SRC

[-- Attachment #4: test-insert-file-contents.el --]
[-- Type: application/octet-stream, Size: 199 bytes --]

(cd (file-name-directory (or load-file-name buffer-file-name)))
(switch-to-buffer "*a buffer*")
(erase-buffer)
(insert-file-contents "quote" nil nil nil t)
(insert-file-contents "src" nil nil nil t)

             reply	other threads:[~2016-05-31  0:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-31  0:11 Noam Postavsky [this message]
2016-06-22 15:43 ` bug#23659: 25.0.94; insert-file-contents with REPLACE gets confused by certain file contents Eli Zaretskii

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='CAM-tV-_BgCk_Do+vQSMHW=EW=nQkDOcMa=caNNvi-sdV7DrWUQ@mail.gmail.com' \
    --to=npostavs@users.sourceforge.net \
    --cc=23659@debbugs.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.