public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] Re: Emacs settings for ebuild scripts
       [not found] <m2g07riw2j.fsf@columbus.localdomain>
@ 2001-11-09 17:39 ` Andreas Voegele
  2001-11-10  5:51 ` [gentoo-dev] " Mikael Hallendal
  1 sibling, 0 replies; 3+ messages in thread
From: Andreas Voegele @ 2001-11-09 17:39 UTC (permalink / raw
  To: gentoo-dev

Hi,

> Ebuild writers may add the following Emacs Lisp code to their .emacs
> file.  The code adds an ebuild mode which is based on the shell mode
> and sets the tabwidth to 4.
> 
> (define-derived-mode ebuild-script-mode
>   sh-mode "Ebuild-script"
>   "Major mode for editing ebuild scripts.
> \\{ebuild-mode-map}"
>   (setq tab-width 4))
> 
> (setq auto-mode-alist
>       (append
>        '(("\\.ebuild$" . ebuild-script-mode))
>        auto-mode-alist))
> 
> I've tested this code with GNU Emacs.  Can anyone check if the code
> works with XEmacs?

I've just verified that this code works with XEmacs.

-- 
Bye,
Andreas



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

* Re: [gentoo-dev] Emacs settings for ebuild scripts
       [not found] <m2g07riw2j.fsf@columbus.localdomain>
  2001-11-09 17:39 ` [gentoo-dev] Re: Emacs settings for ebuild scripts Andreas Voegele
@ 2001-11-10  5:51 ` Mikael Hallendal
  2001-11-10  7:18   ` [gentoo-dev] " Andreas Voegele
  1 sibling, 1 reply; 3+ messages in thread
From: Mikael Hallendal @ 2001-11-10  5:51 UTC (permalink / raw
  To: gentoo-dev

tis 2001-11-06 klockan 19.38 skrev Andreas Voegele:
> Hi!

Hi!

In Emacs21 I get an error when hitting TAB telling me I'm not in
shell-script-mode. You know what's causing that?

Regards,
  Mikael Hallendal
 
> Ebuild writers may add the following Emacs Lisp code to their .emacs
> file.  The code adds an ebuild mode which is based on the shell mode
> and sets the tabwidth to 4.
> 
> (define-derived-mode ebuild-script-mode
>   sh-mode "Ebuild-script"
>   "Major mode for editing ebuild scripts.
> \\{ebuild-mode-map}"
>   (setq tab-width 4))
> 
> (setq auto-mode-alist
>       (append
>        '(("\\.ebuild$" . ebuild-script-mode))
>        auto-mode-alist))
> 
> I've tested this code with GNU Emacs.  Can anyone check if the code
> works with XEmacs?
> 
> There's a patch for the Gentoo Linux Developers HOWTO attached to this
> mail.  The patch replaces the text "TODO: add stuff about emacs" with
> the above code.
> 
> ----
> 

> --- /mnt/gentoo/usr/portage/app-doc/gentoo-web/files/xml/gentoo-howto.xml	Fri Oct 19 21:03:36 2001
> +++ gentoo-howto.xml	Tue Nov  6 19:31:35 2001
> @@ -319,7 +319,20 @@
>  	set tabstop=4 shiftwidth=4 noexpandtab
>  endif
>  </pre>
> -<p>TODO: add stuff about emacs.</p></body>
> +<p>If you're using GNU Emacs, you can put the following code into your .emacs file.</p>
> +<pre>
> +(define-derived-mode ebuild-script-mode
> +  sh-mode "Ebuild-script"
> +  "Major mode for editing ebuild scripts.
> +\\{ebuild-mode-map}"
> +  (setq tab-width 4))
> +
> +(setq auto-mode-alist
> +      (append
> +       '(("\\.ebuild$" . ebuild-script-mode))
> +       auto-mode-alist))
> +</pre>
> +</body>
>  </section>
>  
>  <section>
-- 
Mikael Hallendal              http://micke.hallendal.net/
Stockholm, Sweden             Cell: +46 (0)709 718 918







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

* [gentoo-dev] Re: Emacs settings for ebuild scripts
  2001-11-10  5:51 ` [gentoo-dev] " Mikael Hallendal
@ 2001-11-10  7:18   ` Andreas Voegele
  0 siblings, 0 replies; 3+ messages in thread
From: Andreas Voegele @ 2001-11-10  7:18 UTC (permalink / raw
  To: gentoo-dev

Mikael Hallendal writes:

> In Emacs21 I get an error when hitting TAB telling me I'm not in
> shell-script-mode. You know what's causing that?

I don't know if this is a feature or a bug in Emacs 21.  The function
sh-must-be-shell-mode in sh-script.el looks like this:

(defun sh-must-be-shell-mode ()
  "Signal an error if not in Shell-script mode."
  (unless (eq major-mode 'sh-mode)
    (error "This buffer is not in Shell-script mode")))

IMHO the expression (eq major-mode 'sh-mode) should be replaced with
(derived-mode-p 'sh-mode).

I'll ask the Emacs developers.

In the meanwhile the following code, which includes an advice for
sh-must-be-shell-mode, can be used:

(define-derived-mode ebuild-script-mode
  sh-mode "Ebuild-script" nil
  (setq tab-width 4))

(setq auto-mode-alist
      (append
       '(("\\.ebuild$" . ebuild-script-mode))
       auto-mode-alist))

(defadvice sh-must-be-shell-mode
  (around sh-must-be-shell-mode-around activate)
  "Accept modes derived from sh-mode."
  (unless (derived-mode-p 'sh-mode)
    ad-do-it))

-- 
Andreas



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

end of thread, other threads:[~2001-11-10 14:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <m2g07riw2j.fsf@columbus.localdomain>
2001-11-09 17:39 ` [gentoo-dev] Re: Emacs settings for ebuild scripts Andreas Voegele
2001-11-10  5:51 ` [gentoo-dev] " Mikael Hallendal
2001-11-10  7:18   ` [gentoo-dev] " Andreas Voegele

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox