all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to view raw text in Emacs?
@ 2018-04-05 18:56 N. Jackson
  2018-04-05 19:07 ` Alex Kost
       [not found] ` <mailman.11755.1522955247.27995.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 8+ messages in thread
From: N. Jackson @ 2018-04-05 18:56 UTC (permalink / raw
  To: help-gnu-emacs

Sometimes when I'm using Emacs I want to see "what's really there"
rather than the view of the text that Emacs is showing me. So far, I
have not figured out how to do this. Usually after casting about in
Emacs for a solution, the frustration builds sufficiently that I switch
to Kate of Gedit to see what I want to see. I would like to learn how to
do this in Emacs.

For example, I open etc/enriched.txt. I realise that there is more there
than I'm seeing and am curious to see what is actually in the file. I
try `M-x fundamental-mode RET' which changes nothing. (I don't know why
I think it should, but that always seems to be what I try first.) Then I
see in the mode line that I'm in "Enriched" mode, so I try `M-x
enriched-mode RET' to turn it off, which does seem to turn it off (it's
nice that it's intuitive that way), but the view in the buffer doesn't
change. I try `M-x set-buffer-coding-system RET raw-text RET', but that
doesn't help either. I try `M-x set-buffer-coding-system RET
no-conversion RET', but again there is no apparent change.

Clearly I'm missing something here, but I'm not sure what it is. Any
pointers would be welcome.

Thanks.

N.






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

* Re: How to view raw text in Emacs?
  2018-04-05 18:56 How to view raw text in Emacs? N. Jackson
@ 2018-04-05 19:07 ` Alex Kost
       [not found] ` <mailman.11755.1522955247.27995.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 8+ messages in thread
From: Alex Kost @ 2018-04-05 19:07 UTC (permalink / raw
  To: N. Jackson; +Cc: help-gnu-emacs

N. Jackson (2018-04-05 14:56 -0400) wrote:

> Sometimes when I'm using Emacs I want to see "what's really there"
> rather than the view of the text that Emacs is showing me. So far, I
> have not figured out how to do this. Usually after casting about in
> Emacs for a solution, the frustration builds sufficiently that I switch
> to Kate of Gedit to see what I want to see. I would like to learn how to
> do this in Emacs.
>
> For example, I open etc/enriched.txt. I realise that there is more there
> than I'm seeing and am curious to see what is actually in the file. I
> try `M-x fundamental-mode RET' which changes nothing. (I don't know why
> I think it should, but that always seems to be what I try first.) Then I
> see in the mode line that I'm in "Enriched" mode, so I try `M-x
> enriched-mode RET' to turn it off, which does seem to turn it off (it's
> nice that it's intuitive that way), but the view in the buffer doesn't
> change. I try `M-x set-buffer-coding-system RET raw-text RET', but that
> doesn't help either. I try `M-x set-buffer-coding-system RET
> no-conversion RET', but again there is no apparent change.
>
> Clearly I'm missing something here, but I'm not sure what it is. Any
> pointers would be welcome.

Perhaps "M-x find-file-literally" is what you are looking for.

-- 
Alex



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

* Re: How to view raw text in Emacs?
       [not found] ` <mailman.11755.1522955247.27995.help-gnu-emacs@gnu.org>
@ 2018-04-05 21:18   ` Ben Bacarisse
  2018-04-06  2:57     ` Will Parsons
                       ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Ben Bacarisse @ 2018-04-05 21:18 UTC (permalink / raw
  To: help-gnu-emacs

Alex Kost <alezost@gmail.com> writes:

> N. Jackson (2018-04-05 14:56 -0400) wrote:
>
>> Sometimes when I'm using Emacs I want to see "what's really there"
>> rather than the view of the text that Emacs is showing me. So far, I
>> have not figured out how to do this. Usually after casting about in
>> Emacs for a solution, the frustration builds sufficiently that I switch
>> to Kate of Gedit to see what I want to see. I would like to learn how to
>> do this in Emacs.
>>
>> For example, I open etc/enriched.txt. I realise that there is more there
>> than I'm seeing and am curious to see what is actually in the file. I
>> try `M-x fundamental-mode RET' which changes nothing. (I don't know why
>> I think it should, but that always seems to be what I try first.) Then I
>> see in the mode line that I'm in "Enriched" mode, so I try `M-x
>> enriched-mode RET' to turn it off, which does seem to turn it off (it's
>> nice that it's intuitive that way), but the view in the buffer doesn't
>> change. I try `M-x set-buffer-coding-system RET raw-text RET', but that
>> doesn't help either. I try `M-x set-buffer-coding-system RET
>> no-conversion RET', but again there is no apparent change.
>>
>> Clearly I'm missing something here, but I'm not sure what it is. Any
>> pointers would be welcome.
>
> Perhaps "M-x find-file-literally" is what you are looking for.

A word of caution from this function's description

  If Emacs already has a buffer which is visiting the file, you
  get the existing buffer, regardless of whether it was created
  literally or not.

And another option...  Sometimes I find hexl-mode the right thing,
though it involves more learning because it's such a different kind of
view of the buffer.

-- 
Ben.


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

* Re: How to view raw text in Emacs?
  2018-04-05 21:18   ` Ben Bacarisse
@ 2018-04-06  2:57     ` Will Parsons
  2018-04-06  7:18       ` Eli Zaretskii
  2018-04-06  7:17     ` Eli Zaretskii
       [not found]     ` <mailman.11771.1522999021.27995.help-gnu-emacs@gnu.org>
  2 siblings, 1 reply; 8+ messages in thread
From: Will Parsons @ 2018-04-06  2:57 UTC (permalink / raw
  To: help-gnu-emacs

On Thursday,  5 Apr 2018  5:18 PM -0400, Ben Bacarisse wrote:
> Alex Kost <alezost@gmail.com> writes:
>
>> N. Jackson (2018-04-05 14:56 -0400) wrote:
>>
>>> Sometimes when I'm using Emacs I want to see "what's really there"
>>> rather than the view of the text that Emacs is showing me. So far, I
>>> have not figured out how to do this. Usually after casting about in
>>> Emacs for a solution, the frustration builds sufficiently that I switch
>>> to Kate of Gedit to see what I want to see. I would like to learn how to
>>> do this in Emacs.
>>>
>>> For example, I open etc/enriched.txt. I realise that there is more there
>>> than I'm seeing and am curious to see what is actually in the file. I
>>> try `M-x fundamental-mode RET' which changes nothing. (I don't know why
>>> I think it should, but that always seems to be what I try first.) Then I
>>> see in the mode line that I'm in "Enriched" mode, so I try `M-x
>>> enriched-mode RET' to turn it off, which does seem to turn it off (it's
>>> nice that it's intuitive that way), but the view in the buffer doesn't
>>> change. I try `M-x set-buffer-coding-system RET raw-text RET', but that
>>> doesn't help either. I try `M-x set-buffer-coding-system RET
>>> no-conversion RET', but again there is no apparent change.
>>>
>>> Clearly I'm missing something here, but I'm not sure what it is. Any
>>> pointers would be welcome.
>>
>> Perhaps "M-x find-file-literally" is what you are looking for.
>
> A word of caution from this function's description
>
>   If Emacs already has a buffer which is visiting the file, you
>   get the existing buffer, regardless of whether it was created
>   literally or not.
>
> And another option...  Sometimes I find hexl-mode the right thing,
> though it involves more learning because it's such a different kind of
> view of the buffer.

