all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* how can I tell emacs to treat a text file as html?
@ 2005-04-09 17:03 Angelina Carlton
  0 siblings, 0 replies; 28+ messages in thread
From: Angelina Carlton @ 2005-04-09 17:03 UTC (permalink / raw)


Hello

I use a bash based blogging software called nanoblogger. It lets you
use the editor of your choice and I had set this to be emacsclient.

The blog script then sends /tmp/nb_entry1078.html to my already
running emacs and I can edit using html syntax hilighting as emacs
recognizes the file type.

This worked fine until the latest version of the software now sends
a txt file instead. /tmp/nb_entry1078.txt  

Emacs of course thinks this is plain text which is right, but I would
like to treat it as html, actually XHTML, but either would do. 

The blog conf file has:
EDITOR="emacslient";

I cant find in my documentation a way to set EDITOR to 
"emacsclient --"treat this as html"

Is this possible from the command line? Or is there a way to turn on
html font locking from inside emacs even if the file is txt? This
would be acceptable if I could bind it to like F8 or something.

Thanks in advance..  
-- 
Angelina Carlton

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

* Re: how can I tell emacs to treat a text file as html?
       [not found] <mailman.931.1113065284.2895.help-gnu-emacs@gnu.org>
@ 2005-04-09 17:27 ` Albert Reiner
  2005-04-09 17:43   ` Angelina Carlton
  2005-04-09 18:11 ` Pascal Bourguignon
  2005-04-09 18:34 ` Stefan Monnier
  2 siblings, 1 reply; 28+ messages in thread
From: Albert Reiner @ 2005-04-09 17:27 UTC (permalink / raw)


[Angelina Carlton <brat@magma.ca>, Sat, 9 Apr 2005 13:03:08 -0400]:
> Is this possible from the command line? Or is there a way to turn on

Don't know.

> html font locking from inside emacs even if the file is txt? This
> would be acceptable if I could bind it to like F8 or something.

Does M-x html-mode RET do what you want?

HTH,

Albert.

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

* Re: how can I tell emacs to treat a text file as html?
  2005-04-09 17:27 ` how can I tell emacs to treat a text file as html? Albert Reiner
@ 2005-04-09 17:43   ` Angelina Carlton
  0 siblings, 0 replies; 28+ messages in thread
From: Angelina Carlton @ 2005-04-09 17:43 UTC (permalink / raw)


On Sat, Apr 09, 2005 at 07:27:36PM +0200, Albert Reiner wrote:
> 
> Does M-x html-mode RET do what you want?
> 

Yes thank you, I can make a binding for that I guess. 
I was also thinking if emacs can use an alternate config file I could
set that up to use html-mode only.

Thanks alot!
-- 
Angelina Carlton

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

* Re: how can I tell emacs to treat a text file as html?
       [not found] <mailman.931.1113065284.2895.help-gnu-emacs@gnu.org>
  2005-04-09 17:27 ` how can I tell emacs to treat a text file as html? Albert Reiner
@ 2005-04-09 18:11 ` Pascal Bourguignon
  2005-04-09 18:46   ` Angelina Carlton
  2005-04-09 18:34 ` Stefan Monnier
  2 siblings, 1 reply; 28+ messages in thread
From: Pascal Bourguignon @ 2005-04-09 18:11 UTC (permalink / raw)


Angelina Carlton <brat@magma.ca> writes:

> Hello
> 
> I use a bash based blogging software called nanoblogger. It lets you
> use the editor of your choice and I had set this to be emacsclient.
> 
> The blog script then sends /tmp/nb_entry1078.html to my already
> running emacs and I can edit using html syntax hilighting as emacs
> recognizes the file type.
> 
> This worked fine until the latest version of the software now sends
> a txt file instead. /tmp/nb_entry1078.txt  
> 
> Emacs of course thinks this is plain text which is right, but I would
> like to treat it as html, actually XHTML, but either would do. 
> 
> The blog conf file has:
> EDITOR="emacslient";
> 
> I cant find in my documentation a way to set EDITOR to 
> "emacsclient --"treat this as html"
> 
> Is this possible from the command line? Or is there a way to turn on
> html font locking from inside emacs even if the file is txt? This
> would be acceptable if I could bind it to like F8 or something.

