unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* automate Emacs beautifyer ?
@ 2004-08-24  7:53 Bert Cuzeau
  2004-08-24  8:22 ` Joost Kremers
                   ` (3 more replies)
  0 siblings, 4 replies; 22+ messages in thread
From: Bert Cuzeau @ 2004-08-24  7:53 UTC (permalink / raw)


Hello,

Under Windows (or Unix), is there a way to automate Emacs doing
only :
- open file
- VHDL - beautify - Buffer (C-c C-b)
- save file
- exit

We have hundreds of files to "beautify" with VHDL-mode and it is
a chore doing this by hand.
Ideally, emacs with command line parameters would suit me great...
(I would add a Tcl script for getting the files names and running
emacs).

Thanks in advance for any suggestions,

Best regards,

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

* Re: automate Emacs beautifyer ?
  2004-08-24  7:53 automate Emacs beautifyer ? Bert Cuzeau
@ 2004-08-24  8:22 ` Joost Kremers
  2004-08-24 10:15 ` Miguel Frasson
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 22+ messages in thread
From: Joost Kremers @ 2004-08-24  8:22 UTC (permalink / raw)


Bert Cuzeau wrote:
> We have hundreds of files to "beautify" with VHDL-mode and it is
> a chore doing this by hand.
> Ideally, emacs with command line parameters would suit me great...

emacs has a -batch option, which you may be able to use. (see 'man emacs'.)
personally, though, i'd whip something together in emacs lisp.

-- 
Joost Kremers                                      joostkremers@yahoo.com
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)

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

* Re: automate Emacs beautifyer ?
  2004-08-24  7:53 automate Emacs beautifyer ? Bert Cuzeau
  2004-08-24  8:22 ` Joost Kremers
@ 2004-08-24 10:15 ` Miguel Frasson
  2004-08-25  8:31   ` Oliver Scholz
  2004-08-24 15:52 ` Kevin Rodgers
  2004-08-28 10:58 ` Kai Grossjohann
  3 siblings, 1 reply; 22+ messages in thread
From: Miguel Frasson @ 2004-08-24 10:15 UTC (permalink / raw)


Bert Cuzeau <_no_spa_m_info_no_underscore_@alse-fr___.com> writes:

> Hello,
> 
> Under Windows (or Unix), is there a way to automate Emacs doing
> only :
> - open file
> - VHDL - beautify - Buffer (C-c C-b)
> - save file
> - exit
> 
> We have hundreds of files to "beautify" with VHDL-mode and it is
> a chore doing this by hand.
> Ideally, emacs with command line parameters would suit me great...
> (I would add a Tcl script for getting the files names and running
> emacs).
> 
> Thanks in advance for any suggestions,

I often make keyboard macros for thiese situations.

* make a file, say "foofiles" with one filename (full path is more
general) per line and open it in emacs.

* put the point in the first file name at the beginning of line

* start a keyborad macro with C-x (

* set mark with C-space

* goto EOL with C-e

* kill region with C-w

* press right to move the point to the next begin of line

* open file with C-x C-f

(if you are usin full path, we have to delete suggestion on finding file)

* mark with C-space

* begin of line C-a

* delete (not kill) region with M-x delete-region RET

* yank filename with C-y

* RET to open file

* C-c C-b to beutify

* Save with C-x C-s

(you returned to the initial situation)

* close keyboard macro with C-x )

Now repeat the keyboard macro one to see it it works and if it is OK, then

C-u 2 0 0 C-x e to repeat the keyboard macro 200 times.

Adapt the keybard macro for your needs.

Miguel.

-- 
Miguel Vinicius Santini Frasson
http://www.math.leidenuniv.nl/~frasson

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

* Re: automate Emacs beautifyer ?
  2004-08-24  7:53 automate Emacs beautifyer ? Bert Cuzeau
  2004-08-24  8:22 ` Joost Kremers
  2004-08-24 10:15 ` Miguel Frasson
@ 2004-08-24 15:52 ` Kevin Rodgers
  2004-08-24 19:13   ` Michael Slass
  2004-08-28 10:58 ` Kai Grossjohann
  3 siblings, 1 reply; 22+ messages in thread
