unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#23659: 25.0.94; insert-file-contents with REPLACE gets confused by certain file contents
@ 2016-05-31  0:11 Noam Postavsky
  2016-06-22 15:43 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Noam Postavsky @ 2016-05-31  0:11 UTC (permalink / raw)
  To: 23659

[-- 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)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#23659: 25.0.94; insert-file-contents with REPLACE gets confused by certain file contents
  2016-05-31  0:11 bug#23659: 25.0.94; insert-file-contents with REPLACE gets confused by certain file contents Noam Postavsky
@ 2016-06-22 15:43 ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2016-06-22 15:43 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: 23659-done

> Date: Mon, 30 May 2016 20:11:16 -0400
> From: Noam Postavsky <npostavs@users.sourceforge.net>
> 
> 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".

Repeat after me:

  Buffer text is not a simple C 'char' array
  Buffer text is not a simple C 'char' array
  Buffer text is not a simple C 'char' array
  Buffer text is not ...

Fixed on the master branch.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-22 15:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-31  0:11 bug#23659: 25.0.94; insert-file-contents with REPLACE gets confused by certain file contents Noam Postavsky
2016-06-22 15:43 ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).