emacsclient -e "(progn (find-file \"$file\") (html-mode))"

Also, it might be possible to append:

<!--
Local Variables:
mode: html
End:
-->

or to prepend: <!-- -*- mode: html -*- -->

if not already present in the file, and then use merely: emacsclient $file

For example:


tail -10 $file \
| grep -q -s 'mode: html' \
|| cat >> $file <<EOF
<!--
Local Variables:
mode: html
End:
-->
EOF
emacsclient $file


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

In a World without Walls and Fences, 
who needs Windows and Gates?

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

* Re: how can I tell emacs to treat a text file as html?
       [not found] <mailman.931.1113065284.2895.help-gnu-emacs@gnu.org>
  2005-04-09 17:27 ` how can I tell emacs to treat a text file as html? Albert Reiner
  2005-04-09 18:11 ` Pascal Bourguignon
@ 2005-04-09 18:34 ` Stefan Monnier
  2005-04-09 19:39   ` Angelina Carlton
                     ` (2 more replies)
  2 siblings, 3 replies; 28+ messages in thread
From: Stefan Monnier @ 2005-04-09 18:34 UTC (permalink / raw)


> This worked fine until the latest version of the software now sends
> a txt file instead. /tmp/nb_entry1078.txt  

> Emacs of course thinks this is plain text which is right, but I would
> like to treat it as html, actually XHTML, but either would do. 

(add-to-list 'auto-mode-alist '("\\`/tmp/nb_.*\\.txt\\'" . html-mode))


        Stefan

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

* Re: how can I tell emacs to treat a text file as html?
  2005-04-09 18:11 ` Pascal Bourguignon
@ 2005-04-09 18:46   ` Angelina Carlton
  0 siblings, 0 replies; 28+ messages in thread
From: Angelina Carlton @ 2005-04-09 18:46 UTC (permalink / raw)


On Sat, Apr 09, 2005 at 08:11:49PM +0200, Pascal Bourguignon wrote:
 
> emacsclient -e "(progn (find-file \"$file\") (html-mode))"

This throws an error:
emacsclient: invalid option -- e 
 
> Also, it might be possible to append:
> 
> <!--
> Local Variables:
> mode: html
> End:
> 
> or to prepend: <!-- -*- mode: html -*- -->
> 
> if not already present in the file, and then use merely: emacsclient $file
> 
> For example:
> 
> 
> tail -10 $file \
> | grep -q -s 'mode: html' \
> || cat >> $file <<EOF
> <!--
> Local Variables:
> mode: html
> End:
> EOF
> emacsclient $file
> 
> 

I think from the man page:
       -f function               Execute the lisp function function.
       -l file                   Load the lisp code in the file file.

So it looks like I can load some code from a file which is probably the simplest
thing to do for my needs.

-- 
Angelina Carlton

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

* Re: how can I tell emacs to treat a text file as html?
  2005-04-09 18:34 ` Stefan Monnier
@ 2005-04-09 19:39   ` Angelina Carlton
  2005-04-09 22:30   ` Angelina Carlton
       [not found]   ` <mailman.951.1113084713.2895.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 28+ messages in thread
From: Angelina Carlton @ 2005-04-09 19:39 UTC (permalink / raw)


On Sat, Apr 09, 2005 at 02:34:26PM -0400, Stefan Monnier wrote:
 
> (add-to-list 'auto-mode-alist '("\\`/tmp/nb_.*\\.txt\\'" . html-mode))
> 

Stefan, thanks, but where do I place this? ~/.emacs ?
I tried it there but it still is not in html-mode
when I create a new entry.

my status bar says:
--uu:**-F1  nb_entry2911.txt      (Text Server)--L1--C2--All

-- 
Angelina Carlton

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

* Re: how can I tell emacs to treat a text file as html?
  2005-04-09 18:34 ` Stefan Monnier
  2005-04-09 19:39   ` Angelina Carlton
@ 2005-04-09 22:30   ` Angelina Carlton
       [not found]   ` <mailman.951.1113084713.2895.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 28+ messages in thread
From: Angelina Carlton @ 2005-04-09 22:30 UTC (permalink / raw)


On Sat, Apr 09, 2005 at 02:34:26PM -0400, Stefan Monnier wrote:
 