From: Kevin Rodgers @ 2004-08-24 15:52 UTC (permalink / raw)


Bert Cuzeau wrote:
 > Under Windows (or Unix), is there a way to automate Emacs doing
 > only :
 > - open file
 > - VHDL - beautify - Buffer (C-c C-b)
 > - save file
 > - exit
 >
 > We have hundreds of files to "beautify" with VHDL-mode and it is a
 > chore doing this by hand.
 >
 > Ideally, emacs with command line parameters would suit me great...

Of course:

for file in *.vhdl; do
   # Long options for readability:
   emacs --batch --visit=$file \
         --funcall=vhdl-beautify-buffer --funcall=save-buffer
   # Short options for brevity:
   # emacs -batch $file -f vhdl-beautify-buffer -f save-buffer
done

See the "Command Line Arguments" section of the Emacs manual,
especially the "Initial Options" and "Action Arguments" subnodes.

-- 
Kevin Rodgers

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

* Re: automate Emacs beautifyer ?
  2004-08-24 15:52 ` Kevin Rodgers
@ 2004-08-24 19:13   ` Michael Slass
  2004-08-24 23:27     ` Kevin Rodgers
  2004-08-26 15:26     ` Kevin Rodgers
  0 siblings, 2 replies; 22+ messages in thread
From: Michael Slass @ 2004-08-24 19:13 UTC (permalink / raw)


Kevin Rodgers <ihs_4664@yahoo.com> writes:

>Bert Cuzeau wrote:
> > Under Windows (or Unix), is there a way to automate Emacs doing
> > only :
> > - open file
> > - VHDL - beautify - Buffer (C-c C-b)
> > - save file
> > - exit
> >
> > We have hundreds of files to "beautify" with VHDL-mode and it is a
> > chore doing this by hand.
> >
> > Ideally, emacs with command line parameters would suit me great...
>
>Of course:
>
>for file in *.vhdl; do
>   # Long options for readability:
>   emacs --batch --visit=$file \
>         --funcall=vhdl-beautify-buffer --funcall=save-buffer
>   # Short options for brevity:
>   # emacs -batch $file -f vhdl-beautify-buffer -f save-buffer
>done
>
>See the "Command Line Arguments" section of the Emacs manual,
>especially the "Initial Options" and "Action Arguments" subnodes.
>

Doing this in emacs lisp has the advantage of starting emacs only
once, as opposed to once per file.   Assuming you have a list of the
files you want to change, one file per line, each file with a full
path, this elisp will do what you want:


