about summary refs log tree commit diff stats
path: root/share/leo.conf
blob: 34c422c4f0d30c0e9b7ea1a0bcc26df6b6b56a4a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
backup_dir = /home/andinus/backups

gpg_fingerprint = andinus@redacted
gpg_recipients = redacted

signify_seckey = /home/andinus/redacted.sec

# Profile names in [].
[emacs]
L_GnuPG = 1
# Paths to backup. '=' after path is important.
/home/andinus/.emacs.d =
# Exclude directories with `exclude' value.
/home/andinus/.emacs.d/elpa = exclude

[emacs/elpa]
L_GnuPG = 1
/home/andinus/.emacs.d/elpa =

[irclogs]
L_GnuPG = 1
# Don't sign this.
L_GnuPG_no_sign = 1

/home/andinus/irc-logs =
bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
# Example program showing exceptions built out of delimited continuations.

# Since Mu is statically typed, we can't build an all-purpose higher-order
# function called 'try'; it wouldn't know how many arguments the function
# passed to it needs to take, what their types are, etc. Instead, until Mu
# gets macros we'll directly use the continuation primitives.

def main [
  local-scope
  foo false/no-exception
  foo true/raise-exception
]

# example showing exception handling
def foo raise-exception?:bool [
  local-scope
  load-inputs
  # To run an instruction of the form:
  #   try f ...
  # write this:
  #   call-with-continuation-mark 999/exception-tag, f, ...
  # By convention we reserve tag 999 for exceptions.
  #
  # 'f' above may terminate at either a regular 'return' or a 'return-with-continuation-mark'.
  # We never re-call the continuation returned in the latter case;
  # its existence merely signals that an exception was raised.
  # So just treat it as a boolean.
  # The other inputs and outputs to 'call-with-continuation-mark' depend on
  # the function it is called with.
  exception-raised?:bool, err:text, result:num <- call-with-continuation-mark 999/exception-tag, f, raise-exception?
  {
    break-if exception-raised?
    $print [normal exit; result ] result 10/newline
  }
  {
    break-unless exception-raised?
    $print [error caught: ] err 10/newline
  }
]

# A callee function that can raise an exception has some weird constraints at
# the moment.
#
# The caller's 'call-with-continuation-mark' instruction may return with
# either a regular 'return' or a 'return-continuation-until-mark'.
# To handle both cases, regular 'return' instructions in the callee must
# prepend an extra 0 result, in place of the continuation that may have been
# returned.
# This change to number of outputs violates our type system, so the call has
# to be dynamically typed. The callee can't have a header.
def f [
  local-scope
  raise-exception?:bool <- next-input
  {
    break-unless raise-exception?
    # throw/raise: 2 results + implicit continuation (ignoring the continuation tag)
    return-continuation-until-mark 999/exception-tag, [error will robinson!], 0/unused
  }
  # normal return: 3 results including 0 continuation placeholder at start
  return 0/continuation-placeholder, null/no-error, 34/regular-result
]