> (add-to-list 'auto-mode-alist '("\\`/tmp/nb_.*\\.txt\\'" . html-mode))

When I wrote the .emacs it didnt work, but upon restarting emacs it
now does work,

Thanks alot!
-- 
Angelina Carlton

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

* Re: how can I tell emacs to treat a text file as html?
       [not found]   ` <mailman.951.1113084713.2895.help-gnu-emacs@gnu.org>
@ 2005-04-10  1:15     ` Pascal Bourguignon
  2005-04-10  5:16       ` Joe Corneli
       [not found]       ` <mailman.961.1113108735.2895.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 28+ messages in thread
From: Pascal Bourguignon @ 2005-04-10  1:15 UTC (permalink / raw)


Angelina Carlton <brat@magma.ca> writes:

> On Sat, Apr 09, 2005 at 02:34:26PM -0400, Stefan Monnier wrote:
>  
> > (add-to-list 'auto-mode-alist '("\\`/tmp/nb_.*\\.txt\\'" . html-mode))
> 
> When I wrote the .emacs it didnt work, but upon restarting emacs it
> now does work,

Of course, editing a file doesn't change the state of the running
emacs lisp image.  To do that, you must execute the expressions, which
you can do for example with eval-region or eval-last-expression (type: 
C-x C-e with the cursor just after the expression to be evaluated).

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
Small brave carnivores
Kill pine cones and mosquitoes
Fear vacuum cleaner

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

* Re: how can I tell emacs to treat a text file as html?
  2005-04-10  1:15     ` Pascal Bourguignon
@ 2005-04-10  5:16       ` Joe Corneli
       [not found]       ` <mailman.961.1113108735.2895.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 28+ messages in thread
From: Joe Corneli @ 2005-04-10  5:16 UTC (permalink / raw)



   > > (add-to-list 'auto-mode-alist '("\\`/tmp/nb_.*\\.txt\\'" . html-mode))
   > 
   > When I wrote the .emacs it didnt work, but upon restarting emacs it
   > now does work,

   Of course, editing a file doesn't change the state of the running
   emacs lisp image.  To do that, you must execute the expressions, which
   you can do for example with eval-region or eval-last-expression (type: 
   C-x C-e with the cursor just after the expression to be evaluated).


But, note, what you should really do is byte compile the .emacs, using

  M-x emacs-lisp-byte-compile, 

or compile and load all at once,

  M-x emacs-lisp-byte-compile-and-load


PS. What does typing change if not the state of the image?  OT: it
might be fun(ny) to try a fly-eval mode wherein the last sexp _was_
evaluated whenever the cursor was outside of all parens & not in a
comment.

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

* byte-compiling .emacs (was: how can I tell emacs to treat a text file as html?)
       [not found]       ` <mailman.961.1113108735.2895.help-gnu-emacs@gnu.org>
@ 2005-04-11 11:40         ` Reiner Steib
  2005-04-11 13:10           ` Joe Corneli
       [not found]           ` <mailman.1061.1113223276.2895.help-gnu-emacs@gnu.org>
  2005-04-14 12:45         ` how can I tell emacs to treat a text file as html? Stefan Monnier
  1 sibling, 2 replies; 28+ messages in thread
From: Reiner Steib @ 2005-04-11 11:40 UTC (permalink / raw)


On Sun, Apr 10 2005, Joe Corneli <jcorneli@math.utexas.edu> wrote:

> But, note, what you should really do is byte compile the .emacs,

Why?  Typically this isn't worth the trouble ("Changes is my .emacs
are ignored!!!1  What's wrong???ß").

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/

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

* Re: byte-compiling .emacs (was: how can I tell emacs to treat a text file as html?)
  2005-04-11 11:40         ` byte-compiling .emacs (was: how can I tell emacs to treat a text file as html?) Reiner Steib
@ 2005-04-11 13:10           ` Joe Corneli
  2005-04-11 13:56             ` Peter Dyballa
       [not found]             ` <mailman.1067.1113227351.2895.help-gnu-emacs@gnu.org>
       [not found]           ` <mailman.1061.1113223276.2895.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 28+ messages in thread
