The open-with Reference Manual

This is the open-with Reference Manual, version 1.0.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 07:12:14 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 open-with

Open a file in a suitable external program

Maintainer

Yukari Hafner <>

Author

Yukari Hafner <>

Home Page

https://shinmera.github.io/open-with

Source Control

(GIT https://github.com/Shinmera/open-with.git)

Bug Tracker

https://github.com/Shinmera/open-with/issues

License

zlib

Version

1.0.0

Dependencies
  • documentation-utils (system).
  • trivial-features (system).
  • uiop (system).
  • cffi (system)., for feature :nx
Source

open-with.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 open-with/open-with.asd

Source

open-with.asd.

Parent Component

open-with (system).

ASDF Systems

open-with.


3.1.2 open-with/package.lisp

Source

open-with.asd.

Parent Component

open-with (system).

Packages

org.shirakumo.open-with.


3.1.3 open-with/toolkit.lisp

Dependency

package.lisp (file).

Source

open-with.asd.

Parent Component

open-with (system).

Public Interface
Internals

3.1.4 open-with/documentation.lisp

Dependency

toolkit.lisp (file).

Source

open-with.asd.

Parent Component

open-with (system).


4 Packages

Packages are listed by definition order.


4.1 org.shirakumo.open-with

Source

package.lisp.

Use List

common-lisp.

Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Special variables

Special Variable: *default-file-handler*

The default handler for files when no specific one is set.

You may set this to any handler as specified by RUN-HANDLER.

See *FILE-TYPE-ASSOCIATIONS*
See RUN-HANDLER
See OPEN

Package

org.shirakumo.open-with.

Source

toolkit.lisp.

Special Variable: *default-url-handler*

The default handler for URLs when no specific one is set.

You may set this to any handler as specified by RUN-HANDLER.

See *URL-SCHEMA-ASSOCIATIONS*
See RUN-HANDLER
See OPEN

Package

org.shirakumo.open-with.

Source

toolkit.lisp.

Special Variable: *file-type-associations*

A hash table associating file extension types to handlers.

You may set entries in this table with keys being PATHNAME-TYPEs and values being handlers as specified by RUN-HANDLER.

See RUN-HANDLER
See OPEN

Package

org.shirakumo.open-with.

Source

toolkit.lisp.

Special Variable: *url-schema-associations*

A hash table associating url schemas to handlers.

You may set entries in this table with keys being URL schemas and values being handlers as specified by RUN-HANDLER.

See RUN-HANDLER
See OPEN

Package

org.shirakumo.open-with.

Source

toolkit.lisp.


5.1.2 Ordinary functions

Function: external-open-with-fun (program &rest args)

Create a handler for an external program.

An external program with the given name is searched for in directories listed in the PATH environment variable (on Windows with the .exe suffix). If none can be found, an error is signalled. If one can be found, a function suitable for RUN-HANDLER is returned that will create a process for the program to open the THING with. When starting the program, ARGS are provided as command-line arguments to the program, with the THING to open as the last argument appended on.

See RUN-HANDLER

Package

org.shirakumo.open-with.

Source

toolkit.lisp.

Function: run-handler (handler thing &rest args &key &allow-other-keys)

Run a handler for the THING with the given arguments.

HANDLER can be one of the following:

HANDLER ::= symbol
| function
| program
| (option+)
program ::= string
option ::= symbol
| function
| program
| (program string*)

Where OPTIONs are potential handlers that are tried in sequence until one that does not error appears. If none of the options run without error, an error is signalled at the end.

In the case of SYMBOLs and FUNCTIONs, the designated lisp function is simply invoked with THING and ARGS. In the case of PROGRAMs, a handler function is constructed via EXTERNAL-OPEN-WITH-FUN

In all cases ARGS should be a keyword argument list, and whatever handler must accept any keyword argument, though may ignore all of them. The only specified keyword argument is BACKGROUND which, if true, specifies that the handler should be run in the background and the function should return immediately.

See EXTERNAL-OPEN-WITH-FUN

Package

org.shirakumo.open-with.

Source

toolkit.lisp.


5.1.3 Generic functions

Generic Function: open (thing &rest args)

Attempts to open THING for viewing or editing.

Users may add methods to this function to customise the behhaviour for other types. A default implementation for PATHNAMEs and STRINGs is provided, which invokes a file handler for pathnames and strings unless the string starts with an URL schema, in which case a url handler is invoked instead.

For files, if the pathname has a type, a corresponding handler is looked up in the *FILE-TYPE-ASSOCIATIONS* table. If it is a directory, the handler is looked up by the :DIRECTORY key. Otherwise it is looked up by the :FILE key. If no custom handler is set, the *DEFAULT-FILE-HANDLER* is used.

For URLs, a corresponding handler is looked up in the *URL-SCHEMA-ASSOCIATIONS* table. If no custom handler is set, the *DEFAULT-URL-HANDLER* is used.

Whatever the case, the chosen handler is then invoked on THING and ARGS via the RUN-HANDLER function.

See *FILE-TYPE-ASSOCIATIONS*
See *URL-SCHEMA-ASSOCIATIONS*
See *DEFAULT-FILE-HANDLER*
See *DEFAULT-URL-HANDLER*
See RUN-HANDLER

Package

org.shirakumo.open-with.

Source

toolkit.lisp.

Methods
Method: open ((string string) &rest args)
Method: open ((pathname pathname) &rest args)

5.2 Internals


5.2.1 Ordinary functions

Function: alphabetic-p (char)
Package

org.shirakumo.open-with.

Source

toolkit.lisp.

Function: find-program (program)
Package

org.shirakumo.open-with.

Source

toolkit.lisp.


Appendix A Indexes


A.1 Concepts