Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some changes to get emacs live to start in Emacs 27.1 #264

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packs/stable/foundation-pack/config/cosmetic.el
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
(cond
((member (window-system) '(x w32 ns))
(add-to-list 'default-frame-alist (cons 'font font-string))
(set-default-font font-string t t))))
(set-frame-font font-string t t))))

(defun live-set-default-darwin-font (font-string)
"Sets the default font and sets all frames to the same font trying to maintain window resolution. Only changes font if system-type is darwin in a window system."
Expand Down
26 changes: 20 additions & 6 deletions packs/stable/foundation-pack/lib/swiper/Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
emacs ?= emacs

LOAD = -l colir.el -l ivy.el -l swiper.el -l counsel.el

.PHONY: all compile clean
LOAD = -l elpa.el -l colir.el -l ivy-overlay.el -l ivy.el -l swiper.el -l counsel.el
RM ?= rm -f

all: test

deps:
$(emacs) -batch -l targets/install-deps.el

test:
$(emacs) -batch $(LOAD) -l ivy-test.el -f ert-run-tests-batch-and-exit
$(emacs) -batch $(LOAD) -l ivy-test.el -f ivy-test-run-tests

checkdoc:
$(emacs) -batch -l targets/checkdoc.el

compile:
$(emacs) -batch --eval "(progn (add-to-list 'load-path default-directory) (mapc #'byte-compile-file '(\"ivy.el\" \"swiper.el\" \"counsel.el\")))"
$(emacs) -batch -l elpa.el -L . -f batch-byte-compile colir.el ivy-faces.el ivy-overlay.el ivy.el ivy-avy.el swiper.el counsel.el

plain:
$(emacs) --version
$(emacs) -Q -l elpa.el -l targets/plain.el

obsolete:
$(emacs) -batch -l targets/obsolete-config.el

clean:
rm -f *.elc
$(RM) *.elc

.PHONY: all test checkdoc compile plain obsolete update-issues clean
107 changes: 84 additions & 23 deletions packs/stable/foundation-pack/lib/swiper/README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
[![Build Status](https://travis-ci.org/abo-abo/swiper.svg?branch=master)](https://travis-ci.org/abo-abo/swiper) [![MELPA](https://melpa.org/packages/swiper-badge.svg)](https://melpa.org/#/swiper)
[![Build Status](https://travis-ci.org/abo-abo/swiper.svg?branch=master)](https://travis-ci.org/abo-abo/swiper)

## Swiper
***flexible, simple tools for minibuffer completion in Emacs***

Package for GNU Emacs that shows an overview during regex searching.
This repository contains:

![swiper.png](http://oremacs.com/download/swiper.png)
**Ivy**, a generic completion mechanism for Emacs.

The package uses the `ivy` back end for the overview, see also
[swiper-helm](https://github.com/abo-abo/swiper-helm).

## Screenshots
**Counsel**, a collection of Ivy-enhanced versions of common Emacs
commands.

![ivy-swiper-1.png](http://oremacs.com/download/ivy-swiper-1.png)
**Swiper**, an Ivy-enhanced alternative to isearch.

There's also a ten minute [video demo](https://www.youtube.com/watch?v=VvnJQpTFVDc).
# Ivy

## Ivy
[![MELPA](https://melpa.org/packages/ivy-badge.svg)](https://melpa.org/#/ivy)
[![MELPA Stable](https://stable.melpa.org/packages/ivy-badge.svg)](https://stable.melpa.org/#/ivy)

Ivy is a generic completion mechanism for Emacs. While it operates
similarly to other completion schemes such as `icomplete-mode`, Ivy
Expand All @@ -26,14 +25,18 @@ To try Ivy, just call <kbd>M-x</kbd> `ivy-mode`. This will enable
generic Ivy completion, including specific completion for file and
buffer names.

## Installation
### Installation

Install the `ivy` package from MELPA / GNU ELPA.

Install the `swiper` package from MELPA / GNU ELPA.
Users of Debian ≥10 (and derivatives such as Ubuntu ≥18.04) can
install Ivy, Counsel, and Swiper with `sudo apt install elpa-counsel`.
To add Hydra support `sudo apt install elpa-ivy-hydra`.

## Documentation

### Manual
The manual is available as [HTML](http://oremacs.com/swiper/).
The manual is available as [HTML](https://oremacs.com/swiper/).

After installing from MELPA, the manual is also available through the `(ivy)` Info node.

Expand All @@ -44,38 +47,96 @@ The source file for the Info page is
Ivy and Swiper wiki is here: [the wiki](https://github.com/abo-abo/swiper/wiki).

### Small config example

```elisp
(ivy-mode 1)
(setq ivy-use-virtual-buffers t)
(setq enable-recursive-minibuffers t)
;; enable this if you want `swiper' to use it
;; (setq search-default-mode #'char-fold-to-regexp)
(global-set-key "\C-s" 'swiper)
(global-set-key (kbd "C-c C-r") 'ivy-resume)
(global-set-key (kbd "<f6>") 'ivy-resume)
(global-set-key (kbd "M-x") 'counsel-M-x)
(global-set-key (kbd "C-x C-f") 'counsel-find-file)
(global-set-key (kbd "<f1> f") 'counsel-describe-function)
(global-set-key (kbd "<f1> v") 'counsel-describe-variable)
(global-set-key (kbd "<f1> l") 'counsel-load-library)
(global-set-key (kbd "<f1> o") 'counsel-describe-symbol)
(global-set-key (kbd "<f1> l") 'counsel-find-library)
(global-set-key (kbd "<f2> i") 'counsel-info-lookup-symbol)
(global-set-key (kbd "<f2> u") 'counsel-unicode-char)
(global-set-key (kbd "C-c g") 'counsel-git)
(global-set-key (kbd "C-c j") 'counsel-git-grep)
(global-set-key (kbd "C-c k") 'counsel-ag)
(global-set-key (kbd "C-x l") 'counsel-locate)
(global-set-key (kbd "C-S-o") 'counsel-rhythmbox)
(define-key minibuffer-local-map (kbd "C-r") 'counsel-minibuffer-history)
```

## Contributing
Note: parts of this config can be replaced by using `counsel-mode`.

# Counsel

[![MELPA](https://melpa.org/packages/counsel-badge.svg)](https://melpa.org/#/counsel)
[![MELPA Stable](https://stable.melpa.org/packages/counsel-badge.svg)](https://stable.melpa.org/#/counsel)

`ivy-mode` ensures that any Emacs command using
`completing-read-function` uses ivy for completion.

Counsel takes this further, providing versions of common Emacs
commands that are customised to make the best use of ivy. For example,
`counsel-find-file` has some additional keybindings. Pressing
<kbd>DEL</kbd> will move you to the parent directory.

Enabling `counsel-mode` remaps built-in Emacs functions that have
counsel replacements:

### Copyright Assignment
| Emacs command | Counsel equivalent |
|--------------------------|----------------------------|
| execute-extended-command | counsel-M-x |
| describe-bindings | counsel-descbinds |
| describe-function | counsel-describe-function |
| describe-variable | counsel-describe-variable |
| apropos-command | counsel-apropos |
| describe-face | counsel-describe-face |
| list-faces-display | counsel-faces |
| find-file | counsel-find-file |
| find-library | counsel-find-library |
| imenu | counsel-imenu |
| load-library | counsel-load-library |
| load-theme | counsel-load-theme |
| yank-pop | counsel-yank-pop |
| info-lookup-symbol | counsel-info-lookup-symbol |
| pop-to-mark-command | counsel-mark-ring |
| bookmark-jump | counsel-bookmark |

Swiper is subject to the same [copyright assignment](http://www.gnu.org/prep/maintain/html_node/Copyright-Papers.html) policy as Emacs itself, org-mode, CEDET and other packages in [GNU ELPA](http://elpa.gnu.org/packages/). Any [legally significant](http://www.gnu.org/prep/maintain/html_node/Legally-Significant.html#Legally-Significant) contributions can only be accepted after the author has completed their paperwork. Please see [the request form](http://git.savannah.gnu.org/cgit/gnulib.git/tree/doc/Copyright/request-assign.future) if you want to proceed.
# Swiper

[![MELPA](https://melpa.org/packages/swiper-badge.svg)](https://melpa.org/#/swiper)
[![MELPA Stable](https://stable.melpa.org/packages/swiper-badge.svg)](https://stable.melpa.org/#/swiper)

Swiper is an alternative to isearch that uses ivy to show an overview
of all matches.

![swiper.png](https://oremacs.com/download/swiper.png)

A helm version of swiper is also available:
[swiper-helm](https://github.com/abo-abo/swiper-helm).

## Screenshots

![ivy-swiper-1.png](https://oremacs.com/download/ivy-swiper-1.png)

There's also a ten minute [video demo](https://www.youtube.com/watch?v=VvnJQpTFVDc).

The copyright assignment isn't a big deal, it just says that the copyright for your submitted changes to Emacs belongs to the FSF. This assignment works for all projects related to Emacs. To obtain it, you need to send one email, then send one letter (if you live in the US, it's digital), and wait for some time (in my case, I had to wait for one month).
# Frequently asked questions

### Style
Q: How do I enter an input that matches one of the candidates instead
of this candidate? Example: create a file `bar` when a file
`barricade` exists in the current directory.

The basic code style guide is to use `(setq indent-tabs-mode nil)`. It is provided for you in [.dir-locals.el](https://github.com/abo-abo/swiper/blob/master/.dir-locals.el), please obey it.
A: Press <kbd>C-M-j</kbd>. Alternatively, you can make the prompt line selectable with `(setq ivy-use-selectable-prompt t)`.

Before submitting the change, run `make compile` and `make test` to make sure that it doesn't introduce new compile warnings or test failures. Also run <kbd>M-x</kbd> `checkdoc` to see that your changes obey the documentation guidelines.
# Contributing

Use your own judgment for the commit messages, I recommend a verbose style using `magit-commit-add-log`.
Please see the [guidelines](https://github.com/abo-abo/swiper/blob/master/CONTRIBUTING.org) for reporting issues and opening pull requests.
78 changes: 50 additions & 28 deletions packs/stable/foundation-pack/lib/swiper/colir.el
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
;;; colir.el --- Color blending library -*- lexical-binding: t -*-

;; Copyright (C) 2015 Free Software Foundation, Inc.
;; Copyright (C) 2015-2019 Free Software Foundation, Inc.

;; Author: Oleh Krehel <[email protected]>

Expand All @@ -17,28 +17,30 @@
;; GNU General Public License for more details.

;; For a full copy of the GNU General Public License
;; see <http://www.gnu.org/licenses/>.
;; see <https://www.gnu.org/licenses/>.

;;; Commentary:
;;

;; This package solves the problem of adding a face with a background
;; to text which may already have a background. In all conflicting
;; areas, instead of choosing either the original or the new
;; background face, their blended sum is used.
;;
;; The blend mode functions are taken from http://en.wikipedia.org/wiki/Blend_modes.
;; The blend mode functions are taken from URL
;; `https://en.wikipedia.org/wiki/Blend_modes'.

;;; Code:

(require 'cl-lib)
(require 'color)

(defcustom colir-compose-method 'colir-compose-alpha
(defcustom colir-compose-method #'colir-compose-alpha
"Select a method to compose two color channels."
:type '(choice
(const colir-compose-alpha)
(const colir-compose-overlay)
(const colir-compose-soft-light))
:group 'ivy)
:group 'ivy
:type '(radio
(function-item colir-compose-alpha)
(function-item colir-compose-overlay)
(function-item colir-compose-soft-light)))

(defun colir-compose-soft-light (a b)
"Compose A and B channels."
Expand All @@ -53,7 +55,10 @@
(- 1 (* 2 (- 1 a) (- 1 b)))))

(defun colir-compose-alpha (a b &optional alpha gamma)
"Compose A and B channels."
"Compose A and B channels.
Optional argument ALPHA is a number between 0.0 and 1.0 which corresponds
to the influence of A on the result. Default value is 0.5.
Optional argument GAMMA is used for gamma correction. Default value is 2.2."
(setq alpha (or alpha 0.5))
(setq gamma (or gamma 2.2))
(+ (* (expt a gamma) alpha) (* (expt b gamma) (- 1 alpha))))
Expand All @@ -69,32 +74,49 @@ C1 and C2 are triples of floats in [0.0 1.0] range."
colir-compose-method)
c1 c2)))

(defun colir-color-parse (color)
"Convert string COLOR to triple of floats in [0.0 1.0]."
(if (string-match "#\\([[:xdigit:]]\\{2\\}\\)\\([[:xdigit:]]\\{2\\}\\)\\([[:xdigit:]]\\{2\\}\\)" color)
(mapcar (lambda (v) (/ (string-to-number v 16) 255.0))
(list (match-string 1 color) (match-string 2 color) (match-string 3 color)))
;; does not work properly in terminal (maps color to nearest color
;; from available color palette).
(color-name-to-rgb color)))

(defun colir--blend-background (start next prevn face object)
(let ((background-prev (face-background prevn)))
(progn
(put-text-property
start next 'face
(if background-prev
(cons `(background-color
. ,(colir-blend
(colir-color-parse background-prev)
(colir-color-parse (face-background face nil t))))
prevn)
(list face prevn))
object))))

(defun colir-blend-face-background (start end face &optional object)
"Append to the face property of the text from START to END the face FACE.
When the text already has a face with a non-plain background,
blend it with the background of FACE.
Optional argument OBJECT is the string or buffer containing the text.
See also `font-lock-append-text-property'."
(let (next prev)
(let (next prev prevn)
(while (/= start end)
(setq next (next-single-property-change start 'face object end))
(setq prev (get-text-property start 'face object))
(when (listp prev)
(setq prev (cl-find-if #'atom prev)))
(if (facep prev)
(let ((background-prev (face-background prev)))
(progn
(put-text-property
start next 'face
(if background-prev
(cons `(background-color
. ,(colir-blend
(color-name-to-rgb background-prev)
(color-name-to-rgb (face-background face nil t))))
prev)
(list face prev))
object)))
(put-text-property start next 'face face object))
(setq prevn (if (listp prev)
(cl-find-if #'atom prev)
prev))
(cond
((or (keywordp (car-safe prev)) (consp (car-safe prev)))
(put-text-property start next 'face (cons face prev) object))
((facep prevn)
(colir--blend-background start next prevn face object))
(t
(put-text-property start next 'face face object)))
(setq start next))))

(provide 'colir)
Expand Down
Loading