From: Joe Corneli @ 2005-04-11 13:10 UTC (permalink / raw)


   On Sun, Apr 10 2005, Joe Corneli <jcorneli@math.utexas.edu> wrote:

   > But, note, what you should really do is byte compile the .emacs,

   Why?  Typically this isn't worth the trouble ("Changes is my .emacs
   are ignored!!!1  What's wrong???ß").


OK, I guess I was wrong.  I personally always byte compile mine b/c
otherwise emacs complains that the source file is newer.  Other people
might not have that problem :).  But perhaps I'm the one who should
change...

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

* Re: byte-compiling .emacs (was: how can I tell emacs to treat a text file as html?)
       [not found]           ` <mailman.1061.1113223276.2895.help-gnu-emacs@gnu.org>
@ 2005-04-11 13:40             ` Phillip Lord
  2005-04-11 14:33               ` byte-compiling .emacs Jay Belanger
  2005-04-12  1:31               ` Quokka
  0 siblings, 2 replies; 28+ messages in thread
From: Phillip Lord @ 2005-04-11 13:40 UTC (permalink / raw)


>>>>> "Joe" == Joe Corneli <jcorneli@math.utexas.edu> writes:

  Joe>    On Sun, Apr 10 2005, Joe Corneli <jcorneli@math.utexas.edu>
  Joe>    wrote:

  >> But, note, what you should really do is byte compile the .emacs,

  Joe>    Why?  Typically this isn't worth the trouble ("Changes is my
  Joe>    .emacs are ignored!!!1 What's wrong???ß").


  Joe> OK, I guess I was wrong.  I personally always byte compile mine
  Joe> b/c otherwise emacs complains that the source file is newer.
  Joe> Other people might not have that problem :).  But perhaps I'm
  Joe> the one who should change...

If you don't byte-compile it at all, then it won't. 

I think that there is an auto recompile package out there somewhere. 
I never compiled my .emacs or subsidiary files myself. I doubt that it
makes that much difference. 

Phil

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

* Re: byte-compiling .emacs (was: how can I tell emacs to treat a text file as html?)
  2005-04-11 13:10           ` Joe Corneli
@ 2005-04-11 13:56             ` Peter Dyballa
       [not found]             ` <mailman.1067.1113227351.2895.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 28+ messages in thread
From: Peter Dyballa @ 2005-04-11 13:56 UTC (permalink / raw)
  Cc: help-gnu-emacs


Am 11.04.2005 um 15:10 schrieb Joe Corneli:

> I personally always byte compile mine b/c otherwise emacs complains 
> that the source file is newer

If GNU Emacs complains in that way, I just delete its reason to 
complain about! Isn't that radical?!

--
Greetings

   Pete

"Let's face it; we don't want a free market economy either."
         James Farley, president, Coca-Cola Export Corp., 1959

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

* Re: byte-compiling .emacs
  2005-04-11 13:40             ` byte-compiling .emacs (was: how can I tell emacs to treat a text file as html?) Phillip Lord
@ 2005-04-11 14:33               ` Jay Belanger
  2005-04-12  0:58                 ` Barry Margolin
  2005-04-14 12:48                 ` Stefan Monnier
  2005-04-12  1:31               ` Quokka
  1 sibling, 2 replies; 28+ messages in thread
From: Jay Belanger @ 2005-04-11 14:33 UTC (permalink / raw)



Phillip Lord <p.lord@cs.man.ac.uk> writes:

>>>>>> "Joe" == Joe Corneli <jcorneli@math.utexas.edu> writes:
>
>   Joe>    On Sun, Apr 10 2005, Joe Corneli <jcorneli@math.utexas.edu>
>   Joe>    wrote:
>
>   >> But, note, what you should really do is byte compile the .emacs,
>
>   Joe>    Why?  Typically this isn't worth the trouble ("Changes is my
>   Joe>    .emacs are ignored!!!1 What's wrong???ß").
>
>
>   Joe> OK, I guess I was wrong.  I personally always byte compile mine
>   Joe> b/c otherwise emacs complains that the source file is newer.
>   Joe> Other people might not have that problem :).  But perhaps I'm
>   Joe> the one who should change...
>
> If you don't byte-compile it at all, then it won't. 

And of course remove the .elc file.

> I think that there is an auto recompile package out there somewhere. 
> I never compiled my .emacs or subsidiary files myself. I doubt that it
> makes that much difference. 