(defun vhdl-batch-beautify (listfile-name)
  "Invoke `vhdl-beautify-buffer' on a batch of files.
LISTFILE-NAME is a path to a file containing a list of vhdl-files to
be beautified, one filename per line.  Each line should contain a full
path to the vhdl file."
  (interactive "fEnter name of file list for vhdl-beautification: ")
  (let ((file-list-buf (find-file listfile-name))
        (file-list '()))
    (save-excursion
      (set-buffer file-list-buf)
      (beginning-of-buffer)
      (while (not (eobp))
        (add-to-list
         'file-list
         (buffer-substring (point)
                           (progn (end-of-line) (point))))
        (unless (eobp) (forward-char 1)))
      (kill-buffer file-list-buf)
      ;;; probably neater to use a cl loop construct here,
      ;; but I've never learned how
      (while file-list
        (find-file (car file-list))
        (vhdl-mode)
        (vhdl-beautify-buffer)
        (save-buffer)
        (kill-buffer (current-buffer))
        (setq file-list (cdr file-list))))))



-- 
Mike Slass

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

* Re: automate Emacs beautifyer ?
  2004-08-24 19:13   ` Michael Slass
@ 2004-08-24 23:27     ` Kevin Rodgers
  2004-08-25  0:15       ` Michael Slass
  2004-08-26 15:26     ` Kevin Rodgers
  1 sibling, 1 reply; 22+ messages in thread
From: Kevin Rodgers @ 2004-08-24 23:27 UTC (permalink / raw)


Michael Slass wrote:
 > Doing this in emacs lisp has the advantage of starting emacs only
 > once, as opposed to once per file.   Assuming you have a list of the
 > files you want to change, one file per line, each file with a full
 > path, this elisp will do what you want:

Doing this in the shell has the advantage that it only requires about
3 lines using just 1 shell command (for, plus its do and done
keywords) and the emacs command (plus its 6 options and arguments).
That is a more efficient use of my time than writing 21 lines of
approximately 30 lisp function and macro calls.

-- 
Kevin Rodgers

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

* Re: automate Emacs beautifyer ?
  2004-08-24 23:27     ` Kevin Rodgers
@ 2004-08-25  0:15       ` Michael Slass
  2004-08-25 16:12         ` Kevin Rodgers
  0 siblings, 1 reply; 22+ messages in thread
From: Michael Slass @ 2004-08-25  0:15 UTC (permalink / raw)


Kevin Rodgers <ihs_4664@yahoo.com> writes:

>Doing this in the shell has the advantage that it only requires about
>3 lines using just 1 shell command (for, plus its do and done
>keywords) and the emacs command (plus its 6 options and arguments).
>That is a more efficient use of my time than writing 21 lines of
>approximately 30 lisp function and macro calls.

Yup, your way is faster for you; my way is faster for the OP. :)
-- 
Mike Slass

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

* Re: automate Emacs beautifyer ?
  2004-08-24 10:15 ` Miguel Frasson
@ 2004-08-25  8:31   ` Oliver Scholz
  2004-08-25  8:48     ` Miguel Frasson
  0 siblings, 1 reply; 22+ messages in thread
From: Oliver Scholz @ 2004-08-25  8:31 UTC (permalink / raw)


Miguel Frasson <frasson@mira.math.leidenuniv.nl> writes:

[...]
> * open file with C-x C-f
>
> (if you are usin full path, we have to delete suggestion on finding file)
[...]

No, you don't. After C-x C-f you can immediately type an absolute
filename. Emacs will grok this and Do The Right Thing.

    Oliver
-- 
9 Fructidor an 212 de la Révolution
Liberté, Egalité, Fraternité!

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

* Re: automate Emacs beautifyer ?
  2004-08-25  8:31   ` Oliver Scholz
@ 2004-08-25  8:48     ` Miguel Frasson
  2004-08-25 15:58       ` Kevin Rodgers
                         ` (2 more replies)
  0 siblings, 3 replies; 22+ messages in thread
From: Miguel Frasson @ 2004-08-25  8:48 UTC (permalink / raw)


Oliver Scholz <alkibiades@gmx.de> writes:

> No, you don't. After C-x C-f you can immediately type an absolute
> filename. Emacs will grok this and Do The Right Thing.

Interesting! Thanks for the tip.

Miguel.

-- 
Miguel Vinicius Santini Frasson
http://www.math.leidenuniv.nl/~frasson

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

* Re: automate Emacs beautifyer ?
  2004-08-25  8:48     ` Miguel Frasson
@ 2004-08-25 15:58       ` Kevin Rodgers
  2004-08-29  9:48         ` Oliver Scholz
  2004-08-25 16:03       ` automate Emacs beautifyer ? David Kastrup
  2004-08-25 20:30       ` LEE Sau Dan
  2 siblings, 1 reply; 22+ messages in thread
From: Kevin Rodgers @ 2004-08-25 15:58 UTC (permalink / raw)


Miguel Frasson wrote:
 > Oliver Scholz <alkibiades@gmx.de> writes:
 >>No, you don't. After C-x C-f you can immediately type an absolute
 >>filename. Emacs will grok this and Do The Right Thing.
 >
 > Interesting! Thanks for the tip.

Interesting, and fully documented in the File Names and Minibuffer
File nodes of the Emacs manual:

|    Note that it is legitimate to type an absolute file name after you
| enter the minibuffer, ignoring the presence of the default directory
| name as part of the text.  The final minibuffer contents may look
| invalid, but that is not so.  For example, if the minibuffer starts out
| with `/usr/tmp/' and you add `/x1/rms/foo', you get
| `/usr/tmp//x1/rms/foo'; but Emacs ignores everything through the first
| slash in the double slash; the result is `/x1/rms/foo'.  *Note
| Minibuffer File::.

The one thing the Minibuffer File node doesn't explain about that is
the way it interacts with completion: typing a TAB erases the ignored
part of the double slash path.

-- 
Kevin Rodgers

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

* Re: automate Emacs beautifyer ?
  2004-08-25  8:48     ` Miguel Frasson
  2004-08-25 15:58       ` Kevin Rodgers
@ 2004-08-25 16:03       ` David Kastrup
  2004-08-25 20:30       ` LEE Sau Dan
  2 siblings, 0 replies; 22+ messages in thread
From: David Kastrup @ 2004-08-25 16:03 UTC (permalink / raw)


Miguel Frasson <frasson@mira.math.leidenuniv.nl> writes:

> Oliver Scholz <alkibiades@gmx.de> writes:
> 
> > No, you don't. After C-x C-f you can immediately type an absolute
> > filename. Emacs will grok this and Do The Right Thing.
> 
> Interesting! Thanks for the tip.

In a CVS Emacs, try M-x customize-variable RET file-name-shadow-mode
RET, set it and save it.  It makes obvious what it happening.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

* Re: automate Emacs beautifyer ?
  2004-08-25  0:15       ` Michael Slass
@ 2004-08-25 16:12         ` Kevin Rodgers
  0 siblings, 0 replies; 22+ messages in thread
From: Kevin Rodgers @ 2004-08-25 16:12 UTC (permalink / raw)


Michael Slass wrote:
 > Yup, your way is faster for you; my way is faster for the OP. :)

Only if the number of files to be processed times the time it takes to
start emacs in batch mode and load vhdl-mode.elc is significant.  I
just think a novice user will gain more productivity faster by
learning the 17 initial and action command line options first, rather
than delving into Lisp.

-- 
Kevin Rodgers

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

* Re: automate Emacs beautifyer ?
  2004-08-25  8:48     ` Miguel Frasson
  2004-08-25 15:58       ` Kevin Rodgers
  2004-08-25 16:03       ` automate Emacs beautifyer ? David Kastrup
@ 2004-08-25 20:30       ` LEE Sau Dan
  2 siblings, 0 replies; 22+ messages in thread
From: LEE Sau Dan @ 2004-08-25 20:30 UTC (permalink / raw)


>>>>> "Miguel" == Miguel Frasson <frasson@mira.math.leidenuniv.nl> writes:

    Miguel> Oliver Scholz <alkibiades@gmx.de> writes:
    >> No, you don't. After C-x C-f you can immediately type an
    >> absolute filename. Emacs will grok this and Do The Right Thing.

    Miguel> Interesting! Thanks for the tip.

That also works for "~/foo/bar" or "~joe/foo/bar".  :)


