unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Emanuel Berg <embe8573@student.uu.se>
To: help-gnu-emacs@gnu.org
Subject: Re: code listp to determine wich os I'm running on
Date: Wed, 29 Jan 2014 21:28:56 +0100	[thread overview]
Message-ID: <87mwiettum.fsf@nl106-137-194.student.uu.se> (raw)
In-Reply-To: mailman.13113.1391020728.10748.help-gnu-emacs@gnu.org

Renato <renato.pontefice@gmail.com> writes:

> Hi, I'm looking for some code to insert in my .emacs
> to determine wich s.o I'm running. ...

Instead of `string-equal', there is string= which is an
alias for `string-equal'. Might be faster to type and
takes less place.

You don't need to use progn for a single form. Use
progn when you want to execute a bunch of forms, and
then have the *last* form's value to be the evaluation
of the whole progn form. This is what the "n" is -
execute n programs, and return the value of the last
(the "nth"). Compare: prog1

(progn 1 2 3) ; 3
(prog1 1 2 3) ; 1

The if in Lisp looks like this:

(if condition then else)

E.g., (if (> x y) x y) => x, if x is bigger than y,
else y. (You may omit the "else" part if it is `nil',
since then the whole if form will evaluate to nil
anyway, if not the condition is true.)

But you already used `cond'. `cond' and if are the
same: cond is nested ifs, if you like. To you, as a
programmer, it doesn't matter if cond is syntactic
sugar for `if', or if it is the other way around. This
only matters to the guy not programming Lisp programs,
but the Lisp system itself.

(if (string= system-type "gnu/linux")
    (setq some-variable "...")
  (if (string= system-type "...")
      (setq some-variable "...") ))

Or with `cond':

(setq some-variable
      (cond ((string= system-type "gnu/linux") 'value-1)
            ((string= system-type "...")       'value-2) ))

And so on. (You can do this in any way you like.)

You don't need to do the F1 maneuver to check
results. Just place point (the cursor) to the right of
the right-most paren, then hit `C-x C-e' (for
`eval-last-sexp'). This also works for symbols
(variables).

With the load-path though - do you really need to set
it?

-- 
underground experts united:
http://user.it.uu.se/~embe8573


       reply	other threads:[~2014-01-29 20:28 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.13113.1391020728.10748.help-gnu-emacs@gnu.org>
2014-01-29 20:28 ` Emanuel Berg [this message]
2014-01-29 22:12   ` code listp to determine wich os I'm running on Renato
2014-01-29 23:26     ` Peter Dyballa
2014-01-30  0:11     ` Stefan Monnier
     [not found]   ` <mailman.13124.1391033590.10748.help-gnu-emacs@gnu.org>
2014-01-29 22:27     ` Emanuel Berg
2014-01-30  2:27     ` Rusi
2014-01-30  2:47     ` Rusi
2014-01-29 21:14 ` Pascal J. Bourguignon
2014-01-29 23:52   ` Emanuel Berg
2014-01-30  2:43 ` Rusi
2014-01-30  3:47   ` Stefan Monnier
     [not found]   ` <mailman.13151.1391053674.10748.help-gnu-emacs@gnu.org>
2014-01-30  4:01     ` Rusi
2014-01-30 12:59       ` Rusi
     [not found] <mailman.13331.1391158986.10748.help-gnu-emacs@gnu.org>
2014-01-31 11:57 ` Rusi
2014-01-31  9:03 Renato Pontefice
2014-01-31 13:28 ` Stefan Monnier
2014-01-31 23:01   ` Tassilo Horn
     [not found] ` <mailman.13357.1391175021.10748.help-gnu-emacs@gnu.org>
2014-01-31 14:05   ` Rusi
2014-01-31 17:02     ` Renato
     [not found]     ` <mailman.13385.1391187779.10748.help-gnu-emacs@gnu.org>
2014-01-31 17:15       ` Rusi
2014-01-31 17:32       ` Rusi
  -- strict thread matches above, loose matches on Subject: below --
2014-01-31  8:39 Renato Pontefice
2014-01-30  1:55 Louis-Guillaume Gagnon
2014-01-30  1:57 ` Louis-Guillaume Gagnon
2014-01-29 18:41 Renato

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mwiettum.fsf@nl106-137-194.student.uu.se \
    --to=embe8573@student.uu.se \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).