It does make a difference for me (but only a few seconds difference),
but I probably have too much junk in it.  At any rate, I moved most of
the junk to subsidiary files, which I do compile (and have to remember
to recompile whenever I change them), and have my (uncompiled) .emacs
do little more than load them.

At any rate, even when I didn't compile, the overhead was a one-time
(per boot) overhead of a few seconds, so not compiling was never
really a problem.

Jay

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

* Re: byte-compiling .emacs
       [not found]             ` <mailman.1067.1113227351.2895.help-gnu-emacs@gnu.org>
@ 2005-04-11 17:19               ` David Kastrup
  2005-04-11 19:41                 ` Peter Dyballa
  0 siblings, 1 reply; 28+ messages in thread
From: David Kastrup @ 2005-04-11 17:19 UTC (permalink / raw)


Peter Dyballa <Peter_Dyballa@Web.DE> writes:

> Am 11.04.2005 um 15:10 schrieb Joe Corneli:
>
>> I personally always byte compile mine b/c otherwise emacs complains
>> that the source file is newer
>
> If GNU Emacs complains in that way, I just delete its reason to
> complain about! Isn't that radical?!

Yes, it is.  Personally I would not want to delete the source file of
anything just to be spared an odd complaint.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

* Re: byte-compiling .emacs
  2005-04-11 17:19               ` byte-compiling .emacs David Kastrup
@ 2005-04-11 19:41                 ` Peter Dyballa
  0 siblings, 0 replies; 28+ messages in thread
From: Peter Dyballa @ 2005-04-11 19:41 UTC (permalink / raw)
  Cc: help-gnu-emacs


Am 11.04.2005 um 19:19 schrieb David Kastrup:

> Peter Dyballa <Peter_Dyballa@Web.DE> writes:
>
>> Am 11.04.2005 um 15:10 schrieb Joe Corneli:
>>
>>> I personally always byte compile mine b/c otherwise emacs complains
>>> that the source file is newer
>>
>> If GNU Emacs complains in that way, I just delete its reason to
>> complain about! Isn't that radical?!
>
> Yes, it is.  Personally I would not want to delete the source file of
> anything just to be spared an odd complaint.

Why would you like to do such weird mistakes?! The .elc file is the 
anachronistic one: the elder folks get deleted and the younger ones 
have to go to work -- or unemployment office.

--
Mit friedvollen Grüßen

   Pete

Either this man is dead or my watch has stopped. - Groucho Marx

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

* Re: byte-compiling .emacs
  2005-04-11 14:33               ` byte-compiling .emacs Jay Belanger
@ 2005-04-12  0:58                 ` Barry Margolin
  2005-04-14 12:48                 ` Stefan Monnier
  1 sibling, 0 replies; 28+ messages in thread
From: Barry Margolin @ 2005-04-12  0:58 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1089 bytes --]

In article <8764yto02m.fsf@vh213602.truman.edu>,
 Jay Belanger <belanger@truman.edu> wrote:

> Phillip Lord <p.lord@cs.man.ac.uk> writes:
> 
> >>>>>> "Joe" == Joe Corneli <jcorneli@math.utexas.edu> writes:
> >
> >   Joe>    On Sun, Apr 10 2005, Joe Corneli <jcorneli@math.utexas.edu>
> >   Joe>    wrote:
> >
> >   >> But, note, what you should really do is byte compile the .emacs,
> >
> >   Joe>    Why?  Typically this isn't worth the trouble ("Changes is my
> >   Joe>    .emacs are ignored!!!1 What's wrong???ß").
> >
> >
> >   Joe> OK, I guess I was wrong.  I personally always byte compile mine
> >   Joe> b/c otherwise emacs complains that the source file is newer.
> >   Joe> Other people might not have that problem :).  But perhaps I'm
> >   Joe> the one who should change...
> >
> > If you don't byte-compile it at all, then it won't. 
> 
> And of course remove the .elc file.

But if you don't byte-compile it at all, where would that file have come 
from?

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***

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

* Re: byte-compiling .emacs
  2005-04-11 13:40             ` byte-compiling .emacs (was: how can I tell emacs to treat a text file as html?) Phillip Lord
  2005-04-11 14:33               ` byte-compiling .emacs Jay Belanger