-- 
Lee Sau Dan                     李守敦                          ~{@nJX6X~}

E-mail: danlee@informatik.uni-freiburg.de
Home page: http://www.informatik.uni-freiburg.de/~danlee

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

* Re: automate Emacs beautifyer ?
  2004-08-24 19:13   ` Michael Slass
  2004-08-24 23:27     ` Kevin Rodgers
@ 2004-08-26 15:26     ` Kevin Rodgers
  1 sibling, 0 replies; 22+ messages in thread
From: Kevin Rodgers @ 2004-08-26 15:26 UTC (permalink / raw)


Michael Slass wrote:
 > Kevin Rodgers <ihs_4664@yahoo.com> writes:
 >>for file in *.vhdl; do
 >>  # Long options for readability:
 >>  emacs --batch --visit=$file \
 >>        --funcall=vhdl-beautify-buffer --funcall=save-buffer
 >>  # Short options for brevity:
 >>  # emacs -batch $file -f vhdl-beautify-buffer -f save-buffer
 >>done
 >>
 >>See the "Command Line Arguments" section of the Emacs manual,
 >>especially the "Initial Options" and "Action Arguments" subnodes.
 >
 > Doing this in emacs lisp has the advantage of starting emacs only
 > once, as opposed to once per file.   Assuming you have a list of the
 > files you want to change, one file per line, each file with a full
 > path, this elisp will do what you want:

After exchanging a couple messages with Michael, I came up with the
idea of starting a single emacs server instance and using a client to
process each file within the shell loop:

emacs -f gnuserv-start &
#emacs_pid=$!
for file in *.vhdl; do
   gnuclient -batch $file -f vhdl-beautify-buffer -f save-buffer -f kill-buffer
done
gnuclient -f exit-emacs # || kill $emacs_pid

gnuserv/gnuclient is available at http://meltin.net/hacks/emacs/

 > (defun vhdl-batch-beautify (listfile-name)
 >   "Invoke `vhdl-beautify-buffer' on a batch of files.
 > LISTFILE-NAME is a path to a file containing a list of vhdl-files to
 > be beautified, one filename per line.  Each line should contain a full
 > path to the vhdl file."
 >   (interactive "fEnter name of file list for vhdl-beautification: ")
 >   (let ((file-list-buf (find-file listfile-name))
 >         (file-list '()))
 >     (save-excursion
 >       (set-buffer file-list-buf)
 >       (beginning-of-buffer)
 >       (while (not (eobp))
 >         (add-to-list
 >          'file-list
 >          (buffer-substring (point)
 >                            (progn (end-of-line) (point))))
 >         (unless (eobp) (forward-char 1)))
 >       (kill-buffer file-list-buf)

I also think there are more natural Emacs interfaces than LISTFILE-NAME:

(defun batch-vhdl-beautify ()           ; see batch-byte-compile
   "Invoke `vhdl-beautify-buffer' on the files remaining on the command line.
Use this from the command line, with `-batch';
it won't work in an interactive Emacs.
Each file is processed even if an error occurred previously.
For example, invoke \"emacs -batch -f batch-vhdl-beautify ~/vhdl *.vhdl\"."
   (if (not noninteractive)
       (error "`batch-vhdl-beautify' is to be used only with -batch"))
   ...)

(defun vhdl-beautify-files (&rest file-names)
   "Visit each file in FILE-NAMES and invoke `vhdl-beautify-buffer'."
   (interactive (file-expand-wildcards
                 (read-file-name "Beautify files: " nil nil nil "*.vhdl")))
   ...)

 >       ;;; probably neater to use a cl loop construct here,
 >       ;; but I've never learned how
 >       (while file-list
 >         (find-file (car file-list))
 >         (vhdl-mode)

And since we're so concerned with performance here, we should avoid
re-initializing the buffer's major mode unless we have to:

(or (eq major-mode 'vhdl-mode)
     (vhdl-mode))

 >         (vhdl-beautify-buffer)
 >         (save-buffer)
 >         (kill-buffer (current-buffer))
 >         (setq file-list (cdr file-list))))))

-- 
Kevin Rodgers

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

* Re: automate Emacs beautifyer ?
  2004-08-24  7:53 automate Emacs beautifyer ? Bert Cuzeau
                   ` (2 preceding siblings ...)
  2004-08-24 15:52 ` Kevin Rodgers
@ 2004-08-28 10:58 ` Kai Grossjohann
  3 siblings, 0 replies; 22+ messages in thread
From: Kai Grossjohann @ 2004-08-28 10:58 UTC (permalink / raw)


Bert Cuzeau <_no_spa_m_info_no_underscore_@alse-fr___.com> writes:

> Under Windows (or Unix), is there a way to automate Emacs doing
> only :
> - open file
> - VHDL - beautify - Buffer (C-c C-b)
> - save file
> - exit

My suggestion is to use dired and kbd macros.  Use M-x find-dired RET
to get a list of all VHDL files under a directory.  Then start
recording kbd macros with C-x (, then beautify the first file
manually, then move point to the next file in the dired buffer, then
end the kbd macro with C-x ).

>From dired, you can use RET to open the file in the current line.
Then you do the C-c C-b thing, then C-x C-s, then C-x k RET.  Then you
should be back in the dired buffer, where n takes you to the next
line.

This is a general method that is often useful.

Kai

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

* Re: automate Emacs beautifyer ?
  2004-08-25 15:58       ` Kevin Rodgers
@ 2004-08-29  9:48         ` Oliver Scholz
  2004-09-02  2:10           ` date discrepancies Sebastian Luque
       [not found]           ` <mailman.1182.1094095164.1998.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 22+ messages in thread
From: Oliver Scholz @ 2004-08-29  9:48 UTC (permalink / raw)


Kevin Rodgers <ihs_4664@yahoo.com> writes:

> Miguel Frasson wrote:
>  > Oliver Scholz <alkibiades@gmx.de> writes:
>  >>No, you don't. After C-x C-f you can immediately type an absolute
>  >>filename. Emacs will grok this and Do The Right Thing.
>  >
>  > Interesting! Thanks for the tip.
>
> Interesting, and fully documented in the File Names and Minibuffer
> File nodes of the Emacs manual:
[...]

I really think that `file-name-shadow-mode' (in CVS Emacs) should be
on by default.  That way people would likely discover that feature by
accident.

I seem to recall that I have used Emacs for more than a year before I
read about it in an Emacs newsgroup.  I mean: who has the whole Emacs
manual in his or her mind?

    Oliver
-- 
13 Fructidor an 212 de la Révolution
Liberté, Egalité, Fraternité!

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

* date discrepancies
  2004-08-29  9:48         ` Oliver Scholz
@ 2004-09-02  2:10           ` Sebastian Luque
       [not found]           ` <mailman.1182.1094095164.1998.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 22+ messages in thread
From: Sebastian Luque @ 2004-09-02  2:10 UTC (permalink / raw)


Dear List,

I've discovered something I can't explain and correct. Whenever I type:

M-! date

to send the date command to the shell, I get a different time and time zone 
that I get from running the command on a standard bash shell. I have set my 
clock to Central Daylight Savings Time, and this is what I get from the 
standard bash shell, but when running the command from within Emacs, I get 
the corresponding Eastern Daylight Savings Time. Would somebody please 
explain what is going on and how can this be fixed? Thanks in advance.

Cheers,
Sebastian

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

* Re: date discrepancies
       [not found]           ` <mailman.1182.1094095164.1998.help-gnu-emacs@gnu.org>
@ 2004-09-02  7:04             ` Pascal Bourguignon
  2004-09-02 14:42               ` Sebastian Luque
  2004-09-02 19:29             ` Stefan Monnier
  1 sibling, 1 reply; 22+ messages in thread
From: Pascal Bourguignon @ 2004-09-02  7:04 UTC (permalink / raw)


Sebastian Luque <sluque@mun.ca> writes:

> Dear List,
> 
> I've discovered something I can't explain and correct. Whenever I type:
> 
> M-! date
> 
> to send the date command to the shell, I get a different time and time zone 
> that I get from running the command on a standard bash shell. I have set my 
> clock to Central Daylight Savings Time, and this is what I get from the 
> standard bash shell, but when running the command from within Emacs, I get 
> the corresponding Eastern Daylight Savings Time. Would somebody please 
> explain what is going on and how can this be fixed? Thanks in advance.

It depends on how you launch emacs, therefore what environment
variables are present.  The zone is determined by the variable TZ, or
if absent, by the file /etc/locatime.

To see the time zone in emacs, type in *scratch*:  (getenv "TZ") C-u C-x C-e
To see it in shell, type: echo $TZ
Try it in a shell on xterm and in a shell on emacs: M-x shell RET echo $TZ RET

You can correct it either by modifying the environment used by the
program that launches emacs, or from emacs using: 

    (setenv "TZ" "CEST") C-x C-e

or inserting: (setenv "TZ" "CEST")
in your ~/.emacs


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

Our enemies are innovative and resourceful, and so are we. They never
stop thinking about new ways to harm our country and our people, and
neither do we.

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

* Re: date discrepancies
  2004-09-02  7:04             ` Pascal Bourguignon
@ 2004-09-02 14:42               ` Sebastian Luque
  2004-09-02 16:17                 ` Sebastian Luque
  0 siblings, 1 reply; 22+ messages in thread
From: Sebastian Luque @ 2004-09-02 14:42 UTC (permalink / raw)
  Cc: Pascal Bourguignon

Thanks Pascal, I'm a bit confused about which environment Emacs is getting to 
run shell commands. All date and time variables are correct in shell. I'm 
using a Debian box and checking the binaries for emacs, there are three of 
them: emacs, emacs21, and emacs21-x. I've always been using emacs21, which 
gives the wrong time. But if I run emacs, then it gives the correct time 
variables. Why is there a difference?


On Thu, 2 September 2004 03:04 -0500, Pascal Bourguignon wrote:
> To see the time zone in emacs, type in *scratch*:  (getenv "TZ") C-u C-x
> C-e To see it in shell, type: echo $TZ

Under emacs21, the result was "nil", and in shell, I get "America/Winnipeg", 
which is correct.


> Try it in a shell on xterm and in a shell on emacs: M-x shell RET echo $TZ
> RET

This emacs command gives the correct result, using emacs21. However, in the 
same session, M-! echo $TZ, gives no output. I'm very confused; M-x shell and 
M-! seem to be getting different environments.


> You can correct it either by modifying the environment used by the
> program that launches emacs, or from emacs using:
>
>     (setenv "TZ" "CEST") C-x C-e
>
> or inserting: (setenv "TZ" "CEST")
> in your ~/.emacs

Because my time has been already correctly set, changing it like this messes 
it up, and now the time is incorrect both in shell and in emacs M-! date, 
although the time zone shows ok. Very strange.

There is a difference between emacs and emacs21 that I'm not understanding. 
Any comments would be greatly appreciated.

Cheers,
Sebastian

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

* Re: date discrepancies
  2004-09-02 14:42               ` Sebastian Luque
@ 2004-09-02 16:17                 ` Sebastian Luque
  0 siblings, 0 replies; 22+ messages in thread
From: Sebastian Luque @ 2004-09-02 16:17 UTC (permalink / raw)


I have just found out that launching emacs from a shell (typing either 'emacs' 
or 'emacs21') and then typing 'M-! date' gives the correct time and time 
zone. However, launching emacs from the K-menu in KDE, which is set 
to /usr/bin/emacs21, gives the incorrect time zone. So the difference is not, 
in fact, linked to the various emacs binaries, but to the environment in 
place when launching the application from k-menu, as opposed to a shell.

Sebastian


On Thu, 2 September 2004 10:42 -0500, Sebastian Luque wrote:
> Thanks Pascal, I'm a bit confused about which environment Emacs is getting
> to run shell commands. All date and time variables are correct in shell.
> I'm using a Debian box and checking the binaries for emacs, there are three
> of them: emacs, emacs21, and emacs21-x. I've always been using emacs21,
> which gives the wrong time. But if I run emacs, then it gives the correct
> time variables. Why is there a difference?
>
> On Thu, 2 September 2004 03:04 -0500, Pascal Bourguignon wrote:
> > To see the time zone in emacs, type in *scratch*:  (getenv "TZ") C-u C-x
> > C-e To see it in shell, type: echo $TZ
>
> Under emacs21, the result was "nil", and in shell, I get
> "America/Winnipeg", which is correct.
>
> > Try it in a shell on xterm and in a shell on emacs: M-x shell RET echo
> > $TZ RET
>
> This emacs command gives the correct result, using emacs21. However, in the
> same session, M-! echo $TZ, gives no output. I'm very confused; M-x shell
> and M-! seem to be getting different environments.
>
> > You can correct it either by modifying the environment used by the
> > program that launches emacs, or from emacs using:
> >
> >     (setenv "TZ" "CEST") C-x C-e
> >
> > or inserting: (setenv "TZ" "CEST")
> > in your ~/.emacs
>
> Because my time has been already correctly set, changing it like this
> messes it up, and now the time is incorrect both in shell and in emacs M-!
> date, although the time zone shows ok. Very strange.
>
> There is a difference between emacs and emacs21 that I'm not understanding.
> Any comments would be greatly appreciated.
>
> Cheers,
> Sebastian
>
>
> _______________________________________________
> Help-gnu-emacs mailing list
> Help-gnu-emacs@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

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

* Re: date discrepancies
       [not found]           ` <mailman.1182.1094095164.1998.help-gnu-emacs@gnu.org>
  2004-09-02  7:04             ` Pascal Bourguignon
@ 2004-09-02 19:29             ` Stefan Monnier
  2014-08-13 14:26               ` thymythos
  1 sibling, 1 reply; 22+ messages in thread
From: Stefan Monnier @ 2004-09-02 19:29 UTC (permalink / raw)


> to send the date command to the shell, I get a different time and time zone 
> that I get from running the command on a standard bash shell. I have set my 

Your timezone is set in one of the shell's startup file, but your Emacs is
started by something which hasn't read those files.
It's a classic problem when starting Emacs from a menu in your
window-manager.

Complain to your distribution about it.  Only loud recurring complaints will
have a chance of fixing those problem (which have been known for decades,
literally).


        Stefan

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

* Re: date discrepancies
  2004-09-02 19:29             ` Stefan Monnier
@ 2014-08-13 14:26               ` thymythos
  0 siblings, 0 replies; 22+ messages in thread
From: thymythos @ 2014-08-13 14:26 UTC (permalink / raw)
  To: help-gnu-emacs

Did anyone of you experience a difference between C-c C-b and using the batch mode with -f vhdl-beautify-buffer? It seems that the handling of comment indention is different.


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

end of thread, other threads:[~2014-08-13 14:26 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-24  7:53 automate Emacs beautifyer ? Bert Cuzeau
2004-08-24  8:22 ` Joost Kremers
2004-08-24 10:15 ` Miguel Frasson
2004-08-25  8:31   ` Oliver Scholz
2004-08-25  8:48     ` Miguel Frasson
2004-08-25 15:58       ` Kevin Rodgers
2004-08-29  9:48         ` Oliver Scholz
2004-09-02  2:10           ` date discrepancies Sebastian Luque
     [not found]           ` <mailman.1182.1094095164.1998.help-gnu-emacs@gnu.org>
2004-09-02  7:04             ` Pascal Bourguignon
2004-09-02 14:42               ` Sebastian Luque
2004-09-02 16:17                 ` Sebastian Luque
2004-09-02 19:29             ` Stefan Monnier
2014-08-13 14:26               ` thymythos
2004-08-25 16:03       ` automate Emacs beautifyer ? David Kastrup
2004-08-25 20:30       ` LEE Sau Dan
2004-08-24 15:52 ` Kevin Rodgers
2004-08-24 19:13   ` Michael Slass
2004-08-24 23:27     ` Kevin Rodgers
2004-08-25  0:15       ` Michael Slass
2004-08-25 16:12         ` Kevin Rodgers
2004-08-26 15:26     ` Kevin Rodgers
2004-08-28 10:58 ` Kai Grossjohann

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