But, yes, if you *really* want to know what's in the buffer, then
hexl-mode will give you that information.

-- 
Will


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

* Re: How to view raw text in Emacs?
  2018-04-05 21:18   ` Ben Bacarisse
  2018-04-06  2:57     ` Will Parsons
@ 2018-04-06  7:17     ` Eli Zaretskii
       [not found]     ` <mailman.11771.1522999021.27995.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2018-04-06  7:17 UTC (permalink / raw
  To: help-gnu-emacs

> From: Ben Bacarisse <ben.lists@bsb.me.uk>
> Date: Thu, 05 Apr 2018 22:18:51 +0100
> 
> A word of caution from this function's description
> 
>   If Emacs already has a buffer which is visiting the file, you
>   get the existing buffer, regardless of whether it was created
>   literally or not.

"Same buffer" doesn't mean the same contents.  When the file is
already being visited, you can get the same buffer, but its contents
will be erased and populated anew with literally what's in the file,
without any conversions.



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

* Re: How to view raw text in Emacs?
  2018-04-06  2:57     ` Will Parsons
@ 2018-04-06  7:18       ` Eli Zaretskii
  0 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2018-04-06  7:18 UTC (permalink / raw
  To: help-gnu-emacs

> From: Will Parsons <varro@nodomain.invalid>
> Date: Thu, 5 Apr 2018 22:57:44 -0400
> 
> But, yes, if you *really* want to know what's in the buffer, then
> hexl-mode will give you that information.

Not in the _buffer_, in the _file_.  The internal representation of
text in the buffer is never revealed to Lisp and to users, and needs
some non-trivial tricks to show.  (Not that I think users will want to
see that anyway.)



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

* Re: How to view raw text in Emacs?
       [not found]     ` <mailman.11771.1522999021.27995.help-gnu-emacs@gnu.org>
@ 2018-04-06 10:29       ` Ben Bacarisse
  2018-04-06 12:59         ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Ben Bacarisse @ 2018-04-06 10:29 UTC (permalink / raw
  To: help-gnu-emacs

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Ben Bacarisse <ben.lists@bsb.me.uk>
>> Date: Thu, 05 Apr 2018 22:18:51 +0100
>> 
>> A word of caution from this function's description
>> 
>>   If Emacs already has a buffer which is visiting the file, you
>>   get the existing buffer, regardless of whether it was created
>>   literally or not.
>
> "Same buffer" doesn't mean the same contents.  When the file is
> already being visited, you can get the same buffer, but its contents
> will be erased and populated anew with literally what's in the file,
> without any conversions.

That paragraph started with the sentence "You cannot absolutely rely on
this function to result in visiting the file literally." which certainly
sounds like it might not do what is expected, but I think the warning is
specifically about using find-file-literally in a program because when
called interactively (at least in 25.1.1) I get a warning that emacs can
only visit a file in one way at a time and I am prompted whether to
"revisit" the file (so to speak) or take the existing buffer.

-- 
Ben.


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

* Re: How to view raw text in Emacs?
  2018-04-06 10:29       ` Ben Bacarisse
@ 2018-04-06 12:59         ` Eli Zaretskii
  0 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2018-04-06 12:59 UTC (permalink / raw
  To: help-gnu-emacs

> From: Ben Bacarisse <ben.lists@bsb.me.uk>
> Date: Fri, 06 Apr 2018 11:29:12 +0100
> 
> >>   If Emacs already has a buffer which is visiting the file, you
> >>   get the existing buffer, regardless of whether it was created
> >>   literally or not.
> >
> > "Same buffer" doesn't mean the same contents.  When the file is
> > already being visited, you can get the same buffer, but its contents
> > will be erased and populated anew with literally what's in the file,
> > without any conversions.
> 
> That paragraph started with the sentence "You cannot absolutely rely on
> this function to result in visiting the file literally."

It no longer says that, I fixed that misleading text.

> but I think the warning is specifically about using
> find-file-literally in a program

You shouldn't use that function in a program, you should use
insert-file-contents-literally instead.

> when called interactively (at least in 25.1.1) I get a warning that
> emacs can only visit a file in one way at a time and I am prompted
> whether to "revisit" the file (so to speak) or take the existing
> buffer.

Yes, and that's the important part the doc string failed to tell.  Now
it does.



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

end of thread, other threads:[~2018-04-06 12:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-05 18:56 How to view raw text in Emacs? N. Jackson
2018-04-05 19:07 ` Alex Kost
     [not found] ` <mailman.11755.1522955247.27995.help-gnu-emacs@gnu.org>
2018-04-05 21:18   ` Ben Bacarisse
2018-04-06  2:57     ` Will Parsons
2018-04-06  7:18       ` Eli Zaretskii
2018-04-06  7:17     ` Eli Zaretskii
     [not found]     ` <mailman.11771.1522999021.27995.help-gnu-emacs@gnu.org>
2018-04-06 10:29       ` Ben Bacarisse
2018-04-06 12:59         ` Eli Zaretskii

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.