@ 2005-04-12  1:31               ` Quokka
  1 sibling, 0 replies; 28+ messages in thread
From: Quokka @ 2005-04-12  1:31 UTC (permalink / raw)


Phillip Lord wrote:
>>>>>>"Joe" == Joe Corneli <jcorneli@math.utexas.edu> writes:
> 
> 
>   Joe>    On Sun, Apr 10 2005, Joe Corneli <jcorneli@math.utexas.edu>
>   Joe>    wrote:
> 
>   >> But, note, what you should really do is byte compile the .emacs,
> 
>   Joe>    Why?  Typically this isn't worth the trouble ("Changes is my
>   Joe>    .emacs are ignored!!!1 What's wrong???ß").
> 
> 
>   Joe> OK, I guess I was wrong.  I personally always byte compile mine
>   Joe> b/c otherwise emacs complains that the source file is newer.
>   Joe> Other people might not have that problem :).  But perhaps I'm
>   Joe> the one who should change...
> 
> If you don't byte-compile it at all, then it won't. 
> 
> I think that there is an auto recompile package out there somewhere. 
> I never compiled my .emacs or subsidiary files myself. I doubt that it
> makes that much difference. 


Don't know that I would describe it as a "package"..
I picked this up somewhere along the way.
(Can't give credit to who or where as I forgot).


;; Make .emacs autocompile on exit

(defun autocompile nil
   "compile itself if ~/.emacs.el"
   (interactive)
   (if (string= (buffer-file-name) (concat default-directory ".emacs.el"))
       (byte-compile-file (buffer-file-name))))
(add-hook 'after-save-hook 'autocompile)

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

* Re: how can I tell emacs to treat a text file as html?
       [not found]       ` <mailman.961.1113108735.2895.help-gnu-emacs@gnu.org>
  2005-04-11 11:40         ` byte-compiling .emacs (was: how can I tell emacs to treat a text file as html?) Reiner Steib
@ 2005-04-14 12:45         ` Stefan Monnier
  2005-04-15  7:47           ` Steinar Børmer
  1 sibling, 1 reply; 28+ messages in thread
From: Stefan Monnier @ 2005-04-14 12:45 UTC (permalink / raw)


> But, note, what you should really do is byte compile the .emacs, using

No.  That's almost never a good idea.


        Stefan

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

* Re: byte-compiling .emacs
  2005-04-11 14:33               ` byte-compiling .emacs Jay Belanger
  2005-04-12  0:58                 ` Barry Margolin
@ 2005-04-14 12:48                 ` Stefan Monnier
  2005-04-14 17:43                   ` Jay Belanger
  1 sibling, 1 reply; 28+ messages in thread
From: Stefan Monnier @ 2005-04-14 12:48 UTC (permalink / raw)


> It does make a difference for me (but only a few seconds difference),
> but I probably have too much junk in it.  At any rate, I moved most of

I'd be interested to see this.  Have you actually measured it?
The only reason I can think of to see such a difference is if your .emacs
uses autoloaded macros, where the .elc file ends up not loading the
macro's definition.


        Stefan

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

* Re: byte-compiling .emacs
  2005-04-14 12:48                 ` Stefan Monnier
@ 2005-04-14 17:43                   ` Jay Belanger
  0 siblings, 0 replies; 28+ messages in thread
From: Jay Belanger @ 2005-04-14 17:43 UTC (permalink / raw)



Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> It does make a difference for me (but only a few seconds difference),
>> but I probably have too much junk in it.  At any rate, I moved most of
>
> I'd be interested to see this.  Have you actually measured it?

I had not measured it very accurately, but I thought I had counted to
myself as it was loading and noticed the difference.
However, I just tried it out (on a freshly booted system each time)
and let Emacs measure the times.  There was no real difference in the
times. 
So ... oops or something.

Jay

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

* Re: how can I tell emacs to treat a text file as html?
  2005-04-14 12:45         ` how can I tell emacs to treat a text file as html? Stefan Monnier
