all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Disable certain commands in non window mode
@ 2008-09-25  9:27 MiH
  2008-09-25  9:31 ` Richard Riley
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: MiH @ 2008-09-25  9:27 UTC (permalink / raw)
  To: help-gnu-emacs

These are certain statements in my .emacs file.

(add-to-list 'load-path "~/.emacs.d")
(global-font-lock-mode  t)
(set-scroll-bar-mode 'right)
(require 'color-theme)
(color-theme-initialize)
(color-theme-whateveryouwant)
(mwheel-install)

;; rest of the .emacs file

The thing is I want to disable loading of the above statements while
in non-window (emacs -nw) mode, but want them while using X11. Since I
am new to elisp, I am not yet quite sure how to do this.

Thanks in advance to anyone providing a solution


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

* Re: Disable certain commands in non window mode
  2008-09-25  9:27 Disable certain commands in non window mode MiH
@ 2008-09-25  9:31 ` Richard Riley
  2008-09-25  9:36 ` Joost Kremers
  2008-09-25 15:54 ` Alex Bennee
  2 siblings, 0 replies; 5+ messages in thread
From: Richard Riley @ 2008-09-25  9:31 UTC (permalink / raw)
  To: help-gnu-emacs


MiH <md.imad@gmail.com> writes:

> These are certain statements in my .emacs file.
>
> (add-to-list 'load-path "~/.emacs.d")
> (global-font-lock-mode  t)
> (set-scroll-bar-mode 'right)
> (require 'color-theme)
> (color-theme-initialize)
> (color-theme-whateveryouwant)
> (mwheel-install)
>
> ;; rest of the .emacs file
>
> The thing is I want to disable loading of the above statements while
> in non-window (emacs -nw) mode, but want them while using X11. Since I
> am new to elisp, I am not yet quite sure how to do this.
>
> Thanks in advance to anyone providing a solution

Possibly something like:

(cond ((eq window-system 'x)
;       (message "X loaded")
       (require 'icicles)
       (load "~/.emacs.d/icicles/icicles-install")
       (icy-mode t)
;       (color-theme-classic)
       )
      (t (color-theme-tty-dark)))


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

* Re: Disable certain commands in non window mode
  2008-09-25  9:27 Disable certain commands in non window mode MiH
  2008-09-25  9:31 ` Richard Riley
@ 2008-09-25  9:36 ` Joost Kremers
  2008-09-25 15:54 ` Alex Bennee
  2 siblings, 0 replies; 5+ messages in thread
From: Joost Kremers @ 2008-09-25  9:36 UTC (permalink / raw)
  To: help-gnu-emacs

MiH wrote:
> These are certain statements in my .emacs file.
>
> (add-to-list 'load-path "~/.emacs.d")
> (global-font-lock-mode  t)
> (set-scroll-bar-mode 'right)
> (require 'color-theme)
> (color-theme-initialize)
> (color-theme-whateveryouwant)
> (mwheel-install)
>
> ;; rest of the .emacs file
>
> The thing is I want to disable loading of the above statements while
> in non-window (emacs -nw) mode, but want them while using X11. Since I
> am new to elisp, I am not yet quite sure how to do this.

check the value of the variable WINDOW-SYSTEM: as per the documentation, it
is nil if emacs is running in a terminal. so you can do:

(when window-system
  (add-to-list 'load-path "~/.emacs.d")
  (global-font-lock-mode  t)
  (set-scroll-bar-mode 'right)
  (require 'color-theme)
  (color-theme-initialize)
  (color-theme-whateveryouwant)
  (mwheel-install))


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


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

* Re: Disable certain commands in non window mode
  2008-09-25  9:27 Disable certain commands in non window mode MiH
  2008-09-25  9:31 ` Richard Riley
  2008-09-25  9:36 ` Joost Kremers
@ 2008-09-25 15:54 ` Alex Bennee
  2008-09-25 16:21   ` Nikolaj Schumacher
  2 siblings, 1 reply; 5+ messages in thread
From: Alex Bennee @ 2008-09-25 15:54 UTC (permalink / raw)
  To: MiH; +Cc: help-gnu-emacs

On Thu, 2008-09-25 at 02:27 -0700, MiH wrote:
> These are certain statements in my .emacs file.
> 
> (add-to-list 'load-path "~/.emacs.d")
> (global-font-lock-mode  t)
> (set-scroll-bar-mode 'right)
> (require 'color-theme)
> (color-theme-initialize)
> (color-theme-whateveryouwant)
> (mwheel-install)
> 
> ;; rest of the .emacs file
> 
> The thing is I want to disable loading of the above statements while
> in non-window (emacs -nw) mode, but want them while using X11. Since I
> am new to elisp, I am not yet quite sure how to do this.

You can directly wrap them as others have noted. However as my .emacs is
quite big I tend to define a number variables which I can test later.
For example:

(defvar I-am-in-X (eval 'window-system));
(defvar I-am-in-console (not (eval 'window-system)))
(defvar I-am-on-MacOSX (string-match "Carbon" (emacs-version)))
(defvar I-am-remote (getenv "SSH_TTY"))

And then later I have code like:

	  (if I-am-in-console
	      (progn
		(color-theme-initialize)
		(color-theme-euphoria)))

> 
> Thanks in advance to anyone providing a solution
-- 
Alex Bennee, Software Engineer
The best defense against logic is ignorance.





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

* Re: Disable certain commands in non window mode
  2008-09-25 15:54 ` Alex Bennee
@ 2008-09-25 16:21   ` Nikolaj Schumacher
  0 siblings, 0 replies; 5+ messages in thread
From: Nikolaj Schumacher @ 2008-09-25 16:21 UTC (permalink / raw)
  To: Alex Bennee; +Cc: MiH, help-gnu-emacs

Alex Bennee <ajb-ml@cbnl.com> wrote:

> (defvar I-am-in-X (eval 'window-system));

Why don't you just:

(defvar I-am-in-X window-system)

> (defvar I-am-on-MacOSX (string-match "Carbon" (emacs-version)))

Since Emacs 23 is abandoning Carbon, the following should be more safe
for the future:

(defvar I-am-on-MacOSX (eq system-type 'darwin))


regards,
Nikolaj Schumacher




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

end of thread, other threads:[~2008-09-25 16:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-25  9:27 Disable certain commands in non window mode MiH
2008-09-25  9:31 ` Richard Riley
2008-09-25  9:36 ` Joost Kremers
2008-09-25 15:54 ` Alex Bennee
2008-09-25 16:21   ` Nikolaj Schumacher

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.