@ 2005-04-15  7:47           ` Steinar Børmer
  2005-04-15  8:22             ` Thien-Thi Nguyen
  2005-04-15 13:36             ` Stefan Monnier
  0 siblings, 2 replies; 28+ messages in thread
From: Steinar Børmer @ 2005-04-15  7:47 UTC (permalink / raw)


Stefan Monnier wrote:

| > But, note, what you should really do is byte compile the .emacs,
| > using
| 
| No.  That's almost never a good idea.

Is it a bad idea, and why?

-- 
SB

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

* Re: how can I tell emacs to treat a text file as html?
  2005-04-15  7:47           ` Steinar Børmer
@ 2005-04-15  8:22             ` Thien-Thi Nguyen
  2005-04-15 13:36             ` Stefan Monnier
  1 sibling, 0 replies; 28+ messages in thread
From: Thien-Thi Nguyen @ 2005-04-15  8:22 UTC (permalink / raw)


steinab@ifi.uio.no (Steinar Børmer) writes:

> Is it a bad idea, and why?

how many gray hairs do you have left to grow?

thi

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

* Re: how can I tell emacs to treat a text file as html?
  2005-04-15  7:47           ` Steinar Børmer
  2005-04-15  8:22             ` Thien-Thi Nguyen
@ 2005-04-15 13:36             ` Stefan Monnier
  2005-04-15 14:44               ` Joe Corneli
       [not found]               ` <mailman.1644.1113577291.2895.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 28+ messages in thread
From: Stefan Monnier @ 2005-04-15 13:36 UTC (permalink / raw)


> | > But, note, what you should really do is byte compile the .emacs,
> | > using
> | No.  That's almost never a good idea.
> Is it a bad idea, and why?

Since it requires extra work, I think the more relevant question is "is it
a good idea, why?".

Byte-compilation, like many things creates basically a copy of the source
file (tho in a slightly different form, presumably more efficient).
So there are fundamentally two potential problems:
1 - the act of byte-compiling (can take time, can fail, ...).
2 - the presence of two redundant "copies" which are not kept 100%
    automatically in sync.
Maybe you'll never suffer from any bad effect, but since the .emacs file
rarely if ever contains any loop (the only place where byte-compilation of
.emacs has a fighting chance of having a measurable impact on execution
time), it's just not worth the trouble.


        Stefan

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

* Re: how can I tell emacs to treat a text file as html?
  2005-04-15 13:36             ` Stefan Monnier
@ 2005-04-15 14:44               ` Joe Corneli
       [not found]               ` <mailman.1644.1113577291.2895.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 28+ messages in thread
From: Joe Corneli @ 2005-04-15 14:44 UTC (permalink / raw)



   > | > But, note, what you should really do is byte compile the .emacs,
   > | > using
   > | No.  That's almost never a good idea.
   > Is it a bad idea, and why?

   Maybe you'll never suffer from any bad effect, but since the .emacs file
   rarely if ever contains any loop (the only place where byte-compilation of
   .emacs has a fighting chance of having a measurable impact on execution
   time), it's just not worth the trouble.

As the person who brought forth this mildly contentious and somewhat
silly notion of "byte compiling .emacs", let me just mention that I
(also) always byte compile packages that I write, and that I think
_that_ does have a beneficial effect.  The compiler will catch things
like undefined variables & other such bugs that the interpreter
doesn't catch.  'Pon fixing these, the code is improved.  The fact
that you _shouldn't_ do this in .emacs (now accepted by me, and I'm
planning on entering a .emacs rehab) sorta/kinda rests on the
principle that there shouldn't be much code in the .emacs anyway (see
another recent thread).

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

* Re: how can I tell emacs to treat a text file as html?
       [not found]               ` <mailman.1644.1113577291.2895.help-gnu-emacs@gnu.org>
@ 2005-04-15 15:48                 ` Stefan Monnier
  2005-04-15 18:00                 ` kgold
  1 sibling, 0 replies; 28+ messages in thread
From: Stefan Monnier @ 2005-04-15 15:48 UTC (permalink / raw)


> As the person who brought forth this mildly contentious and somewhat
> silly notion of "byte compiling .emacs", let me just mention that I
> (also) always byte compile packages that I write, and that I think
> _that_ does have a beneficial effect.  The compiler will catch things
> like undefined variables & other such bugs that the interpreter
> doesn't catch.  'Pon fixing these, the code is improved.

That's a good point.  I think it would be worthwhile to extract an "elisp
check" functionality that does the same/similar checks as byte-compiling but
without actually generating any .elc file.  This could be triggered
automatically when saving the .emacs file.  We could use it to give guidance
to the user about what kind of code in her .emacs is
obsolete/poor/misguided/...

> The fact that you _shouldn't_ do this in .emacs (now accepted by me, and
> I'm planning on entering a .emacs rehab) sorta/kinda rests on the
> principle that there shouldn't be much code in the .emacs anyway (see
> another recent thread).

It's not so much a question of quantity as a question of how many times it's
executed.  Most packages contain functions which are later on executed
potentially repeatedly.  Most .emacs files contain mostly one-time commands,
and the few functions defined there are executed fairly rarely (things like
major mode hooks).  Speeding up such code is not going to give much benefit,
if any.


        Stefan

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

* Re: how can I tell emacs to treat a text file as html?
       [not found]               ` <mailman.1644.1113577291.2895.help-gnu-emacs@gnu.org>
  2005-04-15 15:48                 ` Stefan Monnier
@ 2005-04-15 18:00                 ` kgold
  1 sibling, 0 replies; 28+ messages in thread
From: kgold @ 2005-04-15 18:00 UTC (permalink / raw)


Joe Corneli <jcorneli@math.utexas.edu> writes:
> 
> As the person who brought forth this mildly contentious and somewhat
> silly notion of "byte compiling .emacs", let me just mention that I
> (also) always byte compile packages that I write, and that I think
> _that_ does have a beneficial effect.  

The difference is that .emacs changes more frequently that your
average package.

This will happen once: You modify your .emacs and spend a few hours
trying to figure out why the change isn't having any effect.  You then
kick yourself as you realize that it's using the byte compiled
version.

After that, you'll never byte compile again.

-- 
Ken Goldman   kgold@watson.ibm.com   914-784-7646

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

end of thread, other threads:[~2005-04-15 18:00 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.931.1113065284.2895.help-gnu-emacs@gnu.org>
2005-04-09 17:27 ` how can I tell emacs to treat a text file as html? Albert Reiner
2005-04-09 17:43   ` Angelina Carlton
2005-04-09 18:11 ` Pascal Bourguignon
2005-04-09 18:46   ` Angelina Carlton
2005-04-09 18:34 ` Stefan Monnier
2005-04-09 19:39   ` Angelina Carlton
2005-04-09 22:30   ` Angelina Carlton
     [not found]   ` <mailman.951.1113084713.2895.help-gnu-emacs@gnu.org>
2005-04-10  1:15     ` Pascal Bourguignon
2005-04-10  5:16       ` Joe Corneli
     [not found]       ` <mailman.961.1113108735.2895.help-gnu-emacs@gnu.org>
2005-04-11 11:40         ` byte-compiling .emacs (was: how can I tell emacs to treat a text file as html?) Reiner Steib
2005-04-11 13:10           ` Joe Corneli
2005-04-11 13:56             ` Peter Dyballa
     [not found]             ` <mailman.1067.1113227351.2895.help-gnu-emacs@gnu.org>
2005-04-11 17:19               ` byte-compiling .emacs David Kastrup
2005-04-11 19:41                 ` Peter Dyballa
     [not found]           ` <mailman.1061.1113223276.2895.help-gnu-emacs@gnu.org>
2005-04-11 13:40             ` byte-compiling .emacs (was: how can I tell emacs to treat a text file as html?) Phillip Lord
2005-04-11 14:33               ` byte-compiling .emacs Jay Belanger
2005-04-12  0:58                 ` Barry Margolin
2005-04-14 12:48                 ` Stefan Monnier
2005-04-14 17:43                   ` Jay Belanger
2005-04-12  1:31               ` Quokka
2005-04-14 12:45         ` how can I tell emacs to treat a text file as html? Stefan Monnier
2005-04-15  7:47           ` Steinar Børmer
2005-04-15  8:22             ` Thien-Thi Nguyen
2005-04-15 13:36             ` Stefan Monnier
2005-04-15 14:44               ` Joe Corneli
     [not found]               ` <mailman.1644.1113577291.2895.help-gnu-emacs@gnu.org>
2005-04-15 15:48                 ` Stefan Monnier
2005-04-15 18:00                 ` kgold
2005-04-09 17:03 Angelina Carlton

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.