├── elnode-0.9.9.6.9.tar ├── demo-multifile ├── demo-multifile-package-template.el ├── Makefile └── demo-multifile.el ├── static ├── bootstrap │ └── img │ │ ├── glyphicons-halflings.png │ │ └── glyphicons-halflings-white.png └── style.css ├── marmalade-repo-test ├── packages │ ├── less-css-mode │ │ ├── 0.11 │ │ │ └── less-css-mode-0.11.el │ │ ├── 0.12 │ │ │ └── less-css-mode-0.12.el │ │ ├── 0.13 │ │ │ └── less-css-mode-0.13.el │ │ ├── 0.14 │ │ │ └── less-css-mode-0.14.el │ │ ├── 0.15 │ │ │ └── less-css-mode-0.15.el │ │ ├── 0.1 │ │ │ └── less-css-mode-0.1.el │ │ ├── 0.2 │ │ │ └── less-css-mode-0.2.el │ │ ├── 0.3 │ │ │ └── less-css-mode-0.3.el │ │ ├── 0.4 │ │ │ └── less-css-mode-0.4.el │ │ ├── 0.5 │ │ │ └── less-css-mode-0.5.el │ │ ├── 0.6 │ │ │ └── less-css-mode-0.6.el │ │ ├── 0.7 │ │ │ └── less-css-mode-0.7.el │ │ ├── 0.8 │ │ │ └── less-css-mode-0.8.el │ │ ├── 0.9 │ │ │ └── less-css-mode-0.9.el │ │ └── 0.10 │ │ │ └── less-css-mode-0.10.el │ ├── flymake-easy │ │ ├── 0.1 │ │ │ └── flymake-easy-0.1.el │ │ ├── 0.2 │ │ │ └── flymake-easy-0.2.el │ │ ├── 0.3 │ │ │ └── flymake-easy-0.3.el │ │ ├── 0.4 │ │ │ └── flymake-easy-0.4.el │ │ ├── 0.5 │ │ │ └── flymake-easy-0.5.el │ │ ├── 0.7 │ │ │ └── flymake-easy-0.7.el │ │ ├── 0.6 │ │ │ └── flymake-easy-0.6.el │ │ ├── 0.8 │ │ │ └── flymake-easy-0.8.el │ │ └── 0.9 │ │ │ └── flymake-easy-0.9.el │ └── elixir-mix │ │ ├── 0.0.1 │ │ └── elixir-mix-0.0.1.el │ │ └── 0.0.2 │ │ └── elixir-mix-0.0.2.el └── possible-packages │ └── bad-commentary-package.el ├── nginx-cache-report ├── .gitignore ├── nginx-cache-kill ├── crontab-db-backup ├── Makefile ├── boot.el ├── mongo-convert ├── deploy ├── Dockerfile ├── profile-page.html ├── todo.org ├── Dockerfile-marmalade-deploy.el ├── dummy-package.el ├── marmalade-customs.el ├── package-page.html ├── specialpages ├── register-comingsoon.html ├── terms.html └── docs.html ├── marmalade-demo.el ├── marmalade-vars.el ├── nginx.conf ├── login-page.html ├── register-comingsoon.html ├── README.creole ├── verify.html ├── news.html ├── mongo-convert.creole ├── upload-page.html ├── recipes └── marmalade-service ├── admin-tasks.creole ├── marmalade-mongo.el └── marmalade-users.el /elnode-0.9.9.6.9.tar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicferrier/elmarmalade/HEAD/elnode-0.9.9.6.9.tar -------------------------------------------------------------------------------- /demo-multifile/demo-multifile-package-template.el: -------------------------------------------------------------------------------- 1 | (define-package 2 | "demo-multifile" 3 | "VERSION" 4 | "a demo multifile package.") 5 | -------------------------------------------------------------------------------- /static/bootstrap/img/glyphicons-halflings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicferrier/elmarmalade/HEAD/static/bootstrap/img/glyphicons-halflings.png -------------------------------------------------------------------------------- /static/bootstrap/img/glyphicons-halflings-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicferrier/elmarmalade/HEAD/static/bootstrap/img/glyphicons-halflings-white.png -------------------------------------------------------------------------------- /marmalade-repo-test/packages/less-css-mode/0.11/less-css-mode-0.11.el: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicferrier/elmarmalade/HEAD/marmalade-repo-test/packages/less-css-mode/0.11/less-css-mode-0.11.el -------------------------------------------------------------------------------- /marmalade-repo-test/packages/less-css-mode/0.12/less-css-mode-0.12.el: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicferrier/elmarmalade/HEAD/marmalade-repo-test/packages/less-css-mode/0.12/less-css-mode-0.12.el -------------------------------------------------------------------------------- /marmalade-repo-test/packages/less-css-mode/0.13/less-css-mode-0.13.el: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicferrier/elmarmalade/HEAD/marmalade-repo-test/packages/less-css-mode/0.13/less-css-mode-0.13.el -------------------------------------------------------------------------------- /marmalade-repo-test/packages/less-css-mode/0.14/less-css-mode-0.14.el: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicferrier/elmarmalade/HEAD/marmalade-repo-test/packages/less-css-mode/0.14/less-css-mode-0.14.el -------------------------------------------------------------------------------- /marmalade-repo-test/packages/less-css-mode/0.15/less-css-mode-0.15.el: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nicferrier/elmarmalade/HEAD/marmalade-repo-test/packages/less-css-mode/0.15/less-css-mode-0.15.el -------------------------------------------------------------------------------- /nginx-cache-report: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Report the keys from the marmalade cache 4 | 5 | find /var/cache/nginx-marmaladerepo/ -type f \ 6 | | while read filename ; do grep -aE "^KEY" $filename ; done 7 | 8 | # End 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /marmalade-repo-test/.emacs.d 2 | /marmalade-repo-test/logs 3 | /marmalade-repo-test/packages/archive-contents.el 4 | /marmalade-repo-test/archives/ 5 | /marmalade-service-*.tar 6 | /.deploy 7 | /builds 8 | /demo-multifile-*.tar 9 | -------------------------------------------------------------------------------- /nginx-cache-kill: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Remove $1 from the nginx cache 4 | # $1 has to be a pattern 5 | # MUST be run under sudo 6 | 7 | grep -lr -E "$1" /var/cache/nginx-marmaladerepo/ | xargs -L1 sudo rm -f 8 | 9 | # End 10 | 11 | -------------------------------------------------------------------------------- /crontab-db-backup: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Backup the user database and then trim the backups 4 | # ... so we don't have too many 5 | 6 | BACKUPDIR=/home/nferrier/marmalade-backups 7 | DATE=$(date '+%Y%m%d%H%M') 8 | cp /home/nferrier/marmalade/db/marmalade-user-db.elc \ 9 | ${BACKUPDIR}/user-db-${DATE} 10 | 11 | find ${BACKUPDIR} -ctime +100 -exec rm \{} \; 12 | 13 | # End 14 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Build the docker 2 | docker:=sudo docker 3 | emacs:=~/emacs/bin/emacs 4 | 5 | 6 | marmalade: build 7 | $(docker) push nicferrier/elmarmalade 8 | 9 | build: test 10 | $(emacs) -batch --eval '(progn(package-initialize)(elpakit-make-multi "." "builds"))' 11 | $(docker) build --no-cache -t nicferrier/elmarmalade . 12 | 13 | test: 14 | [ -x $(emacs) ] # missing emacs? 15 | $(docker) help 2> /dev/null # missing docker? 16 | 17 | # End 18 | -------------------------------------------------------------------------------- /demo-multifile/Makefile: -------------------------------------------------------------------------------- 1 | VERSION:=0.0.2 2 | PACKAGE_NAME:=demo-multifile-$(VERSION) 3 | PACKAGE_DIR:=/tmp/$(PACKAGE_NAME) 4 | 5 | package: $(PACKAGE_DIR) 6 | tar cvf ../$(PACKAGE_NAME).tar --exclude="*#" --exclude="*~" -C $(PACKAGE_DIR)/.. $(PACKAGE_NAME) 7 | 8 | $(PACKAGE_DIR): 9 | mkdir $@ 10 | cp -r ../demo-multifile/* $@ 11 | sed -re "s/VERSION/$(VERSION)/" $@/demo-multifile-package-template.el > $@/demo-multifile-pkg.el 12 | 13 | clean: 14 | rm -f ../$(PACKAGE_NAME).tar 15 | rm -rf $(PACKAGE_DIR) 16 | 17 | # end 18 | -------------------------------------------------------------------------------- /boot.el: -------------------------------------------------------------------------------- 1 | ;;; boot.el --- boot up marmalade 2 | 3 | (defvar marmalade/inited nil 4 | "Autoload mechanics, when it's `t' we are started.") 5 | 6 | (defun marmalade-init () 7 | "Start the marmalade service." 8 | ;; this starts one... what about the archive service? 9 | (require 'marmalade-service) 10 | (elnode-start 11 | 'marmalade-router 12 | :port (or 13 | (and (boundp 'marmalade-server-port) 14 | (symbol-value 'marmalade-server-port)) 15 | 8010) 16 | :host "0.0.0.0") 17 | (marmalade-archive-make-cache) 18 | (setq marmalade/inited t)) 19 | 20 | (marmalade-init) 21 | 22 | ;;; boot.el ends here 23 | -------------------------------------------------------------------------------- /mongo-convert: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Convert the MongoDb to a flat file system with some shell script 4 | 5 | ERROR='/dev/null' 6 | marmalade_root=~/marmalade/packages 7 | mongofiles -d marmalade list 2> $ERROR \ 8 | | sed -rne 's#([0-9a-zA-Z-]+)\.(tar|el)/([0-9.]+)[ \t].*#\1 \2 \3#p' \ 9 | | while read name type version 10 | do 11 | package_file_name=$name.$type/$version 12 | target_file_name=$marmalade_root/$name/$version/$name-$version.$type 13 | mkdir -p $(dirname $target_file_name) 14 | mongofiles -d marmalade \ 15 | -l $target_file_name \ 16 | get $package_file_name > $ERROR 2> $ERROR 17 | done 18 | 19 | # mongo-covert ends here 20 | -------------------------------------------------------------------------------- /deploy: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Docker deploy script generated by deploy-make 3 | 4 | [ -f ./.deploy-test ] && source ./.deploy-test 5 | [ -f ./.deploy ] || curl https://raw.githubusercontent.com/nicferrier/docker-shell-deploy/master/deploy-helpers -o ./.deploy || { echo "can't http the deployscript" ; exit 1; } 6 | . ./.deploy 7 | dockerImage=nicferrier/marmalade 8 | dockerExPort=8005 9 | nginxConfig=/etc/nginx/sites-enabled/marmalade.conf 10 | hostName=po3.ferrier.me.uk 11 | dockerVolumes=+/home/nferrier/marmalade:/home/emacs/marmalade/ 12 | deploy ${1:-"deploy"} nicferrier/elmarmalade 8005 /etc/nginx/sites-enabled/marmalade.conf po3.ferrier.me.uk +/home/nferrier/marmalade:/home/emacs/marmalade/ 13 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # A Docker file to marmalade in a docker 2 | FROM nicferrier/elnode 3 | MAINTAINER nic@ferrier.me.uk 4 | USER root 5 | ADD Dockerfile-marmalade-deploy.el /tmp/Dockerfile-marmalade-deploy.el 6 | ADD builds/ /home/emacs/builds 7 | ADD boot.el /home/emacs/boot.el 8 | RUN chown -R emacs /home/emacs/builds 9 | RUN chown emacs /tmp/Dockerfile-marmalade-deploy.el 10 | RUN chown emacs /home/emacs/boot.el 11 | USER emacs 12 | WORKDIR /home/emacs 13 | ENV HOME /home/emacs 14 | RUN mkdir /home/emacs/marmalade 15 | VOLUME /home/emacs/marmalade/ 16 | RUN /usr/local/emacs/bin/emacs -daemon -l /tmp/Dockerfile-marmalade-deploy.el 17 | EXPOSE 8005 18 | CMD /usr/local/emacs/bin/emacs -daemon -l /home/emacs/boot.el ; tail -f /dev/null 19 | -------------------------------------------------------------------------------- /profile-page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | marmalade-repo - for all your EmacsLisp needs 7 | 8 | 9 | ${header} 10 |
11 |
12 |
13 |

${username} @ marmalade-repo

14 |

${username} has provided the following packages to Emacs on marmalade:

15 | 16 |
    17 | ${package-list} 18 |
19 |
20 |
21 |
22 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /demo-multifile/demo-multifile.el: -------------------------------------------------------------------------------- 1 | ;;; demo-multifile.el --- a demonstration multifile package -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2014 Nic Ferrier 4 | 5 | ;; Author: Nic Ferrier 6 | ;; Keywords: lisp 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Commentary: 22 | 23 | ;; This doesn't do anything. It's just a demo of how to build a 24 | ;; multi-file package. 25 | 26 | ;;; Code: 27 | 28 | (require 'thingatpt) 29 | 30 | 31 | (provide 'demo-multifile) 32 | 33 | ;;; demo-multifile.el ends here 34 | -------------------------------------------------------------------------------- /todo.org: -------------------------------------------------------------------------------- 1 | 2 | 3 | * elmarmalade-package-archives 4 | ** needs an ALL query 5 | *** needs to be everything 6 | ** needs rendering to what archive-contents looks like 7 | ** what's the correct mime type to send 8 | *** ngrep a transaction 9 | 10 | * elmarmalade--package-list 11 | ** could write a test to construct the list and start a real emacs using it 12 | *** emacs can have a package-archive which is local 13 | *** it needs the archive file still 14 | *** so 15 | **** make the archive content 16 | **** save it to a file 17 | **** start an emacs with the package-archives pointing at it 18 | **** do something to assert it's correct 19 | 20 | * elmarmalade-package 21 | ** abstract elnode-docroot-for over elnode db? 22 | ** what does the package download look like? 23 | 24 | * elmarmalade-handler 25 | ** add the user facing front end stuff 26 | *** login 27 | *** register 28 | *** upload 29 | **** this should be particularly simple 30 | **** is there a standard for this in package-x or something? 31 | 32 | 33 | * authentication 34 | ** we have basic auth 35 | ** we need permission upload 36 | *** we need to know which packages have which owners 37 | *** package db needs to be updated 38 | *** this is what marmalade!authorize-check is 39 | -------------------------------------------------------------------------------- /Dockerfile-marmalade-deploy.el: -------------------------------------------------------------------------------- 1 | ;; Setup marmalade and install the package 2 | (customize-set-variable 'lisp-indent-function 'common-lisp-indent-function) 3 | (customize-set-variable 'revert-without-query '(".*")) 4 | (customize-set-variable 'elnode-log-files-directory (expand-file-name "~/marmalade/elnode-log-files")) 5 | (customize-set-variable 'elnode-error-log-to-messages nil) 6 | ;(customize-set-variable 'debug-on-error 'always) ; FIXME probably not? 7 | (customize-set-variable 'marmalade-server-port 8005) 8 | (customize-set-variable 'marmalade-db-dir (expand-file-name "~/marmalade/db")) 9 | (customize-set-variable 'marmalade-package-store-dir (expand-file-name "~/marmalade/packages")) 10 | (customize-set-variable 'marmalade-package-archive-dir (expand-file-name "~/marmalade/old-packages")) 11 | (customize-set-variable 'marmalade-archive-dir (expand-file-name "~/marmalade/archives")) 12 | (customize-set-variable 'marmalade-archive-port 8006) 13 | (customize-set-variable 'marmalade-boot-onload t) 14 | (customize-save-customized) 15 | (toggle-debug-on-error) 16 | (package-initialize) 17 | (package-refresh-contents) 18 | (package-install-file 19 | (car 20 | (reverse 21 | (directory-files 22 | (expand-file-name "~/builds") 23 | t ".*\\.tar$")))) 24 | -------------------------------------------------------------------------------- /dummy-package.el: -------------------------------------------------------------------------------- 1 | ;;; dummy-package.el --- a fake package for the marmalade test suite 2 | 3 | ;; Copyright (C) 2013 Nic Ferrier 4 | 5 | ;; Author: Nic Ferrier 6 | ;; Keywords: lisp 7 | ;; Version: 0.0.23 8 | ;; Package-requires: ((timeclock "2.6.1")) 9 | 10 | ;; This program is free software; you can redistribute it and/or modify 11 | ;; it under the terms of the GNU General Public License as published by 12 | ;; the Free Software Foundation, either version 3 of the License, or 13 | ;; (at your option) any later version. 14 | 15 | ;; This program is distributed in the hope that it will be useful, 16 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | ;; GNU General Public License for more details. 19 | 20 | ;; You should have received a copy of the GNU General Public License 21 | ;; along with this program. If not, see . 22 | 23 | ;;; Commentary: 24 | 25 | ;; This doesn't do anything, it's just a fake package for Marmalade. 26 | 27 | ;;; Code: 28 | 29 | ;;;###autoload 30 | (defun dummy-package () 31 | (interactive) 32 | (message "dummy-package: hello!")) 33 | 34 | (provide 'dummy-package) 35 | ;;; dummy-package.el ends here 36 | -------------------------------------------------------------------------------- /marmalade-customs.el: -------------------------------------------------------------------------------- 1 | ;;; marmalade-customs.el -- defining the config vars 2 | 3 | (defgroup marmalade-archive nil 4 | "The marmalade package store. Elisp version." 5 | :group 'applications) 6 | 7 | (defcustom marmalade-package-store-dir nil 8 | "The location of the package files." 9 | :group 'marmalade-archive 10 | :type '(choice 11 | (const :tag "Default" nil) 12 | (directory "~/marmalade/packages"))) 13 | 14 | (defcustom marmalade-package-archive-dir nil 15 | "The location of old (removed) package files." 16 | :group 'marmalade-archive 17 | :type '(choice 18 | (const :tag "Default" nil) 19 | (directory "~/marmalade/old-packages"))) 20 | 21 | (defcustom marmalade-archive-dir nil 22 | "The location of the archive-contents files. 23 | 24 | Each file is a version of the archive-contents." 25 | :group 'marmalade-archive 26 | :type '(choice 27 | (const :tag "Default" nil) 28 | (directory "~/marmalade/archive-contents"))) 29 | 30 | (defcustom marmalade-db-dir nil 31 | "The location of the databases." 32 | :group 'marmalade-archive 33 | :type '(choice 34 | (const :tag "Default" nil) 35 | (directory "~/marmalade/databases"))) 36 | 37 | (provide 'marmalade-customs) 38 | 39 | ;;; marmalade-customs.el ends here 40 | -------------------------------------------------------------------------------- /package-page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ${package-name} @ Marmalade 7 | 8 | 9 | ${header} 10 |
11 |
12 |
13 |

${package-name} - ${version}

14 |

what is it? download ${package-name}

15 |

${description}

16 |

by ${author}

17 | ${url-text} 18 | 19 |

how to install

20 |
21 | M-x package-install [RET] ${package-name} [RET]
22 | 
23 | 24 |

about

25 |
${about}
26 |
27 |
28 |
29 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /specialpages/register-comingsoon.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | marmalade-repo - for all your EmacsLisp needs 7 | 8 | 9 | 18 |
19 |
20 |
21 |

sorry... you can't register for marmalade-repo ...

22 |

We just haven't got a working registration yet. But it's coming very soon.

23 |

In the mean time, if you need an account, please add an issue on the 24 | github.

25 |
26 |
27 |
28 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /specialpages/terms.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Marmalade - terms 7 | 8 | 9 | ${header} 10 |
11 |
12 |
13 |

terms

14 |

15 | marmalade-repo will host your Emacs package and provide an Emacs 16 | ELPA archive compatible index of it so long as: 17 |

18 | 19 |
    20 |
  • your package is licenced under the GPL or a GPL compatible licence
  • 21 |
  • your package is free from malicious effects
  • 22 |
  • your package conforms to the ELPA standards for defining packages
  • 23 |
24 | 25 |

26 | No warranty is offered for marmalade-repo. It may be up or 27 | down. It may be broken or working. 28 |

29 |

30 | I endeavour to keep it working. But it's not always 31 | possible. Thanks! 32 |

33 |
34 |
35 |
36 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /marmalade-demo.el: -------------------------------------------------------------------------------- 1 | ;;; marmalade-demo.el --- a demonstration elpa package 2 | 3 | ;; Copyright (C) 2014 Nic Ferrier 4 | 5 | ;; Author: Nic Ferrier 6 | ;; Keywords: lisp 7 | ;; Version: 0.0.5 8 | 9 | ;; This program is free software; you can redistribute it and/or modify 10 | ;; it under the terms of the GNU General Public License as published by 11 | ;; the Free Software Foundation, either version 3 of the License, or 12 | ;; (at your option) any later version. 13 | 14 | ;; This program is distributed in the hope that it will be useful, 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ;; GNU General Public License for more details. 18 | 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with this program. If not, see . 21 | 22 | ;;; Commentary: 23 | 24 | ;; This is just a demonstration package, it doesn't do anything. 25 | 26 | ;;; Code: 27 | 28 | (defun marmalade-demo/private-function () 29 | (with-current-buffer (get-buffer-create "*marmalade-demo*") 30 | (insert "Welcome to the marmalade demo\n") 31 | (insert "\nThis is just a silly demo. Nothing will come of it.") 32 | (switch-to-buffer (current-buffer)))) 33 | 34 | ;;;###autoload 35 | (defun marmalade-demo () 36 | (interactive) 37 | (marmalade-demo/private-function)) 38 | 39 | (provide 'marmalade-demo) 40 | 41 | ;;; marmalade-demo.el ends here 42 | -------------------------------------------------------------------------------- /marmalade-vars.el: -------------------------------------------------------------------------------- 1 | ;;; marmalade-vars.el --- some constants for marmalade 2 | 3 | ;;; Code: 4 | 5 | (defconst marmalade/page-header "
6 |
7 | 12 |
13 |
14 |
15 | 16 | \"Fork 19 | 20 |
" 21 | "The page header for logged out users.") 22 | 23 | (defconst marmalade/page-header-loggedin "
24 |
25 | 29 |
30 |
31 |
32 | 33 | \"Fork 36 | 37 |
" 38 | "The page header for logged-in users.") 39 | 40 | 41 | (provide 'marmalade-vars) 42 | 43 | ;;; marmalade-vars.el ends here 44 | -------------------------------------------------------------------------------- /nginx.conf: -------------------------------------------------------------------------------- 1 | include nginx-proxy-port-map.conf; 2 | proxy_cache_path /var/cache/nginx-marmaladerepo levels=1:2 keys_zone=marmaladerepo-cache:8m max_size=1000m inactive=600m; 3 | 4 | upstream backend_main { 5 | server localhost:8005; 6 | } 7 | 8 | upstream backend_archive { 9 | server localhost:8006; 10 | } 11 | 12 | server { 13 | listen 80; 14 | server_name marmalade-repo.org marmalade-repo.ferrier.me.uk marmaladerepo.ferrier.me.uk marmalade.ferrier.me.uk; 15 | access_log /var/log/nginx/marmalade-access-log; 16 | client_max_body_size 20m; 17 | 18 | location /favicon.ico { 19 | proxy_pass http://backend_main/stuff/ico/favicon.ico; 20 | proxy_http_version 1.1; 21 | proxy_set_header Host $host; 22 | proxy_cache marmaladerepo-cache; 23 | proxy_cache_valid 200 302 1d; 24 | proxy_cache_valid 404 60m; 25 | } 26 | 27 | location /packages/archive-contents { 28 | proxy_pass http://backend_archive; 29 | proxy_http_version 1.1; 30 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 31 | } 32 | 33 | location /packages/archive-contents/ { 34 | internal; 35 | proxy_pass http://backend_archive; 36 | proxy_http_version 1.1; 37 | proxy_cache marmaladerepo-cache; 38 | proxy_cache_revalidate on; 39 | proxy_cache_valid 200 302 404 1d; 40 | } 41 | 42 | location /-/ { 43 | proxy_pass http://backend_main; 44 | proxy_http_version 1.1; 45 | proxy_set_header Host $host; 46 | proxy_cache marmaladerepo-cache; 47 | proxy_cache_revalidate on; 48 | proxy_cache_valid 200 302 404 1d; 49 | } 50 | 51 | location / { 52 | proxy_pass http://backend_main; 53 | proxy_http_version 1.1; 54 | proxy_set_header Host $host; 55 | proxy_cache marmaladerepo-cache; 56 | proxy_cache_revalidate on; 57 | proxy_cache_valid 200 302 404 30m; 58 | proxy_cache_bypass $cookie_marmalade-user; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /login-page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | marmalade-repo - for all your EmacsLisp needs 7 | 8 | 9 | 17 |
18 |
19 |
20 |

marmalade-repo

21 |
22 |
23 | login 24 |
25 |
26 | 27 | 28 |
29 |
30 | 31 |

32 |
33 |
34 |
35 | 37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /marmalade-repo-test/possible-packages/bad-commentary-package.el: -------------------------------------------------------------------------------- 1 | ;;; bad-commentary-package.el --- A DSL for generating XML with a bad package header 2 | 3 | ;; Copyright (C) 2008 Philip Jackson 4 | 5 | ;; Author: Philip Jackson 6 | ;; Version: 0.4 7 | 8 | ;; This file is not currently part of GNU Emacs. 9 | 10 | ;; This program is free software; you can redistribute it and/or 11 | ;; modify it under the terms of the GNU General Public License as 12 | ;; published by the Free Software Foundation; either version 2, or (at 13 | ;; your option) any later version. 14 | 15 | ;; This program is distributed in the hope that it will be useful, but 16 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 17 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | ;; General Public License for more details. 19 | 20 | ;; You should have received a copy of the GNU General Public License 21 | ;; along with this program ; see the file COPYING. If not, write to 22 | ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 23 | ;; Boston, MA 02111-1307, USA. 24 | 25 | ;;; Commentary: 26 | 27 | ;; Note this is intentionally the same as the `xmlgen' package, which 28 | ;; has bad commentary. 29 | 30 | ;; Generate xml using sexps with the function `xmlgen': 31 | 32 | ;; (xmlgen '(p :class "big")) => "

") 33 | ;; (xmlgen '(p :class "big" "hi")) => "

hi

") 34 | 35 | ;; (xmlgen '(html 36 | ;; (head 37 | ;; (title "hello") 38 | ;; (meta :something "hi")) 39 | ;; (body 40 | ;; (h1 "woohhooo") 41 | ;; (p "text") 42 | ;; (p "more text")))) 43 | 44 | ;; produces this (though wrapped): 45 | 46 | ;; 47 | ;; 48 | ;; hello 49 | ;; 50 | ;; 51 | ;; 52 | ;;

woohhooo

53 | ;;

text

54 | ;;

more text

55 | ;; 56 | ;; 57 | 58 | (eval-when-compile (require 'cl)) 59 | 60 | (defvar xmlgen-escape-attribute-vals t 61 | "When non-nil xmlgen will escape the characters <>'\"&' in an 62 | attribute value.") 63 | 64 | 65 | ;;; bad-commentary-package.el ends here 66 | -------------------------------------------------------------------------------- /register-comingsoon.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | marmalade-repo - for all your EmacsLisp needs 7 | 8 | 9 | 18 |
19 | 20 | Fork me on GitHub 23 | 24 |
25 |
26 |
27 |
28 |

new packages

29 |
    ${latest-html}
30 | add a new package 31 |
32 |

marmalade repo

33 |

We're sorry, we're not accepting registrations yet.

34 | Registration is coming soon. Within a few weeks.

35 | Monday, June 2 2014 36 |
37 |
38 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /README.creole: -------------------------------------------------------------------------------- 1 | = The Marmalade Service - A package repository in EmacsLisp = 2 | 3 | This is an EmacsLisp package to reimplement 4 | the [[http://marmalade-repo.org|marmalade-repo]] with Elnode. Natalie 5 | Weizenbaum wrote the 6 | original [[http://marmalade-repo.org|marmalade-repo]] with node.js and 7 | mongodb. 8 | 9 | === How to === 10 | 11 | * Need an account? - make an issue on the [[http://github.com/nicferrier/elmarmalade|Github]] and Nic will send you a mail with a confirmation link 12 | * Need to delete a package? - it's possible through the API with the marmalade-client package 13 | * Need to upload a package? - use the API throught the marmalade-client package 14 | 15 | 16 | === About === 17 | 18 | This reimplementation uses an [[http://elnode.org|Elnode]] application 19 | dealing with a filesystem of all packages. It's basically a file 20 | server app. It also follows the microservice model. 21 | 22 | This packages includes conversion tools from the mongodb to the 23 | filesystem. 24 | 25 | These are the things marmalade should do: 26 | 27 | * construct the package archive file from the package directory structure 28 | ** the package archive is an index of all the packages in the repository. 29 | * allow the archive to be updated with uploads 30 | * provide the ELPA {{{/package/}}} HTTP API for downloading packages 31 | * provide HTML front end to the {{{/package/}}} HTTP API 32 | * provide EmacsLisp front end to the {{{/package/}}} HTTP API 33 | ** this will likely be a separate project 34 | * allow users to {{{/register/}}} in order to upload packages 35 | * provide {{{/profile/}}}s for people who have registered 36 | * allow registered users to upload and upgrade packages 37 | ** preferably from inside their emacs 38 | ** and securely 39 | * allow registered users to be added as owners 40 | 41 | 42 | ==== Other marmalade things ==== 43 | 44 | It would be nice if marmalade provided better package discovery. 45 | 46 | It would be nice if marmalade stored licences in a clear way and 47 | allowed you to use only safe licences if you wish. 48 | 49 | 50 | ==== How it works ==== 51 | 52 | The package is contained in the top level. Elpakit is used to build 53 | it. 54 | 55 | {{{marmalade-repo-test}}} is a test directory containing packages used 56 | by the test scripts. 57 | 58 | {{{marmalade-repo-test/possible-packages}}} contains stuff we don't 59 | have tests for but probably should have. 60 | 61 | -------------------------------------------------------------------------------- /verify.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | marmalade-repo - for all your EmacsLisp needs 7 | 8 | 9 | 16 |
17 |
18 |
19 |

marmalade-repo

20 |
21 |
23 | please verify your user ${username} 24 |
25 |
26 | 27 | 30 |

31 |
32 |
33 | 34 |

37 |
38 |
39 |
40 | 42 |
43 |
44 |
45 |

46 | when marmalade has confirmed your password change you'll 47 | be redirected to login, so please try and remember it for at 48 | least 5 seconds. 49 |

50 |
51 |
52 |
53 |
54 |
55 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /news.html: -------------------------------------------------------------------------------- 1 |
    2 |
  • 3 | 2014-10-23 - marmalade-repo is now on HTTPS. 4 |
    5 | The marmalade-client has been updated too and we're 6 | redirecting all HTTP to HTTPS. So if you have a client 7 | problem it's probably that. Please just upgrade the 8 | marmalade client. 9 |
    10 |
  • 11 |
  • 12 | 2014-10-17 - user creation and package removal features are added; 13 |
    14 | We're nearing having a usable service now. To create an 15 | account you still need to make a ticket and for Nic to 16 | send you an email... but at least all that is automated 17 | now. It's only a relatively small step to add a 18 | registration front end to the existing API calls. 19 |
    20 |
  • 21 |
  • 22 | 2014-09-27 - docker deployment is now watching marmalade for failures and auto restarting. 23 |
    24 | Marmalade has been down a lot, clearly there is an elnode 25 | problem somewhere. Restarting is a great way to deal with the 26 | problem though. I may even more aggressively restart it and 27 | call it a chaos strategy. 28 |
    29 |
  • 30 |
  • 31 | 2014-08-26 - lots of marmalade updates including new terms and docs pages 32 |
    33 | A couple of bug fixes too. 34 |
    35 |
  • 36 |
  • 37 | 2014-08-24 - marmalade-repo is now hosted on docker 38 |
    39 | Docker makes the whole thing easier to deploy. So it 40 | should be easier to keep up to date. 41 |
    42 |
  • 43 |
  • 44 | 2014 06 15 - Marmalade uploads are live 45 |
    46 | You can now upload more safely. The API is somewhat fixed though we 47 | still seem to have some bugs. I've been working hard on the blue-green 48 | aspect of marmalade configuration which will allow me to roll releases 49 | with no downtime. I'm going to have to docker-ize Emacs to do that I 50 | think. 51 |
    52 |
  • 53 | 54 |
  • 55 | 2014 06 08 - marmalade is missing some packages 56 |
    57 | Reference this 59 | it seems that the mongo conversion missed some stuff. So I'll 60 | have to go and work on that to see if I can dredge it up. 61 |
    62 |
  • 63 |
64 | -------------------------------------------------------------------------------- /mongo-convert.creole: -------------------------------------------------------------------------------- 1 | = How I converted the mongodb = 2 | 3 | === Packages === 4 | 5 | 6 | 7 | === Users === 8 | 9 | The users in the mongo db were a separate collection. The record 10 | included a packages array but it seemed unreliable. More reliable was 11 | the owners details attached to each of the packages. 12 | 13 | This is how to dump the users: 14 | 15 | {{{ 16 | cat > users-mongo.js <> (mapcar 'identity packages) 71 | (--keep (car it)) 72 | (--keep (-map (lambda (p) (cons p (car it))) (cdr it))) 73 | (-flatten)) 74 | (let ((username (car it)) 75 | (package (cdr it))) 76 | ;; update add-packages to handle a blank packages entry 77 | (condition-case err 78 | (apply 'marmalade-add-packages (list username package)) 79 | (error 80 | (message "something bad happened for %s with %s" username package)))))) 81 | }}} 82 | 83 | So we're moving to an Emacs db where the user record stores 84 | everything. There is no package record, the package is just the files 85 | on the disc and a name which is recorded in the user db. 86 | -------------------------------------------------------------------------------- /upload-page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Marmalade - new package 7 | 8 | 9 | 20 |
21 |
22 |
23 |

marmalade-repo

24 | 25 |

marmalade-repo accepts submissions of FREE software packages 26 | for the Emacs environment.

27 | 28 |
29 | upload a new package 30 |

please ensure your package is GPLed or GPL compatible before uploading to marmalade.

31 |
32 |
33 | 34 | 36 |
37 |
38 | 39 |
what is a package
40 |

41 | The ELPA packages which marmalade accepts come in 2 forms, either: 42 |

43 | 44 |
    45 |
  • a single .el file with a package header
  • 46 |
  • or a .tar file with a pkg.el file
  • 47 |
48 | 49 |

Your uploaded file must conform to one of these 2 types.

50 | 51 |
licences
52 |

Your uploaded file should also carry a licence file for a free software licence (for example, the GPL) or a reference to a licence. 53 | marmalade-repo does not try to check licences yet but it will in the future.

54 | 55 |
other ways to upload
56 |

You can also upload a package to marmalade directly from Emacs.

57 |

To do this you must install our marmalade-upload package.

58 |
59 |
60 |
61 |
62 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /recipes/marmalade-service: -------------------------------------------------------------------------------- 1 | (marmalade-service 2 | :version "2.0.20" 3 | :doc "The Marmalade package store service." 4 | :requires 5 | ((dash "2.9.0") 6 | (s "1.6.0") 7 | (kv "0.0.16") 8 | (noflet "0.0.7") 9 | (elnode "0.9.9.8.6") 10 | (file-format "0.0.2") 11 | (htmlize "1.3.9")) 12 | :files 13 | ("marmalade-vars.el" 14 | "marmalade-customs.el" 15 | "marmalade-service.el" 16 | "marmalade-archive.el" 17 | "marmalade-api.el" 18 | "marmalade-users.el" 19 | "crontab-db-backup" 20 | "front-page.html" 21 | "news.html" 22 | "login-page.html" 23 | "package-page.html" 24 | "profile-page.html" 25 | "verify.html" 26 | "upload-page.html" 27 | "specialpages/terms.html" 28 | "specialpages/docs.html" 29 | "specialpages/register-comingsoon.html" 30 | "static/style.css" 31 | "static/bootstrap/css/bootstrap.min.css" 32 | "static/bootstrap/css/bootstrap-responsive.css" 33 | "static/bootstrap/css/bootstrap.css" 34 | "static/bootstrap/css/bootstrap-responsive.min.css" 35 | "static/bootstrap/js/bootstrap.min.js" 36 | "static/bootstrap/js/bootstrap.js" 37 | "static/bootstrap/img/glyphicons-halflings-white.png" 38 | "static/bootstrap/img/glyphicons-halflings.png" 39 | "marmalade-repo-test/packages/elixir-mix/0.0.1/elixir-mix-0.0.1.el" 40 | "marmalade-repo-test/packages/elixir-mix/0.0.2/elixir-mix-0.0.2.el" 41 | "marmalade-repo-test/packages/sawfish/1.32/sawfish-1.32.el" 42 | "marmalade-repo-test/packages/less-css-mode/0.9/less-css-mode-0.9.el" 43 | "marmalade-repo-test/packages/less-css-mode/0.8/less-css-mode-0.8.el" 44 | "marmalade-repo-test/packages/less-css-mode/0.7/less-css-mode-0.7.el" 45 | "marmalade-repo-test/packages/less-css-mode/0.10/less-css-mode-0.10.el" 46 | "marmalade-repo-test/packages/less-css-mode/0.6/less-css-mode-0.6.el" 47 | "marmalade-repo-test/packages/less-css-mode/0.4/less-css-mode-0.4.el" 48 | "marmalade-repo-test/packages/less-css-mode/0.11/less-css-mode-0.11.el" 49 | "marmalade-repo-test/packages/less-css-mode/0.3/less-css-mode-0.3.el" 50 | "marmalade-repo-test/packages/less-css-mode/0.14/less-css-mode-0.14.el" 51 | "marmalade-repo-test/packages/less-css-mode/0.2/less-css-mode-0.2.el" 52 | "marmalade-repo-test/packages/less-css-mode/0.1/less-css-mode-0.1.el" 53 | "marmalade-repo-test/packages/less-css-mode/0.12/less-css-mode-0.12.el" 54 | "marmalade-repo-test/packages/less-css-mode/0.15/less-css-mode-0.15.el" 55 | "marmalade-repo-test/packages/less-css-mode/0.5/less-css-mode-0.5.el" 56 | "marmalade-repo-test/packages/less-css-mode/0.13/less-css-mode-0.13.el" 57 | "marmalade-repo-test/packages/flymake-easy/0.9/flymake-easy-0.9.el" 58 | "marmalade-repo-test/packages/flymake-easy/0.8/flymake-easy-0.8.el" 59 | "marmalade-repo-test/packages/flymake-easy/0.7/flymake-easy-0.7.el" 60 | "marmalade-repo-test/packages/flymake-easy/0.6/flymake-easy-0.6.el" 61 | "marmalade-repo-test/packages/flymake-easy/0.4/flymake-easy-0.4.el" 62 | "marmalade-repo-test/packages/flymake-easy/0.3/flymake-easy-0.3.el" 63 | "marmalade-repo-test/packages/flymake-easy/0.2/flymake-easy-0.2.el" 64 | "marmalade-repo-test/packages/flymake-easy/0.1/flymake-easy-0.1.el" 65 | "marmalade-repo-test/packages/flymake-easy/0.5/flymake-easy-0.5.el") 66 | :test 67 | (:requires 68 | ((fakir "0.1.1") 69 | (s "1.4.0")) 70 | :files 71 | ("marmalade-tests.el" ; really we need the marmalade-repo-test directory here 72 | "elnode-0.9.9.6.9.tar"))) 73 | -------------------------------------------------------------------------------- /static/style.css: -------------------------------------------------------------------------------- 1 | html,body { 2 | color: #895221; 3 | padding-bottom: 0 !important; 4 | height: 100%; 5 | min-height: 100%; 6 | margin: 0em 0em -40px 0em; 7 | font-family: sans-serif; 8 | font-size: 12pt; 9 | } 10 | 11 | .container:after { 12 | display: block; 13 | height: 100px; 14 | } 15 | 16 | footer { 17 | margin-top: 40px; 18 | height: 40px; 19 | background-color: Black; 20 | color: SandyBrown; 21 | padding-top: 10px; 22 | width: 100%; 23 | } 24 | 25 | footer div { 26 | text-align: center; 27 | } 28 | 29 | .container { 30 | margin-top: 40px; 31 | padding-bottom: 30px; 32 | } 33 | 34 | .section { 35 | border-top: thin solid #895221; 36 | padding-top: 20px; 37 | } 38 | 39 | #blurb { 40 | min-height: 100%; 41 | height: auto !important; 42 | margin: 0 auto -90px; 43 | } 44 | 45 | h1, h2, h3, h4, h5, h6 { 46 | line-height: 1.2em; 47 | } 48 | 49 | h1 { 50 | color: SandyBrown !important; 51 | text-shadow: -2px 0 #895221, 0 2px #895221,2px 0 #895221, 0 -2px #895221; 52 | } 53 | 54 | h2,h3 { 55 | color: Chocolate !important; 56 | text-shadow: -1px 0 Black, 0 1px Black,1px 0 Black, 0 -1px Black; 57 | } 58 | 59 | h1 { 60 | font-size: 48pt !important; 61 | padding-bottom: 20px; 62 | } 63 | 64 | h3 { 65 | font-size: 36pt !important; 66 | padding-bottom: 20px; 67 | } 68 | 69 | h4 { 70 | font-size: 22pt !important; 71 | padding-bottom: 20px; 72 | } 73 | 74 | h5 { 75 | font-size: 20pt !important; 76 | padding-bottom: 20px; 77 | } 78 | 79 | #donate { 80 | padding-top: 40px; 81 | } 82 | 83 | #donate-msg { 84 | margin-bottom: 1em; 85 | } 86 | 87 | #pp_donate { 88 | margin-top: 0.5em; 89 | } 90 | 91 | #gittip { 92 | float: right; 93 | width: 40%; 94 | } 95 | 96 | 97 | .packageoftheweek { 98 | margin-top: 1em; 99 | } 100 | 101 | #index-links { 102 | margin-top: 1em; 103 | } 104 | 105 | 106 | #news + ul li { 107 | margin-bottom: 20px; 108 | } 109 | 110 | .docheader { 111 | padding-top: 20px; 112 | } 113 | 114 | .what,.how,.about { 115 | color: #895221 !important; 116 | text-shadow: none; 117 | padding-top: 40px; 118 | } 119 | 120 | #package-demo { 121 | margin: 30px auto; 122 | } 123 | 124 | #package-demo div { 125 | width: 480px; 126 | margin: 0 auto; 127 | text-align: right; 128 | font-style: italic; 129 | } 130 | 131 | 132 | pre { 133 | background-color: Wheat; 134 | border: thin solid #895221; 135 | margin-top: 30px; 136 | } 137 | 138 | a:link { 139 | color: #895221; 140 | } 141 | 142 | a:visited { 143 | color: #893221; 144 | } 145 | 146 | p.description { 147 | font-style: italic; 148 | } 149 | 150 | #panel { 151 | float: right; 152 | width: 30%; 153 | } 154 | 155 | .download { 156 | margin-left: 40px ; 157 | } 158 | 159 | #loginform { 160 | width: 100%; 161 | margin: 50px auto; 162 | } 163 | 164 | form[name=upload] { 165 | margin-top: 3em; 166 | width: 80%; 167 | padding: 1em; 168 | } 169 | 170 | form[name=upload] legend { 171 | text-align: left; 172 | margin-bottom: 1em; 173 | font-weight: bold; 174 | } 175 | 176 | form input[type=file] { 177 | border: thin solid; 178 | } 179 | 180 | label { 181 | display: block; 182 | float: left; 183 | margin-right: 1em; 184 | } 185 | 186 | form[name=upload] input[type=submit] { 187 | } 188 | 189 | 190 | div.profile ul { 191 | -moz-column-count: 4; 192 | -webkit-column-count: 4; 193 | column-count: 4; 194 | } 195 | 196 | /* 197 | end of marmalade styles 198 | */ 199 | -------------------------------------------------------------------------------- /admin-tasks.creole: -------------------------------------------------------------------------------- 1 | == Admin tasks == 2 | 3 | For reference (and in case I get run over or something) here's a grab 4 | bag of marmalade tasks. 5 | 6 | 7 | === To close down node.js/mongo marmalade-repo === 8 | 9 | We will need to: 10 | 11 | * shut off the node.js app so people can't upload 12 | * do a full dump of the db 13 | * run mongo-covert to export 14 | * rsync the files to the new host 15 | * turn on new marmalade uploader 16 | 17 | === Syncing the mongodb dump from Marmalade v1 === 18 | 19 | Here's the cron I run to keep a local copy of marmalade: 20 | 21 | {{{ 22 | rsync --bwlimit=20 -av \ 23 | --files-from=<(ssh $MARMALADE_HOST find seville-marmalade/mongodump -cmin -60) \ 24 | -e ssh $MARMALADE_HOST:. $DESTINATION_DIR 25 | }}} 26 | 27 | The dump is pretty big so I'm not getting the latest of 28 | everything. Just the last hour and I run it twice a day. 29 | 30 | === Importing a mongodb dump from Marmalade v1 === 31 | 32 | Marmalade v1 dumps it's mongodb to a file every hour. I pull those 33 | files to my house and then use them to setup a local copy of the 34 | marmalade database that I use to generate the marmalade v2 filesystem. 35 | 36 | How to restore the database: 37 | 38 | {{{ 39 | mongorestore $DIRECTORY 40 | }}} 41 | 42 | the {{{$DIRECTORY}}} should be an individual full-dump directory. 43 | 44 | I have a directory full of dumps so this is how I actually do it: 45 | 46 | {{{ 47 | mongorestore ~/seville-marmalade/mongodump/$(ls -t ~/seville-marmalade/mongodump/ | head -n2 | tail -n1) 48 | }}} 49 | 50 | that chooses the last but one dump all the time. 51 | 52 | 53 | === Turning the mongodb into a file system === 54 | 55 | A simple bash script uses {{{mongofiles}}} to export the mongo 56 | database into a marmalade file system: 57 | 58 | {{{ 59 | bash mongo-convert 60 | }}} 61 | 62 | This uses {{{~/marmalade/packages}}} as the package root, by default. 63 | 64 | 65 | === Sync the extracted file system === 66 | 67 | {{{mongofiles}}} doesn't update files, it just splats over them so you 68 | need a smarter {{{rsync}}} to move them to another host: 69 | 70 | {{{ 71 | rsync -catve ssh "$MARMALADE_HOST:marmalade/packages/*" marmalade/packages 72 | }}} 73 | 74 | //It would be really useful// to understand the incomming packages on 75 | that rsync and to call the internal archive-contents update urls. Some 76 | sort of grep on the rsync output could probably achieve that. 77 | 78 | This would mean new marmalade could be a mirror of old marmalade for a 79 | while, before we switch over. 80 | 81 | === Deploy marmalade === 82 | 83 | A deploy script is included in the repository. 84 | 85 | This is the sequence of things you need to do to deploy: 86 | 87 | {{{ 88 | $ emacs-local/bin/emacsclient -s /tmp/emacs1000/marmalade -e '(kill-emacs)' 89 | $ rm -rf marmalade-repo 90 | $ emacs-local/bin/emacs --script deploy.el marmalade-repo 91 | $ HOME=$(realpath marmalade-repo) emacs-local/bin/emacs --daemon=marmalade 92 | }}} 93 | 94 | The steps are: 95 | 96 | 1. kill any existing daemon 97 | 98 | 2. remove the existing deployment (//not// the data) 99 | 100 | 3. deploy the package and it's dependancies 101 | 102 | 4. start the daemon 103 | 104 | Once the Emacs instance is started you can attach to it like this: 105 | 106 | {{{ 107 | $ emacs-local/bin/emacsclient -s /tmp/emacs1000/marmalade $(realpath marmalade-repo) 108 | }}} 109 | 110 | The argument {{{$(realpath marmalade-repo}}} only ensures we open some 111 | directory. Any directory or file could be given, as ever with 112 | {{{emacsclient}}}. 113 | 114 | //Note on the package archives file: currently the archive file has to 115 | be generated manually and it's rather slow. Use M-x 116 | marmalade/package-archives to generate it.// 117 | -------------------------------------------------------------------------------- /specialpages/docs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Marmalade - docs 7 | 8 | 9 | ${header} 10 |
11 |
12 |
13 |

docs

14 | 15 |

v1 API

16 | 17 |

18 | The current API supported by the Elnode service is massively cut 19 | down from the original API supported by the nodejs service. The 20 | current API supports only a few functions. 21 |

22 | 23 |

I have retained the marker /v1 because it seemed 24 | easier to do than invent a lot more stuff. But mostly this is very 25 | different from the original nex3 API.

26 | 27 |

token acquire

28 |

29 | http://marmalade-repo.org/v1/users/login/

30 | 31 | Acquiring a token is basically like getting a cookie. You get 32 | the cookie and then present it to all the subsequent requests.

33 | marmalade-repo API does not work without an authentication token. 34 |
35 |

36 | parameters: 37 |

    38 |
  • name - a valid marmalade-repo username
  • 39 |
  • password - a valid marmalade-repo password
  • 40 |
41 | 42 | Returns a JSON structure with the token being present as a key 43 | token. 44 | 45 |

46 | 47 |

package upload

48 |

49 | http://marmalade-repo.org/v1/packages

50 | 51 | Upload a package file to marmalade-repo. Either an ELPA 52 | package format tar file or an ELPA marked-up .el file 53 | may be specified. 54 | 55 |

56 | parameters: 57 |

    58 |
  • name - the username of the owner of the package
  • 59 |
  • token - the auth token of the owner of the package
  • 60 |
  • package - the package file contents
  • 61 |
62 | 63 | Returns a JSON structure with a message key for 64 | any informational or error message. 65 | 66 |

67 | 68 |

owner add

69 |

70 | http://marmalade-repo.org/v1/package/package-name 71 | 72 | Add an owner to the specified package-name. 73 | 74 |

75 | parameters: 76 |

    77 |
  • name - the username of you, a current owner
  • 78 |
  • token - the auth token of the you, a current owner
  • 79 |
  • addowner - must be addowner
  • 80 |
  • new-owner - the name of another marmalade user to add as an owner
  • 81 |
82 | 83 | Returns a JSON structure with a message key for 84 | any informational or error message.

85 | 400 response on error. 86 |
87 |

88 | 89 |

package remove

90 |

91 | http://marmalade-repo.org/v1/package/package-name 92 | 93 | Remove the specified package. 94 | 95 |

96 | parameters: 97 |

    98 |
  • name - the username of you, a current owner
  • 99 |
  • token - the auth token of the you, a current owner
  • 100 |
  • delete - must be delete
  • 101 |
102 | 103 | Returns a JSON structure with a message key for 104 | any informational or error message.

105 | 400 response on error. 106 |
107 |

108 | 109 |

implementations

110 | 111 |

I know of the following implementations of the API:

112 | 113 | 120 | 121 | 122 | If you want to have your marmalade tool listed here then please send 123 | me a pull request via marmalade-repo's 125 | GitHub account 126 | 127 | 128 |
129 |
130 |
131 | 141 | 142 | 143 | -------------------------------------------------------------------------------- /marmalade-repo-test/packages/less-css-mode/0.1/less-css-mode-0.1.el: -------------------------------------------------------------------------------- 1 | ;;; less-css-mode.el --- Major mode for editing LESS CSS files (lesscss.org) 2 | ;; 3 | ;; Copyright 2011 Steve Purcell 4 | ;; 5 | ;; Author: Steve Purcell 6 | ;; URL: https://github.com/purcell/less-css-mode 7 | ;; Keywords: less css mode 8 | ;; Version: 0.1 9 | ;; 10 | ;; This program is free software; you can redistribute it and/or 11 | ;; modify it under the terms of the GNU General Public License as 12 | ;; published by the Free Software Foundation; either version 2 of 13 | ;; the License, or (at your option) any later version. 14 | ;; 15 | ;; This program is distributed in the hope that it will be 16 | ;; useful, but WITHOUT ANY WARRANTY; without even the implied 17 | ;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 18 | ;; PURPOSE. See the GNU General Public License for more details. 19 | ;; 20 | ;;; Commentary: 21 | ;; 22 | ;; This mode provides syntax highlighting for LESS CSS files, plus 23 | ;; optional support for flymake and compilation of .less files to .css 24 | ;; files at the time they are saved: use `less-css-compile-at-save' to 25 | ;; enable the latter. 26 | ;; 27 | ;; Command line utility "lessc" is required if enabling flymake or 28 | ;; setting `less-css-compile-at-save' to t. To install "lessc" using 29 | ;; the Node.js package manager, run "npm install less" 30 | ;; 31 | ;; Also make sure the "lessc" executable is in emacs' PATH, example: 32 | ;; (setq exec-path (cons (expand-file-name "~/.gem/ruby/1.8/bin") exec-path)) 33 | ;; or customize `less-css-lessc-command' to point to your "lessc" executable. 34 | ;; 35 | ;;; Credits 36 | ;; 37 | ;; This mode was, in large part, built using Anton Johansson's 38 | ;; scss-mode as a template -- thanks Anton! https://github.com/antonj 39 | ;; 40 | ;;; Code: 41 | 42 | (require 'derived) 43 | (require 'compile) 44 | (require 'flymake) 45 | 46 | (defgroup less-css nil 47 | "Less-css mode" 48 | :prefix "less-css-" 49 | :group 'css) 50 | 51 | (defcustom less-css-lessc-command "lessc" 52 | "Command used to compile LESS files, should be lessc or the 53 | complete path to your lessc runnable example: 54 | \"~/.gem/ruby/1.8/bin/lessc\"" 55 | :group 'less-css) 56 | 57 | (defcustom less-css-compile-at-save nil 58 | "If not nil the LESS buffers will be compiled after each save" 59 | :type 'boolean 60 | :group 'less-css) 61 | 62 | (defcustom less-css-lessc-options '() 63 | "Command line Options for less executable." 64 | :group 'less-css) 65 | 66 | (defconst less-css-default-error-regex "Syntax Error on line \\([0-9]+\\)\e\\[39m\e\\[31m in \e\\[39m\\([^ ]+\\)$") 67 | 68 | (defcustom less-css-compile-error-regex (list (concat "\\(" less-css-default-error-regex "\\)") 3 2 nil nil 1) 69 | "Regex for finding line number file and error message in 70 | compilation buffers, syntax from 71 | `compilation-error-regexp-alist' (REGEXP FILE LINE COLUMN TYPE 72 | HYPERLINK HIGHLIGHT)" 73 | :group 'less-css) 74 | 75 | 76 | ;; TODO: '&', interpolation, escaped values (~"..."), JS eval (~`...`), custom faces 77 | (defconst less-css-font-lock-keywords 78 | '(;; Variables 79 | ("@[a-z_-][a-z-_0-9]*" . font-lock-constant-face) 80 | ;; Extended single-line comment syntax 81 | ("//.*$" . font-lock-comment-face) 82 | ;; Mixins 83 | ("\\(?:[ \t{;]\\|^\\)\\(\\.[a-z_-][a-z-_0-9]*\\)[ \t]*;" . (1 font-lock-keyword-face))) 84 | ) 85 | 86 | (defun less-css-compile-maybe() 87 | "Runs `less-css-compile' on if `less-css-compile-at-save' is t" 88 | (if less-css-compile-at-save 89 | (less-css-compile))) 90 | 91 | (defun less-css-compile() 92 | "Compiles the current buffer, lessc filename.less" 93 | (interactive) 94 | (compile (concat less-css-lessc-command " " (mapconcat 'identity less-css-lessc-options " ") " " 95 | "'" buffer-file-name "' '" (file-name-sans-extension buffer-file-name) ".css'"))) 96 | 97 | ;;;###autoload 98 | (define-derived-mode less-css-mode css-mode "LESS" 99 | "Major mode for editing LESS files, http://lesscss.org/ 100 | Special commands: 101 | \\{less-css-mode-map}" 102 | (font-lock-add-keywords nil less-css-font-lock-keywords) 103 | (add-to-list 'compilation-error-regexp-alist less-css-compile-error-regex) 104 | (add-hook 'after-save-hook 'less-css-compile-maybe nil t)) 105 | 106 | (define-key less-css-mode-map "\C-c\C-c" 'less-css-compile) 107 | 108 | (defun flymake-less-css-init () 109 | "Flymake support for LESS files" 110 | (let* ((temp-file (flymake-init-create-temp-buffer-copy 111 | 'flymake-create-temp-inplace)) 112 | (local-file (file-relative-name 113 | temp-file 114 | (file-name-directory buffer-file-name)))) 115 | (list less-css-lessc-command (append less-css-lessc-options (list local-file))))) 116 | 117 | (push '(".+\\.less$" flymake-less-css-init) flymake-allowed-file-name-masks) 118 | 119 | (push (list less-css-default-error-regex 2 1 nil 2) flymake-err-line-patterns) 120 | 121 | ;;;###autoload 122 | (add-to-list 'auto-mode-alist '("\\.less" . less-css-mode)) 123 | 124 | (provide 'less-css-mode) 125 | ;;; less-css-mode.el ends here 126 | -------------------------------------------------------------------------------- /marmalade-repo-test/packages/less-css-mode/0.2/less-css-mode-0.2.el: -------------------------------------------------------------------------------- 1 | 2 | ;;; less-css-mode.el --- Major mode for editing LESS CSS files (lesscss.org) 3 | ;; 4 | ;; Copyright 2011 Steve Purcell 5 | ;; 6 | ;; Author: Steve Purcell 7 | ;; URL: https://github.com/purcell/less-css-mode 8 | ;; Keywords: less css mode 9 | ;; Version: 0.2 10 | ;; 11 | ;; This program is free software; you can redistribute it and/or 12 | ;; modify it under the terms of the GNU General Public License as 13 | ;; published by the Free Software Foundation; either version 2 of 14 | ;; the License, or (at your option) any later version. 15 | ;; 16 | ;; This program is distributed in the hope that it will be 17 | ;; useful, but WITHOUT ANY WARRANTY; without even the implied 18 | ;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 19 | ;; PURPOSE. See the GNU General Public License for more details. 20 | ;; 21 | ;;; Commentary: 22 | ;; 23 | ;; This mode provides syntax highlighting for LESS CSS files, plus 24 | ;; optional support for flymake and compilation of .less files to .css 25 | ;; files at the time they are saved: use `less-css-compile-at-save' to 26 | ;; enable the latter. 27 | ;; 28 | ;; Command line utility "lessc" is required if enabling flymake or 29 | ;; setting `less-css-compile-at-save' to t. To install "lessc" using 30 | ;; the Node.js package manager, run "npm install less" 31 | ;; 32 | ;; Also make sure the "lessc" executable is in emacs' PATH, example: 33 | ;; (setq exec-path (cons (expand-file-name "~/.gem/ruby/1.8/bin") exec-path)) 34 | ;; or customize `less-css-lessc-command' to point to your "lessc" executable. 35 | ;; 36 | ;; `less-css-mode' is derived from `css-mode', and indentation of 37 | ;; nested blocks may not work correctly with versions of `css-mode' 38 | ;; other than that bundled with recent Emacs. 39 | ;; 40 | ;;; Credits 41 | ;; 42 | ;; This mode was, in large part, built using Anton Johansson's 43 | ;; scss-mode as a template -- thanks Anton! https://github.com/antonj 44 | ;; 45 | ;;; Code: 46 | 47 | (require 'derived) 48 | (require 'compile) 49 | (require 'flymake) 50 | 51 | (defgroup less-css nil 52 | "Less-css mode" 53 | :prefix "less-css-" 54 | :group 'css) 55 | 56 | (defcustom less-css-lessc-command "lessc" 57 | "Command used to compile LESS files, should be lessc or the 58 | complete path to your lessc runnable example: 59 | \"~/.gem/ruby/1.8/bin/lessc\"" 60 | :group 'less-css) 61 | 62 | (defcustom less-css-compile-at-save nil 63 | "If not nil the LESS buffers will be compiled after each save" 64 | :type 'boolean 65 | :group 'less-css) 66 | 67 | (defcustom less-css-lessc-options '() 68 | "Command line Options for less executable." 69 | :group 'less-css) 70 | 71 | (defconst less-css-default-error-regex "Syntax Error on line \\([0-9]+\\)\e\\[39m\e\\[31m in \e\\[39m\\([^ ]+\\)$") 72 | 73 | (defcustom less-css-compile-error-regex (list (concat "\\(" less-css-default-error-regex "\\)") 3 2 nil nil 1) 74 | "Regex for finding line number file and error message in 75 | compilation buffers, syntax from 76 | `compilation-error-regexp-alist' (REGEXP FILE LINE COLUMN TYPE 77 | HYPERLINK HIGHLIGHT)" 78 | :group 'less-css) 79 | 80 | 81 | ;; TODO: '&', interpolation, escaped values (~"..."), JS eval (~`...`), custom faces 82 | (defconst less-css-font-lock-keywords 83 | '(;; Variables 84 | ("@[a-z_-][a-z-_0-9]*" . font-lock-constant-face) 85 | ;; Mixins 86 | ("\\(?:[ \t{;]\\|^\\)\\(\\.[a-z_-][a-z-_0-9]*\\)[ \t]*;" . (1 font-lock-keyword-face))) 87 | ) 88 | 89 | (defun less-css-compile-maybe() 90 | "Runs `less-css-compile' on if `less-css-compile-at-save' is t" 91 | (if less-css-compile-at-save 92 | (less-css-compile))) 93 | 94 | (defun less-css-compile() 95 | "Compiles the current buffer, lessc filename.less" 96 | (interactive) 97 | (compile (concat less-css-lessc-command " " (mapconcat 'identity less-css-lessc-options " ") " " 98 | "'" buffer-file-name "' '" (file-name-sans-extension buffer-file-name) ".css'"))) 99 | 100 | ;;;###autoload 101 | (define-derived-mode less-css-mode css-mode "LESS" 102 | "Major mode for editing LESS files, http://lesscss.org/ 103 | Special commands: 104 | \\{less-css-mode-map}" 105 | (font-lock-add-keywords nil less-css-font-lock-keywords) 106 | ;; cpp-style comments 107 | (modify-syntax-entry ?/ "< 124b" less-css-mode-syntax-table) 108 | (modify-syntax-entry ?\n "> b" less-css-mode-syntax-table) 109 | 110 | (add-hook 'after-save-hook 'less-css-compile-maybe nil t)) 111 | 112 | (define-key less-css-mode-map "\C-c\C-c" 'less-css-compile) 113 | 114 | (add-to-list 'compilation-error-regexp-alist 'less-css-compile-error-regex) 115 | 116 | (defun flymake-less-css-init () 117 | "Flymake support for LESS files" 118 | (let* ((temp-file (flymake-init-create-temp-buffer-copy 119 | 'flymake-create-temp-inplace)) 120 | (local-file (file-relative-name 121 | temp-file 122 | (file-name-directory buffer-file-name)))) 123 | (list less-css-lessc-command (append less-css-lessc-options (list local-file))))) 124 | 125 | (push '(".+\\.less$" flymake-less-css-init) flymake-allowed-file-name-masks) 126 | 127 | (push (list less-css-default-error-regex 2 1 nil 2) flymake-err-line-patterns) 128 | 129 | ;;;###autoload 130 | (add-to-list 'auto-mode-alist '("\\.less" . less-css-mode)) 131 | 132 | (provide 'less-css-mode) 133 | ;;; less-css-mode.el ends here 134 | -------------------------------------------------------------------------------- /marmalade-mongo.el: -------------------------------------------------------------------------------- 1 | ;;; marmalade-mongo.el --- convert the marmalade db 2 | 3 | ;; Copyright (C) 2013 Nic Ferrier 4 | 5 | ;; This program is free software; you can redistribute it and/or modify 6 | ;; it under the terms of the GNU General Public License as published by 7 | ;; the Free Software Foundation, either version 3 of the License, or 8 | ;; (at your option) any later version. 9 | 10 | ;; This program is distributed in the hope that it will be useful, 11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | ;; GNU General Public License for more details. 14 | 15 | ;; You should have received a copy of the GNU General Public License 16 | ;; along with this program. If not, see . 17 | 18 | ;;; Commentary: 19 | 20 | ;; The marmalade database is a mongo db thing. This converts it to 21 | ;; emacs-db where we can put it into files or postgres or whatever we 22 | ;; like. 23 | 24 | ;;; Code: 25 | 26 | (require 'dash) 27 | (require 'cl) 28 | 29 | (defun marmalade-mongo/target-file (target-root package-name version type) 30 | (format 31 | "%s/%s/%s/%s" 32 | target-root package-name version 33 | (concat package-name "-" version "." type))) 34 | 35 | (defun marmalade-mongo-done () 36 | "Called at the end of the conversion." 37 | (message "marmalade-mongo all done")) 38 | 39 | (defun marmalade-mongo/make-files (files target-root) 40 | "Recursive package to package-file maker. 41 | 42 | Use mongofiles to grab a file from the database and put it on the 43 | file system. Recurs around the FILES and calls 44 | `marmalade-mongo-done' when it's finished." 45 | (when files 46 | (destructuring-bind (file-entry &rest files) files 47 | (destructuring-bind (filename package-name type version) file-entry 48 | (let ((temp-file (make-temp-name 49 | (format "mongofile-%s-%s" package-name version))) 50 | (target-file (marmalade-mongo/target-file 51 | target-root package-name version type))) 52 | (if (file-exists-p target-file) 53 | (marmalade-mongo/make-files files target-root) 54 | ;; Else: 55 | (make-directory (file-name-directory target-file) t) 56 | (setq proc 57 | (start-process 58 | (concat "mongo-file-make-" filename) 59 | " *mongofilemake*" 60 | "mongofiles" "-d" "marmalade" 61 | "-l" temp-file "get" filename)) 62 | ;; Use the sentinel to move the file when it's been done 63 | (set-process-sentinel 64 | proc 65 | (lambda (proc status) 66 | (when (equal status "finished\n") 67 | (condition-case err 68 | (rename-file temp-file target-file) 69 | (file-error 70 | (message "marmalade-mongo %s to %s got %S" 71 | temp-file target-file err))) 72 | (if files 73 | (marmalade-mongo/make-files files target-root) 74 | ;; Call the end function if we're done 75 | (marmalade-mongo-done))))))))))) 76 | 77 | (defun marmalade-mongo/buf->list (buffer) 78 | "Converts the buffer listing of the files in mongo to a proper list." 79 | (with-current-buffer buffer 80 | (goto-char (point-min)) 81 | (let (results) 82 | (while (re-search-forward 83 | (concat 84 | "^\\(\\([A-Za-z0-9-]+\\)\\.\\(el\\|tar\\)/\\([0-9.]+\\)\\)" 85 | "[ \t]+[0-9]") 86 | nil 87 | t) 88 | (setq results 89 | (append (list 90 | (list 91 | (match-string 1) 92 | (match-string 2) 93 | (match-string 3) 94 | (match-string 4))) results))) 95 | results))) 96 | 97 | (defun marmalade-mongo/make-filelist (target-root) 98 | "Get the list of files." 99 | (let ((mongo-buf (get-buffer-create "*mongofiles*"))) 100 | (with-current-buffer mongo-buf (erase-buffer)) 101 | (let ((proc (start-process 102 | "mongo-list" mongo-buf 103 | "mongofiles" "-d" "marmalade" "list"))) 104 | (set-process-sentinel 105 | proc 106 | (lambda (proc stat) 107 | (when (string-match ".*finished\n" stat) 108 | (marmalade-mongo/make-files 109 | (-filter 110 | (lambda (entry) 111 | (destructuring-bind 112 | (filename package-name type version) entry 113 | (let ((target-file 114 | (marmalade-mongo/target-file 115 | target-root package-name version type))) 116 | (unless (file-exists-p target-file) 117 | (list filename target-file))))) 118 | (marmalade-mongo/buf->list mongo-buf)) 119 | target-root))))))) 120 | 121 | ;;;###autoload 122 | (defun marmalade-mongo-main () 123 | "Main function for calling directly." 124 | (interactive) 125 | (destructuring-bind (&optional directory) 126 | command-line-args-left 127 | (let ((dir (or directory 128 | marmalade-package-store-dir 129 | "~/marmalade/packages"))) 130 | (marmalade-mongo/make-filelist dir)))) 131 | 132 | (provide 'marmalade-mongo) 133 | 134 | ;; Local Variables: 135 | ;; lexical-binding: t 136 | ;; End: 137 | 138 | ;;; marmalade-mongo.el ends here 139 | -------------------------------------------------------------------------------- /marmalade-repo-test/packages/flymake-easy/0.1/flymake-easy-0.1.el: -------------------------------------------------------------------------------- 1 | 2 | ;;; flymake-easy.el --- Helpers for easily building flymake checkers 3 | 4 | ;; Copyright (C) 2012 Steve Purcell 5 | 6 | ;; Author: Steve Purcell 7 | ;; URL: https://github.com/purcell/flymake-easy 8 | ;; Version: 0.1 9 | ;; Keywords: convenience, internal 10 | 11 | ;; This program is free software; you can redistribute it and/or modify 12 | ;; it under the terms of the GNU General Public License as published by 13 | ;; the Free Software Foundation, either version 3 of the License, or 14 | ;; (at your option) any later version. 15 | 16 | ;; This program is distributed in the hope that it will be useful, 17 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | ;; GNU General Public License for more details. 20 | 21 | ;; You should have received a copy of the GNU General Public License 22 | ;; along with this program. If not, see . 23 | 24 | ;;; Commentary: 25 | 26 | ;; This library provides the `flymake-easy-load' helper function for 27 | ;; setting up flymake checkers. Just call that function with the 28 | ;; appropriate arguments in a major mode hook function. See 29 | ;; `flymake-ruby' for an example: 30 | ;; https://github.com/purcell/flymake-ruby 31 | 32 | ;;; Code: 33 | 34 | (require 'flymake) 35 | 36 | (defvar flymake-easy--active nil 37 | "Indicates when flymake-easy-load has successfully run in this buffer.") 38 | (defvar flymake-easy--command-fn nil 39 | "The user-specified function for building the flymake command.") 40 | (defvar flymake-easy--location nil 41 | "Where to create the temp file when checking, one of 'tempdir or 'inplace.") 42 | (defvar flymake-easy--extension nil 43 | "The canonical file name extension to use for the current file.") 44 | 45 | (mapc 'make-variable-buffer-local 46 | '(flymake-easy--active 47 | flymake-easy--command-fn 48 | flymake-easy--location 49 | flymake-easy--extension)) 50 | 51 | (defun flymake-easy--tempfile-in-temp-dir (file-name prefix) 52 | "Create a temporary file for storing the contents of FILE-NAME in the system tempdir. 53 | Argument PREFIX temp file prefix, supplied by flymake." 54 | (make-temp-file (or prefix "flymake-easy") nil flymake-easy--extension)) 55 | 56 | (defun flymake-easy--flymake-init () 57 | "A catch-all flymake init function for use in `flymake-allowed-file-name-masks'." 58 | (let* ((tempfile 59 | (flymake-init-create-temp-buffer-copy 60 | (cond 61 | ((eq 'tempdir flymake-easy--location) 62 | 'flymake-easy--tempfile-in-temp-dir) 63 | ((eq 'inplace flymake-easy--location) 64 | 'flymake-create-temp-inplace) 65 | (t 66 | (error "unknown location for flymake-easy: %s" flymake-easy--location))))) 67 | (command (funcall flymake-easy--command-fn tempfile))) 68 | (list (first command) (rest command)))) 69 | 70 | (defun flymake-easy-load (command-fn err-line-patterns &optional location extension) 71 | "Enable flymake in the containing buffer using a specific narrow configuration. 72 | Argument COMMAND-FN function called to build the 73 | command line to run (receives filename, returns list). 74 | Argument ERR-LINE-PATTERNS patterns for identifying errors (see `flymake-err-line-patterns'). 75 | Argument EXTENSION a canonical extension for this type of source file, e.g. \"rb\". 76 | Argument LOCATION where to create the temporary copy: one of 'tempdir (default) or 'inplace." 77 | (let ((executable (first (funcall command-fn "dummy")))) 78 | (if (executable-find executable) ;; TODO: defer this checking 79 | (progn 80 | (setq flymake-easy--command-fn command-fn 81 | flymake-easy--location (or location 'tempdir) 82 | flymake-easy--extension extension 83 | flymake-easy--active t) 84 | (set (make-local-variable 'flymake-allowed-file-name-masks) 85 | '(("." flymake-easy--flymake-init))) 86 | (set (make-local-variable 'flymake-err-line-patterns) err-line-patterns) 87 | (flymake-mode t)) 88 | (message "Not enabling flymake: '%s' command not found" executable)))) 89 | 90 | ;; Internal overrides for flymake 91 | 92 | (defun flymake-easy--find-all-matches (str) 93 | "Return all matched for error line patterns in STR. 94 | 95 | This is a judicious override for `flymake-split-output', enabled 96 | by the advice below, which allows for matching multi-line 97 | patterns." 98 | (let (matches 99 | (last-match-end-pos 0)) 100 | (dolist (pattern flymake-err-line-patterns) 101 | (let ((regex (car pattern)) 102 | (pos 0)) 103 | (while (string-match regex str pos) 104 | (push (match-string 0 str) matches) 105 | (setq pos (match-end 0))) 106 | (setf last-match-end-pos (max pos last-match-end-pos)))) 107 | (let ((residual (substring str last-match-end-pos))) 108 | (list matches 109 | (unless (string= "" residual) residual))))) 110 | 111 | (defadvice flymake-split-output (around flymake-easy--split-output (output) activate protect) 112 | "Override `flymake-split-output' to support mult-line error messages." 113 | (setq ad-return-value (if flymake-easy--active 114 | (flymake-easy--find-all-matches output) 115 | ad-do-it))) 116 | 117 | 118 | (defadvice flymake-post-syntax-check (before flymake-easy--force-check-was-interrupted activate) 119 | (when flymake-easy--active 120 | (setq flymake-check-was-interrupted t))) 121 | 122 | 123 | (provide 'flymake-easy) 124 | ;;; flymake-easy.el ends here 125 | -------------------------------------------------------------------------------- /marmalade-repo-test/packages/less-css-mode/0.3/less-css-mode-0.3.el: -------------------------------------------------------------------------------- 1 | 2 | ;;; less-css-mode.el --- Major mode for editing LESS CSS files (lesscss.org) 3 | ;; 4 | ;; Copyright 2011 Steve Purcell 5 | ;; 6 | ;; Author: Steve Purcell 7 | ;; URL: https://github.com/purcell/less-css-mode 8 | ;; Keywords: less css mode 9 | ;; Version: 0.3 10 | ;; 11 | ;; This program is free software; you can redistribute it and/or 12 | ;; modify it under the terms of the GNU General Public License as 13 | ;; published by the Free Software Foundation; either version 2 of 14 | ;; the License, or (at your option) any later version. 15 | ;; 16 | ;; This program is distributed in the hope that it will be 17 | ;; useful, but WITHOUT ANY WARRANTY; without even the implied 18 | ;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 19 | ;; PURPOSE. See the GNU General Public License for more details. 20 | ;; 21 | ;;; Commentary: 22 | ;; 23 | ;; This mode provides syntax highlighting for LESS CSS files, plus 24 | ;; optional support for flymake and compilation of .less files to .css 25 | ;; files at the time they are saved: use `less-css-compile-at-save' to 26 | ;; enable the latter. 27 | ;; 28 | ;; Command line utility "lessc" is required if enabling flymake or 29 | ;; setting `less-css-compile-at-save' to t. To install "lessc" using 30 | ;; the Node.js package manager, run "npm install less" 31 | ;; 32 | ;; Also make sure the "lessc" executable is in emacs' PATH, example: 33 | ;; (setq exec-path (cons (expand-file-name "~/.gem/ruby/1.8/bin") exec-path)) 34 | ;; or customize `less-css-lessc-command' to point to your "lessc" executable. 35 | ;; 36 | ;; `less-css-mode' is derived from `css-mode', and indentation of 37 | ;; nested blocks may not work correctly with versions of `css-mode' 38 | ;; other than that bundled with recent Emacs. 39 | ;; 40 | ;;; Credits 41 | ;; 42 | ;; The original code for this mode was, in large part, written using 43 | ;; Anton Johansson's scss-mode as a template -- thanks Anton! 44 | ;; https://github.com/antonj 45 | ;; 46 | ;;; Code: 47 | 48 | (require 'derived) 49 | (require 'compile) 50 | (require 'flymake) 51 | 52 | (defgroup less-css nil 53 | "Less-css mode" 54 | :prefix "less-css-" 55 | :group 'css) 56 | 57 | (defcustom less-css-lessc-command "lessc" 58 | "Command used to compile LESS files, should be lessc or the 59 | complete path to your lessc executable, e.g.: 60 | \"~/.gem/ruby/1.8/bin/lessc\"" 61 | :group 'less-css) 62 | 63 | (defcustom less-css-compile-at-save nil 64 | "If non-nil, the LESS buffers will be compiled to CSS after each save" 65 | :type 'boolean 66 | :group 'less-css) 67 | 68 | (defcustom less-css-lessc-options '() 69 | "Command line options for less executable. 70 | 71 | Use \"-x\" to minify output." 72 | :type '(repeat string) 73 | :group 'less-css) 74 | 75 | (defconst less-css-default-error-regex "Syntax Error on line \\([0-9]+\\)\e\\[39m\e\\[31m in \e\\[39m\\([^ ]+\\)$") 76 | 77 | (defcustom less-css-compile-error-regex (list (concat "\\(" less-css-default-error-regex "\\)") 3 2 nil nil 1) 78 | "Regex for finding line number file and error message in compilation buffers. 79 | 80 | This uses the same syntax as `compilation-error-regexp-alist'." 81 | :type '(repeat (choice (symbol :tag "Predefined symbol") 82 | (sexp :tag "Error specification"))) 83 | :group 'less-css) 84 | 85 | 86 | ;; TODO: '&', interpolation, escaped values (~"..."), JS eval (~`...`), custom faces 87 | (defconst less-css-font-lock-keywords 88 | '(;; Variables 89 | ("@[a-z_-][a-z-_0-9]*" . font-lock-constant-face) 90 | ;; Mixins 91 | ("\\(?:[ \t{;]\\|^\\)\\(\\.[a-z_-][a-z-_0-9]*\\)[ \t]*;" . (1 font-lock-keyword-face))) 92 | ) 93 | 94 | (defun less-css-compile-maybe () 95 | "Runs `less-css-compile' on if `less-css-compile-at-save' is t" 96 | (if less-css-compile-at-save 97 | (less-css-compile))) 98 | 99 | (defun less-css-compile () 100 | "Compiles the current buffer to css using `less-css-lessc-command'." 101 | (interactive) 102 | (message "Compiling less to css") 103 | (compile 104 | (mapconcat 'shell-quote-argument 105 | (append (list less-css-lessc-command) 106 | less-css-lessc-options 107 | (list buffer-file-name 108 | (concat (file-name-sans-extension buffer-file-name) ".css"))) 109 | " "))) 110 | 111 | ;;;###autoload 112 | (define-derived-mode less-css-mode css-mode "LESS" 113 | "Major mode for editing LESS files, http://lesscss.org/ 114 | Special commands: 115 | \\{less-css-mode-map}" 116 | (font-lock-add-keywords nil less-css-font-lock-keywords) 117 | ;; cpp-style comments 118 | (modify-syntax-entry ?/ "< 124b" less-css-mode-syntax-table) 119 | (modify-syntax-entry ?\n "> b" less-css-mode-syntax-table) 120 | 121 | (add-hook 'after-save-hook 'less-css-compile-maybe nil t)) 122 | 123 | (define-key less-css-mode-map "\C-c\C-c" 'less-css-compile) 124 | 125 | (add-to-list 'compilation-error-regexp-alist 'less-css-compile-error-regex) 126 | 127 | (defun flymake-less-css-init () 128 | "Flymake support for LESS files" 129 | (let* ((temp-file (flymake-init-create-temp-buffer-copy 130 | 'flymake-create-temp-inplace)) 131 | (local-file (file-relative-name 132 | temp-file 133 | (file-name-directory buffer-file-name)))) 134 | (list less-css-lessc-command (append less-css-lessc-options (list local-file))))) 135 | 136 | (push '(".+\\.less$" flymake-less-css-init) flymake-allowed-file-name-masks) 137 | 138 | (push (list less-css-default-error-regex 2 1 nil 2) flymake-err-line-patterns) 139 | 140 | ;;;###autoload 141 | (add-to-list 'auto-mode-alist '("\\.less" . less-css-mode)) 142 | 143 | (provide 'less-css-mode) 144 | ;;; less-css-mode.el ends here 145 | -------------------------------------------------------------------------------- /marmalade-repo-test/packages/flymake-easy/0.2/flymake-easy-0.2.el: -------------------------------------------------------------------------------- 1 | 2 | ;;; flymake-easy.el --- Helpers for easily building flymake checkers 3 | 4 | ;; Copyright (C) 2012 Steve Purcell 5 | 6 | ;; Author: Steve Purcell 7 | ;; URL: https://github.com/purcell/flymake-easy 8 | ;; Version: 0.2 9 | ;; Keywords: convenience, internal 10 | 11 | ;; This program is free software; you can redistribute it and/or modify 12 | ;; it under the terms of the GNU General Public License as published by 13 | ;; the Free Software Foundation, either version 3 of the License, or 14 | ;; (at your option) any later version. 15 | 16 | ;; This program is distributed in the hope that it will be useful, 17 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | ;; GNU General Public License for more details. 20 | 21 | ;; You should have received a copy of the GNU General Public License 22 | ;; along with this program. If not, see . 23 | 24 | ;;; Commentary: 25 | 26 | ;; This library provides the `flymake-easy-load' helper function for 27 | ;; setting up flymake checkers. Just call that function with the 28 | ;; appropriate arguments in a major mode hook function. See 29 | ;; `flymake-ruby' for an example: 30 | ;; https://github.com/purcell/flymake-ruby 31 | 32 | ;;; Code: 33 | 34 | (require 'flymake) 35 | 36 | (defvar flymake-easy--active nil 37 | "Indicates when flymake-easy-load has successfully run in this buffer.") 38 | (defvar flymake-easy--command-fn nil 39 | "The user-specified function for building the flymake command.") 40 | (defvar flymake-easy--location nil 41 | "Where to create the temp file when checking, one of 'tempdir or 'inplace.") 42 | (defvar flymake-easy--extension nil 43 | "The canonical file name extension to use for the current file.") 44 | 45 | (mapc 'make-variable-buffer-local 46 | '(flymake-easy--active 47 | flymake-easy--command-fn 48 | flymake-easy--location 49 | flymake-easy--extension)) 50 | 51 | (defun flymake-easy--tempfile-in-temp-dir (file-name prefix) 52 | "Create a temporary file for storing the contents of FILE-NAME in the system tempdir. 53 | Argument PREFIX temp file prefix, supplied by flymake." 54 | (make-temp-file (or prefix "flymake-easy") nil flymake-easy--extension)) 55 | 56 | (defun flymake-easy--flymake-init () 57 | "A catch-all flymake init function for use in `flymake-allowed-file-name-masks'." 58 | (let* ((tempfile 59 | (flymake-init-create-temp-buffer-copy 60 | (cond 61 | ((eq 'tempdir flymake-easy--location) 62 | 'flymake-easy--tempfile-in-temp-dir) 63 | ((eq 'inplace flymake-easy--location) 64 | 'flymake-create-temp-inplace) 65 | (t 66 | (error "unknown location for flymake-easy: %s" flymake-easy--location))))) 67 | (command (funcall flymake-easy--command-fn tempfile))) 68 | (list (first command) (rest command)))) 69 | 70 | (defun flymake-easy-load (command-fn err-line-patterns &optional location extension) 71 | "Enable flymake in the containing buffer using a specific narrow configuration. 72 | Argument COMMAND-FN function called to build the 73 | command line to run (receives filename, returns list). 74 | Argument ERR-LINE-PATTERNS patterns for identifying errors (see `flymake-err-line-patterns'). 75 | Argument EXTENSION a canonical extension for this type of source file, e.g. \"rb\". 76 | Argument LOCATION where to create the temporary copy: one of 'tempdir (default) or 'inplace." 77 | (let ((executable (first (funcall command-fn "dummy")))) 78 | (if (executable-find executable) ;; TODO: defer this checking 79 | (progn 80 | (setq flymake-easy--command-fn command-fn 81 | flymake-easy--location (or location 'tempdir) 82 | flymake-easy--extension extension 83 | flymake-easy--active t) 84 | (set (make-local-variable 'flymake-allowed-file-name-masks) 85 | '(("." flymake-easy--flymake-init))) 86 | (set (make-local-variable 'flymake-err-line-patterns) err-line-patterns) 87 | (dolist (var '(flymake-warning-re 88 | flymake-warn-line-regexp)) 89 | (set (make-local-variable var) "^[wW]arn")) 90 | (flymake-mode t)) 91 | (message "Not enabling flymake: '%s' command not found" executable)))) 92 | 93 | ;; Internal overrides for flymake 94 | 95 | (defun flymake-easy--find-all-matches (str) 96 | "Return all matched for error line patterns in STR. 97 | 98 | This is a judicious override for `flymake-split-output', enabled 99 | by the advice below, which allows for matching multi-line 100 | patterns." 101 | (let (matches 102 | (last-match-end-pos 0)) 103 | (dolist (pattern flymake-err-line-patterns) 104 | (let ((regex (car pattern)) 105 | (pos 0)) 106 | (while (string-match regex str pos) 107 | (push (match-string 0 str) matches) 108 | (setq pos (match-end 0))) 109 | (setf last-match-end-pos (max pos last-match-end-pos)))) 110 | (let ((residual (substring str last-match-end-pos))) 111 | (list matches 112 | (unless (string= "" residual) residual))))) 113 | 114 | (defadvice flymake-split-output (around flymake-easy--split-output (output) activate protect) 115 | "Override `flymake-split-output' to support mult-line error messages." 116 | (setq ad-return-value (if flymake-easy--active 117 | (flymake-easy--find-all-matches output) 118 | ad-do-it))) 119 | 120 | 121 | (defadvice flymake-post-syntax-check (before flymake-easy--force-check-was-interrupted activate) 122 | (when flymake-easy--active 123 | (setq flymake-check-was-interrupted t))) 124 | 125 | 126 | (provide 'flymake-easy) 127 | ;;; flymake-easy.el ends here 128 | -------------------------------------------------------------------------------- /marmalade-repo-test/packages/flymake-easy/0.3/flymake-easy-0.3.el: -------------------------------------------------------------------------------- 1 | 2 | ;;; flymake-easy.el --- Helpers for easily building flymake checkers 3 | 4 | ;; Copyright (C) 2012 Steve Purcell 5 | 6 | ;; Author: Steve Purcell 7 | ;; URL: https://github.com/purcell/flymake-easy 8 | ;; Version: 0.3 9 | ;; Keywords: convenience, internal 10 | 11 | ;; This program is free software; you can redistribute it and/or modify 12 | ;; it under the terms of the GNU General Public License as published by 13 | ;; the Free Software Foundation, either version 3 of the License, or 14 | ;; (at your option) any later version. 15 | 16 | ;; This program is distributed in the hope that it will be useful, 17 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | ;; GNU General Public License for more details. 20 | 21 | ;; You should have received a copy of the GNU General Public License 22 | ;; along with this program. If not, see . 23 | 24 | ;;; Commentary: 25 | 26 | ;; This library provides the `flymake-easy-load' helper function for 27 | ;; setting up flymake checkers. Just call that function with the 28 | ;; appropriate arguments in a major mode hook function. See 29 | ;; `flymake-ruby' for an example: 30 | ;; https://github.com/purcell/flymake-ruby 31 | 32 | ;;; Code: 33 | 34 | (require 'flymake) 35 | (require 'cl) 36 | 37 | (defvar flymake-easy--active nil 38 | "Indicates when flymake-easy-load has successfully run in this buffer.") 39 | (defvar flymake-easy--command-fn nil 40 | "The user-specified function for building the flymake command.") 41 | (defvar flymake-easy--location nil 42 | "Where to create the temp file when checking, one of 'tempdir or 'inplace.") 43 | (defvar flymake-easy--extension nil 44 | "The canonical file name extension to use for the current file.") 45 | 46 | (mapc 'make-variable-buffer-local 47 | '(flymake-easy--active 48 | flymake-easy--command-fn 49 | flymake-easy--location 50 | flymake-easy--extension)) 51 | 52 | (defun flymake-easy--tempfile-in-temp-dir (file-name prefix) 53 | "Create a temporary file for storing the contents of FILE-NAME in the system tempdir. 54 | Argument PREFIX temp file prefix, supplied by flymake." 55 | (make-temp-file (or prefix "flymake-easy") nil flymake-easy--extension)) 56 | 57 | (defun flymake-easy--flymake-init () 58 | "A catch-all flymake init function for use in `flymake-allowed-file-name-masks'." 59 | (let* ((tempfile 60 | (flymake-init-create-temp-buffer-copy 61 | (cond 62 | ((eq 'tempdir flymake-easy--location) 63 | 'flymake-easy--tempfile-in-temp-dir) 64 | ((eq 'inplace flymake-easy--location) 65 | 'flymake-create-temp-inplace) 66 | (t 67 | (error "unknown location for flymake-easy: %s" flymake-easy--location))))) 68 | (command (funcall flymake-easy--command-fn tempfile))) 69 | (list (first command) (rest command)))) 70 | 71 | (defun flymake-easy-load (command-fn &optional err-line-patterns location extension) 72 | "Enable flymake in the containing buffer using a specific narrow configuration. 73 | Argument COMMAND-FN function called to build the 74 | command line to run (receives filename, returns list). 75 | Argument ERR-LINE-PATTERNS patterns for identifying errors (see `flymake-err-line-patterns'). 76 | Argument EXTENSION a canonical extension for this type of source file, e.g. \"rb\". 77 | Argument LOCATION where to create the temporary copy: one of 'tempdir (default) or 'inplace." 78 | (let ((executable (first (funcall command-fn "dummy")))) 79 | (if (executable-find executable) ;; TODO: defer this checking 80 | (progn 81 | (setq flymake-easy--command-fn command-fn 82 | flymake-easy--location (or location 'tempdir) 83 | flymake-easy--extension extension 84 | flymake-easy--active t) 85 | (set (make-local-variable 'flymake-allowed-file-name-masks) 86 | '(("." flymake-easy--flymake-init))) 87 | (when err-line-patterns 88 | (set (make-local-variable 'flymake-err-line-patterns) err-line-patterns)) 89 | (dolist (var '(flymake-warning-re 90 | flymake-warn-line-regexp)) 91 | (set (make-local-variable var) "^[wW]arn")) 92 | (flymake-mode t)) 93 | (message "Not enabling flymake: '%s' command not found" executable)))) 94 | 95 | ;; Internal overrides for flymake 96 | 97 | (defun flymake-easy--find-all-matches (str) 98 | "Return all matched for error line patterns in STR. 99 | 100 | This is a judicious override for `flymake-split-output', enabled 101 | by the advice below, which allows for matching multi-line 102 | patterns." 103 | (let (matches 104 | (last-match-end-pos 0)) 105 | (dolist (pattern flymake-err-line-patterns) 106 | (let ((regex (car pattern)) 107 | (pos 0)) 108 | (while (string-match regex str pos) 109 | (push (match-string 0 str) matches) 110 | (setq pos (match-end 0))) 111 | (setf last-match-end-pos (max pos last-match-end-pos)))) 112 | (let ((residual (substring str last-match-end-pos))) 113 | (list matches 114 | (unless (string= "" residual) residual))))) 115 | 116 | (defadvice flymake-split-output (around flymake-easy--split-output (output) activate protect) 117 | "Override `flymake-split-output' to support mult-line error messages." 118 | (setq ad-return-value (if flymake-easy--active 119 | (flymake-easy--find-all-matches output) 120 | ad-do-it))) 121 | 122 | 123 | (defadvice flymake-post-syntax-check (before flymake-easy--force-check-was-interrupted activate) 124 | (when flymake-easy--active 125 | (setq flymake-check-was-interrupted t))) 126 | 127 | 128 | (provide 'flymake-easy) 129 | 130 | ;; Local Variables: 131 | ;; coding: utf-8 132 | ;; byte-compile-warnings: (not cl-functions) 133 | ;; eval: (checkdoc-minor-mode 1) 134 | ;; End: 135 | 136 | ;;; flymake-easy.el ends here 137 | -------------------------------------------------------------------------------- /marmalade-repo-test/packages/flymake-easy/0.4/flymake-easy-0.4.el: -------------------------------------------------------------------------------- 1 | 2 | ;;; flymake-easy.el --- Helpers for easily building flymake checkers 3 | 4 | ;; Copyright (C) 2012 Steve Purcell 5 | 6 | ;; Author: Steve Purcell 7 | ;; URL: https://github.com/purcell/flymake-easy 8 | ;; Version: 0.4 9 | ;; Keywords: convenience, internal 10 | 11 | ;; This program is free software; you can redistribute it and/or modify 12 | ;; it under the terms of the GNU General Public License as published by 13 | ;; the Free Software Foundation, either version 3 of the License, or 14 | ;; (at your option) any later version. 15 | 16 | ;; This program is distributed in the hope that it will be useful, 17 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | ;; GNU General Public License for more details. 20 | 21 | ;; You should have received a copy of the GNU General Public License 22 | ;; along with this program. If not, see . 23 | 24 | ;;; Commentary: 25 | 26 | ;; This library provides the `flymake-easy-load' helper function for 27 | ;; setting up flymake checkers. Just call that function with the 28 | ;; appropriate arguments in a major mode hook function. See 29 | ;; `flymake-ruby' for an example: 30 | ;; https://github.com/purcell/flymake-ruby 31 | 32 | ;;; Code: 33 | 34 | (require 'flymake) 35 | (require 'cl) 36 | 37 | (defvar flymake-easy--active nil 38 | "Indicates when flymake-easy-load has successfully run in this buffer.") 39 | (defvar flymake-easy--command-fn nil 40 | "The user-specified function for building the flymake command.") 41 | (defvar flymake-easy--location nil 42 | "Where to create the temp file when checking, one of 'tempdir or 'inplace.") 43 | (defvar flymake-easy--extension nil 44 | "The canonical file name extension to use for the current file.") 45 | 46 | (mapc 'make-variable-buffer-local 47 | '(flymake-easy--active 48 | flymake-easy--command-fn 49 | flymake-easy--location 50 | flymake-easy--extension)) 51 | 52 | (defun flymake-easy--tempfile-in-temp-dir (file-name prefix) 53 | "Create a temporary file for storing the contents of FILE-NAME in the system tempdir. 54 | Argument PREFIX temp file prefix, supplied by flymake." 55 | (make-temp-file (or prefix "flymake-easy") nil flymake-easy--extension)) 56 | 57 | (defun flymake-easy--flymake-init () 58 | "A catch-all flymake init function for use in `flymake-allowed-file-name-masks'." 59 | (let* ((tempfile 60 | (flymake-init-create-temp-buffer-copy 61 | (cond 62 | ((eq 'tempdir flymake-easy--location) 63 | 'flymake-easy--tempfile-in-temp-dir) 64 | ((eq 'inplace flymake-easy--location) 65 | 'flymake-create-temp-inplace) 66 | (t 67 | (error "unknown location for flymake-easy: %s" flymake-easy--location))))) 68 | (command (funcall flymake-easy--command-fn tempfile))) 69 | (list (first command) (rest command)))) 70 | 71 | (defun flymake-easy-load (command-fn &optional err-line-patterns location extension warning-re) 72 | "Enable flymake in the containing buffer using a specific narrow configuration. 73 | Argument COMMAND-FN function called to build the 74 | command line to run (receives filename, returns list). 75 | Argument ERR-LINE-PATTERNS patterns for identifying errors (see `flymake-err-line-patterns'). 76 | Argument EXTENSION a canonical extension for this type of source file, e.g. \"rb\". 77 | Argument LOCATION where to create the temporary copy: one of 'tempdir (default) or 'inplace. 78 | Argument WARNING-RE a pattern which identifies error messages as warnings." 79 | (let ((executable (first (funcall command-fn "dummy")))) 80 | (if (executable-find executable) ;; TODO: defer this checking 81 | (progn 82 | (setq flymake-easy--command-fn command-fn 83 | flymake-easy--location (or location 'tempdir) 84 | flymake-easy--extension extension 85 | flymake-easy--active t) 86 | (set (make-local-variable 'flymake-allowed-file-name-masks) 87 | '(("." flymake-easy--flymake-init))) 88 | (when err-line-patterns 89 | (set (make-local-variable 'flymake-err-line-patterns) err-line-patterns)) 90 | (dolist (var '(flymake-warning-re 91 | flymake-warn-line-regexp)) 92 | (set (make-local-variable var) (or warning-re "^[wW]arn"))) 93 | (flymake-mode t)) 94 | (message "Not enabling flymake: '%s' command not found" executable)))) 95 | 96 | ;; Internal overrides for flymake 97 | 98 | (defun flymake-easy--find-all-matches (str) 99 | "Return all matched for error line patterns in STR. 100 | 101 | This is a judicious override for `flymake-split-output', enabled 102 | by the advice below, which allows for matching multi-line 103 | patterns." 104 | (let (matches 105 | (last-match-end-pos 0)) 106 | (dolist (pattern flymake-err-line-patterns) 107 | (let ((regex (car pattern)) 108 | (pos 0)) 109 | (while (string-match regex str pos) 110 | (push (match-string 0 str) matches) 111 | (setq pos (match-end 0))) 112 | (setf last-match-end-pos (max pos last-match-end-pos)))) 113 | (let ((residual (substring str last-match-end-pos))) 114 | (list matches 115 | (unless (string= "" residual) residual))))) 116 | 117 | (defadvice flymake-split-output (around flymake-easy--split-output (output) activate protect) 118 | "Override `flymake-split-output' to support mult-line error messages." 119 | (setq ad-return-value (if flymake-easy--active 120 | (flymake-easy--find-all-matches output) 121 | ad-do-it))) 122 | 123 | 124 | (defadvice flymake-post-syntax-check (before flymake-easy--force-check-was-interrupted activate) 125 | (when flymake-easy--active 126 | (setq flymake-check-was-interrupted t))) 127 | 128 | 129 | (provide 'flymake-easy) 130 | 131 | ;; Local Variables: 132 | ;; coding: utf-8 133 | ;; byte-compile-warnings: (not cl-functions) 134 | ;; eval: (checkdoc-minor-mode 1) 135 | ;; End: 136 | 137 | ;;; flymake-easy.el ends here 138 | -------------------------------------------------------------------------------- /marmalade-repo-test/packages/flymake-easy/0.5/flymake-easy-0.5.el: -------------------------------------------------------------------------------- 1 | 2 | ;;; flymake-easy.el --- Helpers for easily building flymake checkers 3 | 4 | ;; Copyright (C) 2012 Steve Purcell 5 | 6 | ;; Author: Steve Purcell 7 | ;; URL: https://github.com/purcell/flymake-easy 8 | ;; Version: 0.5 9 | ;; Keywords: convenience, internal 10 | 11 | ;; This program is free software; you can redistribute it and/or modify 12 | ;; it under the terms of the GNU General Public License as published by 13 | ;; the Free Software Foundation, either version 3 of the License, or 14 | ;; (at your option) any later version. 15 | 16 | ;; This program is distributed in the hope that it will be useful, 17 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | ;; GNU General Public License for more details. 20 | 21 | ;; You should have received a copy of the GNU General Public License 22 | ;; along with this program. If not, see . 23 | 24 | ;;; Commentary: 25 | 26 | ;; This library provides the `flymake-easy-load' helper function for 27 | ;; setting up flymake checkers. Just call that function with the 28 | ;; appropriate arguments in a major mode hook function. See 29 | ;; `flymake-ruby' for an example: 30 | ;; https://github.com/purcell/flymake-ruby 31 | 32 | ;;; Code: 33 | 34 | (require 'flymake) 35 | 36 | (defvar flymake-easy--active nil 37 | "Indicates when flymake-easy-load has successfully run in this buffer.") 38 | (defvar flymake-easy--command-fn nil 39 | "The user-specified function for building the flymake command.") 40 | (defvar flymake-easy--location nil 41 | "Where to create the temp file when checking, one of 'tempdir or 'inplace.") 42 | (defvar flymake-easy--extension nil 43 | "The canonical file name extension to use for the current file.") 44 | 45 | (mapc 'make-variable-buffer-local 46 | '(flymake-easy--active 47 | flymake-easy--command-fn 48 | flymake-easy--location 49 | flymake-easy--extension)) 50 | 51 | (defun flymake-easy--tempfile-in-temp-dir (file-name prefix) 52 | "Create a temporary file for storing the contents of FILE-NAME in the system tempdir. 53 | Argument PREFIX temp file prefix, supplied by flymake." 54 | (make-temp-file (or prefix "flymake-easy") nil flymake-easy--extension)) 55 | 56 | (defun flymake-easy--flymake-init () 57 | "A catch-all flymake init function for use in `flymake-allowed-file-name-masks'." 58 | (let* ((tempfile 59 | (flymake-init-create-temp-buffer-copy 60 | (cond 61 | ((eq 'tempdir flymake-easy--location) 62 | 'flymake-easy--tempfile-in-temp-dir) 63 | ((eq 'inplace flymake-easy--location) 64 | 'flymake-create-temp-inplace) 65 | (t 66 | (error "unknown location for flymake-easy: %s" flymake-easy--location))))) 67 | (command (funcall flymake-easy--command-fn tempfile))) 68 | (list (first command) (rest command)))) 69 | 70 | (defun flymake-easy-exclude-buffer-p () 71 | "Whether to skip flymake in the current buffer." 72 | (and (fboundp 'tramp-tramp-file-p) 73 | (buffer-file-name) 74 | (tramp-tramp-file-p (buffer-file-name)))) 75 | 76 | (defun flymake-easy-load (command-fn &optional err-line-patterns location extension warning-re) 77 | "Enable flymake in the containing buffer using a specific narrow configuration. 78 | Argument COMMAND-FN function called to build the 79 | command line to run (receives filename, returns list). 80 | Argument ERR-LINE-PATTERNS patterns for identifying errors (see `flymake-err-line-patterns'). 81 | Argument EXTENSION a canonical extension for this type of source file, e.g. \"rb\". 82 | Argument LOCATION where to create the temporary copy: one of 'tempdir (default) or 'inplace. 83 | Argument WARNING-RE a pattern which identifies error messages as warnings." 84 | (let ((executable (first (funcall command-fn "dummy")))) 85 | (if (executable-find executable) ;; TODO: defer this checking 86 | (unless (flymake-easy-exclude-buffer-p) 87 | (setq flymake-easy--command-fn command-fn 88 | flymake-easy--location (or location 'tempdir) 89 | flymake-easy--extension extension 90 | flymake-easy--active t) 91 | (set (make-local-variable 'flymake-allowed-file-name-masks) 92 | '(("." flymake-easy--flymake-init))) 93 | (when err-line-patterns 94 | (set (make-local-variable 'flymake-err-line-patterns) err-line-patterns)) 95 | (dolist (var '(flymake-warning-re 96 | flymake-warn-line-regexp)) 97 | (set (make-local-variable var) (or warning-re "^[wW]arn"))) 98 | (flymake-mode t)) 99 | (message "Not enabling flymake: '%s' command not found" executable)))) 100 | 101 | ;; Internal overrides for flymake 102 | 103 | (defun flymake-easy--find-all-matches (str) 104 | "Return all matched for error line patterns in STR. 105 | 106 | This is a judicious override for `flymake-split-output', enabled 107 | by the advice below, which allows for matching multi-line 108 | patterns." 109 | (let (matches 110 | (last-match-end-pos 0)) 111 | (dolist (pattern flymake-err-line-patterns) 112 | (let ((regex (car pattern)) 113 | (pos 0)) 114 | (while (string-match regex str pos) 115 | (push (match-string 0 str) matches) 116 | (setq pos (match-end 0))) 117 | (setf last-match-end-pos (max pos last-match-end-pos)))) 118 | (let ((residual (substring str last-match-end-pos))) 119 | (list matches 120 | (unless (string= "" residual) residual))))) 121 | 122 | (defadvice flymake-split-output (around flymake-easy--split-output (output) activate protect) 123 | "Override `flymake-split-output' to support mult-line error messages." 124 | (setq ad-return-value (if flymake-easy--active 125 | (flymake-easy--find-all-matches output) 126 | ad-do-it))) 127 | 128 | 129 | (defadvice flymake-post-syntax-check (before flymake-easy--force-check-was-interrupted activate) 130 | (when flymake-easy--active 131 | (setq flymake-check-was-interrupted t))) 132 | 133 | 134 | (provide 'flymake-easy) 135 | 136 | ;; Local Variables: 137 | ;; coding: utf-8 138 | ;; byte-compile-warnings: (not cl-functions) 139 | ;; eval: (checkdoc-minor-mode 1) 140 | ;; End: 141 | 142 | ;;; flymake-easy.el ends here 143 | -------------------------------------------------------------------------------- /marmalade-users.el: -------------------------------------------------------------------------------- 1 | ;;; marmalade-users.el --- user handling in marmalade 2 | 3 | ;; Copyright (C) 2014 Nic Ferrier 4 | 5 | ;; Author: Nic Ferrier 6 | ;; Keywords: processes 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Commentary: 22 | 23 | ;; 24 | 25 | ;;; Code: 26 | 27 | (require 'elnode) 28 | (require 'kv) 29 | (require 'base64) 30 | (require 'file-format) 31 | (require 'dash) 32 | 33 | ;;; UnVerifieds - stuff about users who haven't verified a password yet 34 | 35 | (defvar marmalade/unverifieds 36 | (db-make `(db-hash 37 | :filename 38 | ,(expand-file-name 39 | "marmalade-verifies-db" 40 | (or marmalade-db-dir marmalade-dir)))) 41 | "The database of verifications. 42 | 43 | Actually there should only be one key in this but we persist it 44 | over and over.") 45 | 46 | (defun marmalade/list-unverifieds () 47 | (db-get "unverified" marmalade/unverifieds)) 48 | 49 | (defun marmalade/add-unverified (username) 50 | (let ((code (format "%X" (random))) 51 | (existing (db-get "unverified" marmalade/unverifieds))) 52 | (db-put 53 | "unverified" 54 | (cons (cons code username) existing) 55 | marmalade/unverifieds) 56 | code)) 57 | 58 | (defun marmalade/remove-verified (verified) 59 | "Remove the specified VERIFIED code from the database." 60 | (db-put 61 | "unverified" 62 | (--filter 63 | (not (equal verified (car it))) 64 | (db-get "unverified" marmalade/unverifieds)) 65 | marmalade/unverifieds) 66 | (db-hash/save marmalade/unverifieds)) 67 | 68 | 69 | ;;; Users proper 70 | 71 | (defvar marmalade/users 72 | (db-make `(db-hash 73 | :filename 74 | ,(expand-file-name 75 | "marmalade-user-db" 76 | (or marmalade-db-dir marmalade-dir)))) 77 | "The user database. 78 | 79 | Keys in the records are: 80 | 81 | \"digest\" 82 | \"email\" 83 | \"name\" 84 | \"salt\" 85 | \"package-list\" 86 | \"token\" 87 | 88 | And they are stored in an alist.") 89 | 90 | (defun marmalade/user-hash (password salt) 91 | "Make the hash for the user. 92 | 93 | This is stored in the user record as \"digest\"." 94 | (base64-encode-string (sha1 (concat password salt) nil nil t))) 95 | 96 | 97 | (defconst marmalade/add-user-version 2 98 | "Version variable controlling marmalade user db format.") 99 | 100 | (defun marmalade-add-user (username password email &rest packages) 101 | "Add USERNAME to the database. 102 | 103 | Default their PACKAGES to the list." 104 | (case marmalade/add-user-version 105 | (1 106 | (db-put username 107 | `(("username" . ,username) 108 | ("token" . ,(elnode-auth-make-hash username password)) 109 | ("package-list" . ,packages)) 110 | marmalade/users)) 111 | (2-test ; same as 2 but no package list 112 | (db-put username 113 | ;; How to work out the salt? 114 | (let ((salt (shell-command-to-string "openssl rand -base64 32")) 115 | (token (replace-regexp-in-string 116 | "\n$" "" 117 | (shell-command-to-string "openssl rand -base64 32")))) 118 | `(("digest" . ,(marmalade/user-hash password salt)) 119 | ("email" . ,email) 120 | ("name" . ,username) 121 | ("salt" . ,salt) 122 | ("token" . ,token))) 123 | marmalade/users)) 124 | (2 125 | (db-put username 126 | ;; How to work out the salt? 127 | (let ((salt (shell-command-to-string "openssl rand -base64 32")) 128 | (token (replace-regexp-in-string 129 | "\n$" "" 130 | (shell-command-to-string "openssl rand -base64 32")))) 131 | `(("digest" . ,(marmalade/user-hash password salt)) 132 | ("email" . ,email) 133 | ("name" . ,username) 134 | ("salt" . ,salt) 135 | ("package-list" . ,packages) 136 | ("token" . ,token))) 137 | marmalade/users)))) 138 | 139 | (defun marmalade-set-auth (username password) 140 | "Set the authentication tokens for USERNAME based on PASSWORD." 141 | (let* ((user (db-get username marmalade/users)) 142 | (salt (kva "salt" user))) 143 | (setf (cdr (assoc "digest" user)) (marmalade/user-hash password salt)) 144 | (db-hash/save marmalade/users))) 145 | 146 | (defun marmalade-add-packages (username &rest packages) 147 | "Add PACKAGES to USERNAME in the user database." 148 | (let* ((record (db-get username marmalade/users)) 149 | (rec-packages (assoc "package-list" record))) 150 | (cond 151 | ((not rec-packages) 152 | (setcdr (last record) (list (cons "package-list" packages)))) 153 | ((not (cdr rec-packages)) 154 | (setcdr rec-packages packages)) 155 | (t 156 | (setcdr rec-packages (-uniq (append (cdr rec-packages) packages))))) 157 | (db-hash/save marmalade/users) 158 | record)) 159 | 160 | (defun marmalade-rm-packages (username &rest packages) 161 | "Remove PACKAGES from USERNAME in the user database." 162 | (let* ((record (db-get username marmalade/users)) 163 | (rec-packages (assoc "package-list" record))) 164 | ;; MUTATIVE - meh 165 | (when (cdr rec-packages) 166 | (setcdr rec-packages 167 | (--filter (not (member it packages)) 168 | (cdr rec-packages)))) 169 | (db-hash/save marmalade/users) 170 | record)) 171 | 172 | (defun marmalade-get-packages (username) 173 | "Return the list of packages editable by USERNAME." 174 | (-sort 175 | 'string< 176 | (kva "package-list" (db-get username marmalade/users)))) 177 | 178 | (provide 'marmalade-users) 179 | 180 | ;;; marmalade-users.el ends here 181 | -------------------------------------------------------------------------------- /marmalade-repo-test/packages/flymake-easy/0.7/flymake-easy-0.7.el: -------------------------------------------------------------------------------- 1 | 2 | ;;; flymake-easy.el --- Helpers for easily building flymake checkers 3 | 4 | ;; Copyright (C) 2012 Steve Purcell 5 | 6 | ;; Author: Steve Purcell 7 | ;; URL: https://github.com/purcell/flymake-easy 8 | ;; Version: 0.7 9 | ;; Keywords: convenience, internal 10 | 11 | ;; This program is free software; you can redistribute it and/or modify 12 | ;; it under the terms of the GNU General Public License as published by 13 | ;; the Free Software Foundation, either version 3 of the License, or 14 | ;; (at your option) any later version. 15 | 16 | ;; This program is distributed in the hope that it will be useful, 17 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | ;; GNU General Public License for more details. 20 | 21 | ;; You should have received a copy of the GNU General Public License 22 | ;; along with this program. If not, see . 23 | 24 | ;;; Commentary: 25 | 26 | ;; This library provides the `flymake-easy-load' helper function for 27 | ;; setting up flymake checkers. Just call that function with the 28 | ;; appropriate arguments in a major mode hook function. See 29 | ;; `flymake-ruby' for an example: 30 | ;; https://github.com/purcell/flymake-ruby 31 | 32 | ;;; Code: 33 | 34 | (require 'flymake) 35 | 36 | (defvar flymake-easy--active nil 37 | "Indicates when flymake-easy-load has successfully run in this buffer.") 38 | (defvar flymake-easy--command-fn nil 39 | "The user-specified function for building the flymake command.") 40 | (defvar flymake-easy--location nil 41 | "Where to create the temp file when checking, one of 'tempdir or 'inplace.") 42 | (defvar flymake-easy--extension nil 43 | "The canonical file name extension to use for the current file.") 44 | 45 | (mapc 'make-variable-buffer-local 46 | '(flymake-easy--active 47 | flymake-easy--command-fn 48 | flymake-easy--location 49 | flymake-easy--extension)) 50 | 51 | (defun flymake-easy--tempfile-in-temp-dir (file-name prefix) 52 | "Create a temporary file for storing the contents of FILE-NAME in the system tempdir. 53 | Argument PREFIX temp file prefix, supplied by flymake." 54 | (make-temp-file (or prefix "flymake-easy") nil flymake-easy--extension)) 55 | 56 | (defun flymake-easy--flymake-init () 57 | "A catch-all flymake init function for use in `flymake-allowed-file-name-masks'." 58 | (let* ((tempfile 59 | (flymake-init-create-temp-buffer-copy 60 | (cond 61 | ((eq 'tempdir flymake-easy--location) 62 | 'flymake-easy--tempfile-in-temp-dir) 63 | ((eq 'inplace flymake-easy--location) 64 | 'flymake-create-temp-inplace) 65 | (t 66 | (error "unknown location for flymake-easy: %s" flymake-easy--location))))) 67 | (command (funcall flymake-easy--command-fn tempfile))) 68 | (list (car command) (cdr command)))) 69 | 70 | (defun flymake-easy-exclude-buffer-p () 71 | "Whether to skip flymake in the current buffer." 72 | (and (fboundp 'tramp-tramp-file-p) 73 | (buffer-file-name) 74 | (tramp-tramp-file-p (buffer-file-name)))) 75 | 76 | (defun flymake-easy-load (command-fn &optional err-line-patterns location extension warning-re info-re) 77 | "Enable flymake in the containing buffer using a specific narrow configuration. 78 | Argument COMMAND-FN function called to build the 79 | command line to run (receives filename, returns list). 80 | Argument ERR-LINE-PATTERNS patterns for identifying errors (see `flymake-err-line-patterns'). 81 | Argument EXTENSION a canonical extension for this type of source file, e.g. \"rb\". 82 | Argument LOCATION where to create the temporary copy: one of 'tempdir (default) or 'inplace. 83 | Argument WARNING-RE a pattern which identifies error messages as warnings. 84 | Argument INFO-RE a pattern which identifies messages as infos (supported only 85 | by the flymake fork at https://github.com/illusori/emacs-flymake)." 86 | (let ((executable (first (funcall command-fn "dummy")))) 87 | (if (executable-find executable) ;; TODO: defer this checking 88 | (unless (flymake-easy-exclude-buffer-p) 89 | (setq flymake-easy--command-fn command-fn 90 | flymake-easy--location (or location 'tempdir) 91 | flymake-easy--extension extension 92 | flymake-easy--active t) 93 | (set (make-local-variable 'flymake-allowed-file-name-masks) 94 | '(("." flymake-easy--flymake-init))) 95 | (when err-line-patterns 96 | (set (make-local-variable 'flymake-err-line-patterns) err-line-patterns)) 97 | (dolist (var '(flymake-warning-re flymake-warn-line-regexp)) 98 | (set (make-local-variable var) (or warning-re "^[wW]arn"))) 99 | (when (boundp 'flymake-info-line-regexp) 100 | (set (make-local-variable 'flymake-info-line-regexp) 101 | (or info-re "^[iI]nfo"))) 102 | (flymake-mode t)) 103 | (message "Not enabling flymake: '%s' command not found" executable)))) 104 | 105 | ;; Internal overrides for flymake 106 | 107 | (defun flymake-easy--find-all-matches (str) 108 | "Return all matched for error line patterns in STR. 109 | 110 | This is a judicious override for `flymake-split-output', enabled 111 | by the advice below, which allows for matching multi-line 112 | patterns." 113 | (let (matches 114 | (last-match-end-pos 0)) 115 | (dolist (pattern flymake-err-line-patterns) 116 | (let ((regex (car pattern)) 117 | (pos 0)) 118 | (while (string-match regex str pos) 119 | (push (match-string 0 str) matches) 120 | (setq pos (match-end 0))) 121 | (setf last-match-end-pos (max pos last-match-end-pos)))) 122 | (let ((residual (substring str last-match-end-pos))) 123 | (list matches 124 | (unless (string= "" residual) residual))))) 125 | 126 | (defadvice flymake-split-output (around flymake-easy--split-output (output) activate protect) 127 | "Override `flymake-split-output' to support mult-line error messages." 128 | (setq ad-return-value (if flymake-easy--active 129 | (flymake-easy--find-all-matches output) 130 | ad-do-it))) 131 | 132 | 133 | (defadvice flymake-post-syntax-check (before flymake-easy--force-check-was-interrupted activate) 134 | (when flymake-easy--active 135 | (setq flymake-check-was-interrupted t))) 136 | 137 | 138 | (provide 'flymake-easy) 139 | 140 | ;; Local Variables: 141 | ;; coding: utf-8 142 | ;; byte-compile-warnings: (not cl-functions) 143 | ;; eval: (checkdoc-minor-mode 1) 144 | ;; End: 145 | 146 | ;;; flymake-easy.el ends here 147 | -------------------------------------------------------------------------------- /marmalade-repo-test/packages/flymake-easy/0.6/flymake-easy-0.6.el: -------------------------------------------------------------------------------- 1 | 2 | ;;; flymake-easy.el --- Helpers for easily building flymake checkers 3 | 4 | ;; Copyright (C) 2012 Steve Purcell 5 | 6 | ;; Author: Steve Purcell 7 | ;; URL: https://github.com/purcell/flymake-easy 8 | ;; Version: 0.6 9 | ;; Keywords: convenience, internal 10 | 11 | ;; This program is free software; you can redistribute it and/or modify 12 | ;; it under the terms of the GNU General Public License as published by 13 | ;; the Free Software Foundation, either version 3 of the License, or 14 | ;; (at your option) any later version. 15 | 16 | ;; This program is distributed in the hope that it will be useful, 17 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | ;; GNU General Public License for more details. 20 | 21 | ;; You should have received a copy of the GNU General Public License 22 | ;; along with this program. If not, see . 23 | 24 | ;;; Commentary: 25 | 26 | ;; This library provides the `flymake-easy-load' helper function for 27 | ;; setting up flymake checkers. Just call that function with the 28 | ;; appropriate arguments in a major mode hook function. See 29 | ;; `flymake-ruby' for an example: 30 | ;; https://github.com/purcell/flymake-ruby 31 | 32 | ;;; Code: 33 | 34 | (require 'flymake) 35 | 36 | (defvar flymake-easy--active nil 37 | "Indicates when flymake-easy-load has successfully run in this buffer.") 38 | (defvar flymake-easy--command-fn nil 39 | "The user-specified function for building the flymake command.") 40 | (defvar flymake-easy--location nil 41 | "Where to create the temp file when checking, one of 'tempdir or 'inplace.") 42 | (defvar flymake-easy--extension nil 43 | "The canonical file name extension to use for the current file.") 44 | 45 | (mapc 'make-variable-buffer-local 46 | '(flymake-easy--active 47 | flymake-easy--command-fn 48 | flymake-easy--location 49 | flymake-easy--extension)) 50 | 51 | (defun flymake-easy--tempfile-in-temp-dir (file-name prefix) 52 | "Create a temporary file for storing the contents of FILE-NAME in the system tempdir. 53 | Argument PREFIX temp file prefix, supplied by flymake." 54 | (make-temp-file (or prefix "flymake-easy") nil flymake-easy--extension)) 55 | 56 | (defun flymake-easy--flymake-init () 57 | "A catch-all flymake init function for use in `flymake-allowed-file-name-masks'." 58 | (let* ((tempfile 59 | (flymake-init-create-temp-buffer-copy 60 | (cond 61 | ((eq 'tempdir flymake-easy--location) 62 | 'flymake-easy--tempfile-in-temp-dir) 63 | ((eq 'inplace flymake-easy--location) 64 | 'flymake-create-temp-inplace) 65 | (t 66 | (error "unknown location for flymake-easy: %s" flymake-easy--location))))) 67 | (command (funcall flymake-easy--command-fn tempfile))) 68 | (list (car command) (cdr command)))) 69 | 70 | (defun flymake-easy-exclude-buffer-p () 71 | "Whether to skip flymake in the current buffer." 72 | (and (fboundp 'tramp-tramp-file-p) 73 | (buffer-file-name) 74 | (tramp-tramp-file-p (buffer-file-name)))) 75 | 76 | (defun flymake-easy-load (command-fn &optional err-line-patterns location extension warning-re info-re) 77 | "Enable flymake in the containing buffer using a specific narrow configuration. 78 | Argument COMMAND-FN function called to build the 79 | command line to run (receives filename, returns list). 80 | Argument ERR-LINE-PATTERNS patterns for identifying errors (see `flymake-err-line-patterns'). 81 | Argument EXTENSION a canonical extension for this type of source file, e.g. \"rb\". 82 | Argument LOCATION where to create the temporary copy: one of 'tempdir (default) or 'inplace. 83 | Argument WARNING-RE a pattern which identifies error messages as warnings. 84 | Argument INFO-RE a pattern which identifies messages as infos (supported only 85 | by the flymake fork at https://github.com/illusori/emacs-flymake)." 86 | (let ((executable (first (funcall command-fn "dummy")))) 87 | (if (executable-find executable) ;; TODO: defer this checking 88 | (unless (flymake-easy-exclude-buffer-p) 89 | (setq flymake-easy--command-fn command-fn 90 | flymake-easy--location (or location 'tempdir) 91 | flymake-easy--extension extension 92 | flymake-easy--active t) 93 | (set (make-local-variable 'flymake-allowed-file-name-masks) 94 | '(("." flymake-easy--flymake-init))) 95 | (when err-line-patterns 96 | (set (make-local-variable 'flymake-err-line-patterns) err-line-patterns)) 97 | (dolist (var '(flymake-warning-re flymake-warn-line-regexp)) 98 | (set (make-local-variable var) (or warning-re "^[wW]arn"))) 99 | (when (boundp 'flymake-info-re) 100 | (dolist (var '(flymake-info-re flymake-info-line-regexp)) 101 | (set (make-local-variable var) (or info-re "^[iI]nfo")))) 102 | (flymake-mode t)) 103 | (message "Not enabling flymake: '%s' command not found" executable)))) 104 | 105 | ;; Internal overrides for flymake 106 | 107 | (defun flymake-easy--find-all-matches (str) 108 | "Return all matched for error line patterns in STR. 109 | 110 | This is a judicious override for `flymake-split-output', enabled 111 | by the advice below, which allows for matching multi-line 112 | patterns." 113 | (let (matches 114 | (last-match-end-pos 0)) 115 | (dolist (pattern flymake-err-line-patterns) 116 | (let ((regex (car pattern)) 117 | (pos 0)) 118 | (while (string-match regex str pos) 119 | (push (match-string 0 str) matches) 120 | (setq pos (match-end 0))) 121 | (setf last-match-end-pos (max pos last-match-end-pos)))) 122 | (let ((residual (substring str last-match-end-pos))) 123 | (list matches 124 | (unless (string= "" residual) residual))))) 125 | 126 | (defadvice flymake-split-output (around flymake-easy--split-output (output) activate protect) 127 | "Override `flymake-split-output' to support mult-line error messages." 128 | (setq ad-return-value (if flymake-easy--active 129 | (flymake-easy--find-all-matches output) 130 | ad-do-it))) 131 | 132 | 133 | (defadvice flymake-post-syntax-check (before flymake-easy--force-check-was-interrupted activate) 134 | (when flymake-easy--active 135 | (setq flymake-check-was-interrupted t))) 136 | 137 | 138 | (provide 'flymake-easy) 139 | 140 | ;; Local Variables: 141 | ;; coding: utf-8 142 | ;; byte-compile-warnings: (not cl-functions) 143 | ;; eval: (checkdoc-minor-mode 1) 144 | ;; End: 145 | 146 | ;;; flymake-easy.el ends here 147 | -------------------------------------------------------------------------------- /marmalade-repo-test/packages/elixir-mix/0.0.1/elixir-mix-0.0.1.el: -------------------------------------------------------------------------------- 1 | ;;; elixir-mix.el --- Emacs integration for Elixir's elixir-mix 2 | ;; 3 | ;; Filename: elixir-mix.el 4 | ;; Description: Integration of Elixir's building and deployment tool: mix into Emacs. 5 | ;; Author: Samuel Tonini 6 | ;; Maintainer: Samuel Tonini 7 | ;; Created: So Jun 9 10:01:02 2013 (+0200) 8 | ;; Version: 0.0.1 9 | ;; URL: http://github.com/tonini/elixir-mix.el 10 | ;; Keywords: elixir, mix, elixir-mix 11 | 12 | ;; This program is free software; you can redistribute it and/or 13 | ;; modify it under the terms of the GNU General Public License as 14 | ;; published by the Free Software Foundation; either version 3, or 15 | ;; (at your option) any later version. 16 | ;; 17 | ;; This program is distributed in the hope that it will be useful, 18 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | ;; General Public License for more details. 21 | ;; 22 | ;; You should have received a copy of the GNU General Public License 23 | ;; along with this program; see the file COPYING. If not, write to 24 | ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth 25 | ;; Floor, Boston, MA 02110-1301, USA. 26 | 27 | ;;; Commentary: 28 | ;; 29 | ;; Basic steps to setup: 30 | ;; 31 | ;; (add-to-list 'load-path "~/path/to/elixir-mix.el/") 32 | ;; (require 'elixir-mix) 33 | ;; (global-elixir-mix-mode) 34 | ;; 35 | ;; Interesting variables are: 36 | ;; 37 | ;; `elixir-mix-command` 38 | ;; 39 | ;; Path to the executable command 40 | ;; 41 | ;; 42 | ;; `elixir-mix-buffer-name` 43 | ;; 44 | ;; Name for the buffer used for mix shell output. 45 | ;; 46 | ;; Major commands are: 47 | ;; 48 | ;; M-x elixir-mix-new 49 | ;; 50 | ;; Create a new Elixir application. 51 | ;; 52 | ;; M-x elixir-mix-test 53 | ;; 54 | ;; Run the whole Elixir application test suite. 55 | ;; 56 | ;; M-x elixir-mix-test-this-buffer 57 | ;; 58 | ;; Run the current buffer through command. 59 | ;; 60 | ;; M-x elixir-mix-compile 61 | ;; 62 | ;; Compile the whole Elixir application. 63 | ;; 64 | ;; M-x elixir-mix-run 65 | ;; 66 | ;; Runs the given expression in the Elixir application context. 67 | ;; 68 | ;; M-x elixir-mix-help 69 | ;; 70 | ;; Show help output for a specific mix command. 71 | ;; 72 | ;; M-x elixir-mix-execute 73 | ;; 74 | ;; Run any command in the context of the application, 75 | ;; except `help` and `new`. 76 | ;; Just run any command as you like, including arguments 77 | ;; for the specific command. (example: test --quick) 78 | ;; 79 | 80 | ;;; Code: 81 | 82 | (defcustom elixir-mix-command "mix" 83 | "The shell command for mix" 84 | :type 'string 85 | :group 'elixir-mix) 86 | 87 | (defvar elixir-mix-buffer-name "*MIX*" 88 | "Name of the mix output buffer.") 89 | 90 | (defvar elixir-mix--elixir-project-root-indicators 91 | '("mix.exs" "mix.lock" ".git") 92 | "List of files and directories which indicate a elixir project root.") 93 | 94 | (defun elixir-mix--elixir-project-root-directory-p (a-directory) 95 | "Returns t if a-directory is the elixir project root" 96 | (equal a-directory (file-name-directory (directory-file-name a-directory)))) 97 | 98 | (defun elixir-mix--elixir-project-root (&optional directory) 99 | "Finds the root directory of the project by walking the 100 | directory tree until it finds a elixir project root indicator." 101 | (let* ((directory (file-name-as-directory (or directory (expand-file-name default-directory)))) 102 | (present-files (directory-files directory))) 103 | (cond ((elixir-mix--elixir-project-root-directory-p directory) nil) 104 | ((> (length (intersection present-files elixir-mix--elixir-project-root-indicators :test 'string=)) 0) directory) 105 | (t (elixir-mix--elixir-project-root (file-name-directory (directory-file-name directory))))))) 106 | 107 | (defun elixir-mix--get-buffer (name) 108 | "Get and kills a buffer if exists and returns a new one." 109 | (let ((buffer (get-buffer name))) 110 | (when buffer (kill-buffer buffer)) 111 | (generate-new-buffer name))) 112 | 113 | (defun elixir-mix--buffer-setup (buffer) 114 | "Setup the mix buffer before display." 115 | (display-buffer buffer) 116 | (with-current-buffer buffer 117 | (setq buffer-read-only t) 118 | (local-set-key "q" 'quit-window))) 119 | 120 | (defun elixir-mix--run-command-async (command) 121 | (let ((buffer (elixir-mix--get-buffer elixir-mix-buffer-name))) 122 | (async-shell-command (format "%s %s" elixir-mix-command command) buffer) 123 | (elixir-mix--buffer-setup buffer))) 124 | 125 | (defun elixir-mix-new (name) 126 | "Create a new elixir project with mix." 127 | (interactive "Gmix new: ") 128 | (elixir-mix--run-command-async (format "new %s" name))) 129 | 130 | (defun elixir-mix-test () 131 | "Run the whole elixir test suite." 132 | (interactive) 133 | (elixir-mix-execute "test")) 134 | 135 | (defun elixir-mix-test-this-buffer () 136 | "Run the current buffer through mix test." 137 | (interactive) 138 | (elixir-mix-execute (format "test %s" buffer-file-name))) 139 | 140 | (defun elixir-mix-compile () 141 | "Compile the whole elixir project." 142 | (interactive) 143 | (elixir-mix-execute "compile")) 144 | 145 | (defun elixir-mix-run (code) 146 | "Runs the given expression in the elixir application context." 147 | (interactive "Mmix run: ") 148 | (elixir-mix-execute (format "run '%s'" code))) 149 | 150 | (defun elixir-mix-help (command) 151 | "Show help output for a specific mix command." 152 | (interactive "Mmix help: ") 153 | (elixir-mix--run-command-async (format "help %s" command))) 154 | 155 | (defun elixir-mix-execute (command) 156 | "Run a mix command." 157 | (interactive "Mmix: ") 158 | (cond ((string= command "") (error "There is no such command.")) 159 | ((string-match "^new" command) 160 | (error "Please use the `elixir-mix-new (name)` function to create a new elixir project.")) 161 | ((string-match "^help" command) 162 | (error "Please use the `elixir-mix-help (command)` function to get a mix command specific help."))) 163 | (let ((project-root (elixir-mix--elixir-project-root))) 164 | (when (not project-root) (error "Couldn't find any elixir project root.")) 165 | (setq default-directory (elixir-mix--elixir-project-root)) 166 | (elixir-mix--run-command-async command))) 167 | 168 | ;;;###autoload 169 | (define-minor-mode global-elixir-mix-mode 170 | "Toggle global-elixir-mix-mode to use elixir's mix build tool within emacs." 171 | :global t) 172 | 173 | (provide 'elixir-mix) 174 | 175 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 176 | ;;; elixir-mix.el ends here 177 | -------------------------------------------------------------------------------- /marmalade-repo-test/packages/flymake-easy/0.8/flymake-easy-0.8.el: -------------------------------------------------------------------------------- 1 | 2 | ;;; flymake-easy.el --- Helpers for easily building flymake checkers 3 | 4 | ;; Copyright (C) 2012 Steve Purcell 5 | 6 | ;; Author: Steve Purcell 7 | ;; URL: https://github.com/purcell/flymake-easy 8 | ;; Version: 0.8 9 | ;; Keywords: convenience, internal 10 | 11 | ;; This program is free software; you can redistribute it and/or modify 12 | ;; it under the terms of the GNU General Public License as published by 13 | ;; the Free Software Foundation, either version 3 of the License, or 14 | ;; (at your option) any later version. 15 | 16 | ;; This program is distributed in the hope that it will be useful, 17 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | ;; GNU General Public License for more details. 20 | 21 | ;; You should have received a copy of the GNU General Public License 22 | ;; along with this program. If not, see . 23 | 24 | ;;; Commentary: 25 | 26 | ;; This library provides the `flymake-easy-load' helper function for 27 | ;; setting up flymake checkers. Just call that function with the 28 | ;; appropriate arguments in a major mode hook function. See 29 | ;; `flymake-ruby' for an example: 30 | ;; https://github.com/purcell/flymake-ruby 31 | 32 | ;;; Code: 33 | 34 | (require 'flymake) 35 | 36 | (defvar flymake-easy--active nil 37 | "Indicates when flymake-easy-load has successfully run in this buffer.") 38 | (defvar flymake-easy--command-fn nil 39 | "The user-specified function for building the flymake command.") 40 | (defvar flymake-easy--location nil 41 | "Where to create the temp file when checking, one of 'tempdir or 'inplace.") 42 | (defvar flymake-easy--extension nil 43 | "The canonical file name extension to use for the current file.") 44 | 45 | (mapc 'make-variable-buffer-local 46 | '(flymake-easy--active 47 | flymake-easy--command-fn 48 | flymake-easy--location 49 | flymake-easy--extension)) 50 | 51 | (defun flymake-easy--tempfile-in-temp-dir (file-name prefix) 52 | "Create a temporary file for storing the contents of FILE-NAME in the system tempdir. 53 | Argument PREFIX temp file prefix, supplied by flymake." 54 | (make-temp-file (or prefix "flymake-easy") 55 | nil 56 | (concat "." flymake-easy--extension))) 57 | 58 | (defun flymake-easy--flymake-init () 59 | "A catch-all flymake init function for use in `flymake-allowed-file-name-masks'." 60 | (let* ((tempfile 61 | (flymake-init-create-temp-buffer-copy 62 | (cond 63 | ((eq 'tempdir flymake-easy--location) 64 | 'flymake-easy--tempfile-in-temp-dir) 65 | ((eq 'inplace flymake-easy--location) 66 | 'flymake-create-temp-inplace) 67 | (t 68 | (error "unknown location for flymake-easy: %s" flymake-easy--location))))) 69 | (command (funcall flymake-easy--command-fn tempfile))) 70 | (list (car command) (cdr command)))) 71 | 72 | (defun flymake-easy-exclude-buffer-p () 73 | "Whether to skip flymake in the current buffer." 74 | (and (fboundp 'tramp-tramp-file-p) 75 | (buffer-file-name) 76 | (tramp-tramp-file-p (buffer-file-name)))) 77 | 78 | (defun flymake-easy-load (command-fn &optional err-line-patterns location extension warning-re info-re) 79 | "Enable flymake in the containing buffer using a specific narrow configuration. 80 | Argument COMMAND-FN function called to build the 81 | command line to run (receives filename, returns list). 82 | Argument ERR-LINE-PATTERNS patterns for identifying errors (see `flymake-err-line-patterns'). 83 | Argument EXTENSION a canonical extension for this type of source file, e.g. \"rb\". 84 | Argument LOCATION where to create the temporary copy: one of 'tempdir (default) or 'inplace. 85 | Argument WARNING-RE a pattern which identifies error messages as warnings. 86 | Argument INFO-RE a pattern which identifies messages as infos (supported only 87 | by the flymake fork at https://github.com/illusori/emacs-flymake)." 88 | (let ((executable (first (funcall command-fn "dummy")))) 89 | (if (executable-find executable) ;; TODO: defer this checking 90 | (unless (flymake-easy-exclude-buffer-p) 91 | (setq flymake-easy--command-fn command-fn 92 | flymake-easy--location (or location 'tempdir) 93 | flymake-easy--extension extension 94 | flymake-easy--active t) 95 | (set (make-local-variable 'flymake-allowed-file-name-masks) 96 | '(("." flymake-easy--flymake-init))) 97 | (when err-line-patterns 98 | (set (make-local-variable 'flymake-err-line-patterns) err-line-patterns)) 99 | (dolist (var '(flymake-warning-re flymake-warn-line-regexp)) 100 | (set (make-local-variable var) (or warning-re "^[wW]arn"))) 101 | (when (boundp 'flymake-info-line-regexp) 102 | (set (make-local-variable 'flymake-info-line-regexp) 103 | (or info-re "^[iI]nfo"))) 104 | (flymake-mode t)) 105 | (message "Not enabling flymake: '%s' program not found" executable)))) 106 | 107 | ;; Internal overrides for flymake 108 | 109 | (defun flymake-easy--find-all-matches (str) 110 | "Return all matched for error line patterns in STR. 111 | 112 | This is a judicious override for `flymake-split-output', enabled 113 | by the advice below, which allows for matching multi-line 114 | patterns." 115 | (let (matches 116 | (last-match-end-pos 0)) 117 | (dolist (pattern flymake-err-line-patterns) 118 | (let ((regex (car pattern)) 119 | (pos 0)) 120 | (while (string-match regex str pos) 121 | (push (match-string 0 str) matches) 122 | (setq pos (match-end 0))) 123 | (setf last-match-end-pos (max pos last-match-end-pos)))) 124 | (let ((residual (substring str last-match-end-pos))) 125 | (list matches 126 | (unless (string= "" residual) residual))))) 127 | 128 | (defadvice flymake-split-output (around flymake-easy--split-output (output) activate protect) 129 | "Override `flymake-split-output' to support mult-line error messages." 130 | (setq ad-return-value (if flymake-easy--active 131 | (flymake-easy--find-all-matches output) 132 | ad-do-it))) 133 | 134 | 135 | (defadvice flymake-post-syntax-check (before flymake-easy--force-check-was-interrupted activate) 136 | (when flymake-easy--active 137 | (setq flymake-check-was-interrupted t))) 138 | 139 | 140 | (provide 'flymake-easy) 141 | 142 | ;; Local Variables: 143 | ;; coding: utf-8 144 | ;; byte-compile-warnings: (not cl-functions) 145 | ;; eval: (checkdoc-minor-mode 1) 146 | ;; End: 147 | 148 | ;;; flymake-easy.el ends here 149 | -------------------------------------------------------------------------------- /marmalade-repo-test/packages/flymake-easy/0.9/flymake-easy-0.9.el: -------------------------------------------------------------------------------- 1 | 2 | ;;; flymake-easy.el --- Helpers for easily building flymake checkers 3 | 4 | ;; Copyright (C) 2012 Steve Purcell 5 | 6 | ;; Author: Steve Purcell 7 | ;; URL: https://github.com/purcell/flymake-easy 8 | ;; Version: 0.9 9 | ;; Keywords: convenience, internal 10 | 11 | ;; This program is free software; you can redistribute it and/or modify 12 | ;; it under the terms of the GNU General Public License as published by 13 | ;; the Free Software Foundation, either version 3 of the License, or 14 | ;; (at your option) any later version. 15 | 16 | ;; This program is distributed in the hope that it will be useful, 17 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | ;; GNU General Public License for more details. 20 | 21 | ;; You should have received a copy of the GNU General Public License 22 | ;; along with this program. If not, see . 23 | 24 | ;;; Commentary: 25 | 26 | ;; This library provides the `flymake-easy-load' helper function for 27 | ;; setting up flymake checkers. Just call that function with the 28 | ;; appropriate arguments in a major mode hook function. See 29 | ;; `flymake-ruby' for an example: 30 | ;; https://github.com/purcell/flymake-ruby 31 | 32 | ;;; Code: 33 | 34 | (require 'flymake) 35 | 36 | (defvar flymake-easy--active nil 37 | "Indicates when flymake-easy-load has successfully run in this buffer.") 38 | (defvar flymake-easy--command-fn nil 39 | "The user-specified function for building the flymake command.") 40 | (defvar flymake-easy--location nil 41 | "Where to create the temp file when checking, one of 'tempdir or 'inplace.") 42 | (defvar flymake-easy--extension nil 43 | "The canonical file name extension to use for the current file.") 44 | 45 | (mapc 'make-variable-buffer-local 46 | '(flymake-easy--active 47 | flymake-easy--command-fn 48 | flymake-easy--location 49 | flymake-easy--extension)) 50 | 51 | (defun flymake-easy--tempfile-in-temp-dir (file-name prefix) 52 | "Create a temporary file for storing the contents of FILE-NAME in the system tempdir. 53 | Argument PREFIX temp file prefix, supplied by flymake." 54 | (make-temp-file (or prefix "flymake-easy") 55 | nil 56 | (concat "." flymake-easy--extension))) 57 | 58 | (defun flymake-easy--flymake-init () 59 | "A catch-all flymake init function for use in `flymake-allowed-file-name-masks'." 60 | (let* ((tempfile 61 | (flymake-init-create-temp-buffer-copy 62 | (cond 63 | ((eq 'tempdir flymake-easy--location) 64 | 'flymake-easy--tempfile-in-temp-dir) 65 | ((eq 'inplace flymake-easy--location) 66 | 'flymake-create-temp-inplace) 67 | (t 68 | (error "unknown location for flymake-easy: %s" flymake-easy--location))))) 69 | (command (funcall flymake-easy--command-fn tempfile))) 70 | (list (car command) (cdr command)))) 71 | 72 | (defun flymake-easy-exclude-buffer-p () 73 | "Whether to skip flymake in the current buffer." 74 | (and (fboundp 'tramp-tramp-file-p) 75 | (buffer-file-name) 76 | (tramp-tramp-file-p (buffer-file-name)))) 77 | 78 | (defun flymake-easy-load (command-fn &optional err-line-patterns location extension warning-re info-re) 79 | "Enable flymake in the containing buffer using a specific narrow configuration. 80 | Argument COMMAND-FN function called to build the 81 | command line to run (receives filename, returns list). 82 | Argument ERR-LINE-PATTERNS patterns for identifying errors (see `flymake-err-line-patterns'). 83 | Argument EXTENSION a canonical extension for this type of source file, e.g. \"rb\". 84 | Argument LOCATION where to create the temporary copy: one of 'tempdir (default) or 'inplace. 85 | Argument WARNING-RE a pattern which identifies error messages as warnings. 86 | Argument INFO-RE a pattern which identifies messages as infos (supported only 87 | by the flymake fork at https://github.com/illusori/emacs-flymake)." 88 | (let ((executable (car (funcall command-fn "dummy")))) 89 | (if (executable-find executable) ;; TODO: defer this checking 90 | (unless (flymake-easy-exclude-buffer-p) 91 | (setq flymake-easy--command-fn command-fn 92 | flymake-easy--location (or location 'tempdir) 93 | flymake-easy--extension extension 94 | flymake-easy--active t) 95 | (set (make-local-variable 'flymake-allowed-file-name-masks) 96 | '(("." flymake-easy--flymake-init))) 97 | (when err-line-patterns 98 | (set (make-local-variable 'flymake-err-line-patterns) err-line-patterns)) 99 | (dolist (var '(flymake-warning-re flymake-warn-line-regexp)) 100 | (set (make-local-variable var) (or warning-re "^[wW]arn"))) 101 | (when (boundp 'flymake-info-line-regexp) 102 | (set (make-local-variable 'flymake-info-line-regexp) 103 | (or info-re "^[iI]nfo"))) 104 | (flymake-mode t)) 105 | (message "Not enabling flymake: '%s' program not found" executable)))) 106 | 107 | ;; Internal overrides for flymake 108 | 109 | (defun flymake-easy--find-all-matches (str) 110 | "Return every match for `flymake-err-line-patterns' in STR. 111 | 112 | This is a judicious override for `flymake-split-output', enabled 113 | by the advice below, which allows for matching multi-line 114 | patterns." 115 | (let (matches 116 | (last-match-end-pos 0)) 117 | (dolist (pattern flymake-err-line-patterns) 118 | (let ((regex (car pattern)) 119 | (pos 0)) 120 | (while (string-match regex str pos) 121 | (push (match-string 0 str) matches) 122 | (setq pos (match-end 0))) 123 | (setq last-match-end-pos (max pos last-match-end-pos)))) 124 | (let ((residual (substring str last-match-end-pos))) 125 | (list matches 126 | (unless (string= "" residual) residual))))) 127 | 128 | (defadvice flymake-split-output (around flymake-easy--split-output (output) activate protect) 129 | "Override `flymake-split-output' to support mult-line error messages." 130 | (setq ad-return-value (if flymake-easy--active 131 | (flymake-easy--find-all-matches output) 132 | ad-do-it))) 133 | 134 | 135 | (defadvice flymake-post-syntax-check (before flymake-easy--force-check-was-interrupted activate) 136 | (when flymake-easy--active 137 | (setq flymake-check-was-interrupted t))) 138 | 139 | 140 | (provide 'flymake-easy) 141 | 142 | ;; Local Variables: 143 | ;; coding: utf-8 144 | ;; byte-compile-warnings: (not cl-functions) 145 | ;; eval: (checkdoc-minor-mode 1) 146 | ;; End: 147 | 148 | ;;; flymake-easy.el ends here 149 | -------------------------------------------------------------------------------- /marmalade-repo-test/packages/less-css-mode/0.4/less-css-mode-0.4.el: -------------------------------------------------------------------------------- 1 | 2 | ;;; less-css-mode.el --- Major mode for editing LESS CSS files (lesscss.org) 3 | ;; 4 | ;; Copyright 2011 Steve Purcell 5 | ;; 6 | ;; Author: Steve Purcell 7 | ;; URL: https://github.com/purcell/less-css-mode 8 | ;; Keywords: less css mode 9 | ;; Version: 0.4 10 | ;; 11 | ;; This program is free software; you can redistribute it and/or 12 | ;; modify it under the terms of the GNU General Public License as 13 | ;; published by the Free Software Foundation; either version 2 of 14 | ;; the License, or (at your option) any later version. 15 | ;; 16 | ;; This program is distributed in the hope that it will be 17 | ;; useful, but WITHOUT ANY WARRANTY; without even the implied 18 | ;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 19 | ;; PURPOSE. See the GNU General Public License for more details. 20 | ;; 21 | ;;; Commentary: 22 | ;; 23 | ;; This mode provides syntax highlighting for LESS CSS files, plus 24 | ;; optional support for flymake and compilation of .less files to .css 25 | ;; files at the time they are saved: use `less-css-compile-at-save' to 26 | ;; enable the latter. 27 | ;; 28 | ;; Command line utility "lessc" is required if enabling flymake or 29 | ;; setting `less-css-compile-at-save' to t. To install "lessc" using 30 | ;; the Node.js package manager, run "npm install less" 31 | ;; 32 | ;; Also make sure the "lessc" executable is in emacs' PATH, example: 33 | ;; (setq exec-path (cons (expand-file-name "~/.gem/ruby/1.8/bin") exec-path)) 34 | ;; or customize `less-css-lessc-command' to point to your "lessc" executable. 35 | ;; 36 | ;; `less-css-mode' is derived from `css-mode', and indentation of 37 | ;; nested blocks may not work correctly with versions of `css-mode' 38 | ;; other than that bundled with recent Emacs. 39 | ;; 40 | ;; You can specify per-file values for `less-css-compile-at-save', 41 | ;; `less-css-output-file-name' or `less-css-output-directory' using a 42 | ;; variables header at the top of your .less file, e.g.: 43 | ;; 44 | ;; // -*- less-css-compile-at-save: t; less-css-output-directory: "../css" -*- 45 | ;; 46 | ;;; Credits 47 | ;; 48 | ;; The original code for this mode was, in large part, written using 49 | ;; Anton Johansson's scss-mode as a template -- thanks Anton! 50 | ;; https://github.com/antonj 51 | ;; 52 | ;;; Code: 53 | 54 | (require 'derived) 55 | (require 'compile) 56 | (require 'flymake) 57 | 58 | (defgroup less-css nil 59 | "Less-css mode" 60 | :prefix "less-css-" 61 | :group 'css) 62 | 63 | (defcustom less-css-lessc-command "lessc" 64 | "Command used to compile LESS files, should be lessc or the 65 | complete path to your lessc executable, e.g.: 66 | \"~/.gem/ruby/1.8/bin/lessc\"" 67 | :group 'less-css) 68 | 69 | (defcustom less-css-compile-at-save nil 70 | "If non-nil, the LESS buffers will be compiled to CSS after each save" 71 | :type 'boolean 72 | :group 'less-css) 73 | 74 | (defcustom less-css-lessc-options '() 75 | "Command line options for less executable. 76 | 77 | Use \"-x\" to minify output." 78 | :type '(repeat string) 79 | :group 'less-css) 80 | 81 | (defvar less-css-output-directory nil 82 | "Directory in which to save CSS, or nil to use the LESS file's directory. 83 | 84 | This path is expanded relative to the directory of the LESS file 85 | using `expand-file-name', so both relative and absolute paths 86 | will work as expected.") 87 | 88 | (make-variable-buffer-local 'less-css-output-directory) 89 | 90 | (defvar less-css-output-file-name nil 91 | "File name in which to save CSS, or nil to use .css for .less. 92 | 93 | This can be also be set to a full path, or a relative path. If 94 | the path is relative, it will be relative to the value of 95 | `less-css-output-dir', if set, or the current directory by 96 | default.") 97 | 98 | (make-variable-buffer-local 'less-css-output-file-name) 99 | 100 | 101 | (defconst less-css-default-error-regex "Syntax Error on line \\([0-9]+\\)\e\\[39m\e\\[31m in \e\\[39m\\([^ ]+\\)$") 102 | 103 | (defcustom less-css-compile-error-regex (list (concat "\\(" less-css-default-error-regex "\\)") 3 2 nil nil 1) 104 | "Regex for finding line number file and error message in compilation buffers. 105 | 106 | This uses the same syntax as `compilation-error-regexp-alist'." 107 | :type '(repeat (choice (symbol :tag "Predefined symbol") 108 | (sexp :tag "Error specification"))) 109 | :group 'less-css) 110 | 111 | 112 | ;; TODO: '&', interpolation, escaped values (~"..."), JS eval (~`...`), custom faces 113 | (defconst less-css-font-lock-keywords 114 | '(;; Variables 115 | ("@[a-z_-][a-z-_0-9]*" . font-lock-constant-face) 116 | ;; Mixins 117 | ("\\(?:[ \t{;]\\|^\\)\\(\\.[a-z_-][a-z-_0-9]*\\)[ \t]*;" . (1 font-lock-keyword-face))) 118 | ) 119 | 120 | (defun less-css-compile-maybe () 121 | "Runs `less-css-compile' on if `less-css-compile-at-save' is t" 122 | (if less-css-compile-at-save 123 | (less-css-compile))) 124 | 125 | (defun less-css--output-path () 126 | "Calculate the path for the compiled CSS file created by `less-css-compile'." 127 | (expand-file-name (or less-css-output-file-name 128 | (concat (file-name-nondirectory (file-name-sans-extension buffer-file-name)) ".css")) 129 | (or less-css-output-directory default-directory))) 130 | 131 | ;;;###autoload 132 | (defun less-css-compile () 133 | "Compiles the current buffer to css using `less-css-lessc-command'." 134 | (interactive) 135 | (message "Compiling less to css") 136 | (compile 137 | (mapconcat 'shell-quote-argument 138 | (append (list less-css-lessc-command) 139 | less-css-lessc-options 140 | (list buffer-file-name (less-css--output-path))) 141 | " "))) 142 | 143 | ;;;###autoload 144 | (define-derived-mode less-css-mode css-mode "LESS" 145 | "Major mode for editing LESS files, http://lesscss.org/ 146 | Special commands: 147 | \\{less-css-mode-map}" 148 | (font-lock-add-keywords nil less-css-font-lock-keywords) 149 | ;; cpp-style comments 150 | (modify-syntax-entry ?/ "< 124b" less-css-mode-syntax-table) 151 | (modify-syntax-entry ?\n "> b" less-css-mode-syntax-table) 152 | 153 | (add-hook 'after-save-hook 'less-css-compile-maybe nil t)) 154 | 155 | (define-key less-css-mode-map "\C-c\C-c" 'less-css-compile) 156 | 157 | (add-to-list 'compilation-error-regexp-alist 'less-css-compile-error-regex) 158 | 159 | ;;;###autoload 160 | (defun flymake-less-css-init () 161 | "Flymake support for LESS files" 162 | (let* ((temp-file (flymake-init-create-temp-buffer-copy 163 | 'flymake-create-temp-inplace)) 164 | (local-file (file-relative-name 165 | temp-file 166 | (file-name-directory buffer-file-name)))) 167 | (list less-css-lessc-command (append less-css-lessc-options (list local-file))))) 168 | 169 | (push '(".+\\.less$" flymake-less-css-init) flymake-allowed-file-name-masks) 170 | 171 | (push (list less-css-default-error-regex 2 1 nil 2) flymake-err-line-patterns) 172 | 173 | ;;;###autoload 174 | (add-to-list 'auto-mode-alist '("\\.less" . less-css-mode)) 175 | 176 | (provide 'less-css-mode) 177 | ;;; less-css-mode.el ends here 178 | -------------------------------------------------------------------------------- /marmalade-repo-test/packages/less-css-mode/0.5/less-css-mode-0.5.el: -------------------------------------------------------------------------------- 1 | 2 | ;;; less-css-mode.el --- Major mode for editing LESS CSS files (lesscss.org) 3 | ;; 4 | ;; Copyright 2011 Steve Purcell 5 | ;; 6 | ;; Author: Steve Purcell 7 | ;; URL: https://github.com/purcell/less-css-mode 8 | ;; Keywords: less css mode 9 | ;; Version: 0.5 10 | ;; 11 | ;; This program is free software; you can redistribute it and/or 12 | ;; modify it under the terms of the GNU General Public License as 13 | ;; published by the Free Software Foundation; either version 2 of 14 | ;; the License, or (at your option) any later version. 15 | ;; 16 | ;; This program is distributed in the hope that it will be 17 | ;; useful, but WITHOUT ANY WARRANTY; without even the implied 18 | ;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 19 | ;; PURPOSE. See the GNU General Public License for more details. 20 | ;; 21 | ;;; Commentary: 22 | ;; 23 | ;; This mode provides syntax highlighting for LESS CSS files, plus 24 | ;; optional support for `flymake-mode' and compilation of .less files 25 | ;; to .css files at the time they are saved: use 26 | ;; `less-css-compile-at-save' to enable the latter. 27 | ;; 28 | ;; Command line utility "lessc" is required if enabling flymake or 29 | ;; setting `less-css-compile-at-save' to t. To install "lessc" using 30 | ;; the Node.js package manager, run "npm install less" 31 | ;; 32 | ;; Also make sure the "lessc" executable is in emacs' PATH, example: 33 | ;; (setq exec-path (cons (expand-file-name "~/.gem/ruby/1.8/bin") exec-path)) 34 | ;; or customize `less-css-lessc-command' to point to your "lessc" executable. 35 | ;; 36 | ;; `less-css-mode' is derived from `css-mode', and indentation of 37 | ;; nested blocks may not work correctly with versions of `css-mode' 38 | ;; other than that bundled with recent Emacs. 39 | ;; 40 | ;; You can specify per-file values for `less-css-compile-at-save', 41 | ;; `less-css-output-file-name' or `less-css-output-directory' using a 42 | ;; variables header at the top of your .less file, e.g.: 43 | ;; 44 | ;; // -*- less-css-compile-at-save: t; less-css-output-directory: "../css" -*- 45 | ;; 46 | ;; If you don't need CSS output but would like to be warned of any 47 | ;; syntax errors in your .less source, enable `flymake-mode': support 48 | ;; is provided for .less files, but note that the less compiler is a 49 | ;; little slow, so there can be a delay of several seconds between 50 | ;; editing and receiving feedback on any error. 51 | ;; 52 | ;;; Credits 53 | ;; 54 | ;; The original code for this mode was, in large part, written using 55 | ;; Anton Johansson's scss-mode as a template -- thanks Anton! 56 | ;; https://github.com/antonj 57 | ;; 58 | ;;; Code: 59 | 60 | (require 'derived) 61 | (require 'compile) 62 | (require 'flymake) 63 | 64 | (defgroup less-css nil 65 | "Less-css mode" 66 | :prefix "less-css-" 67 | :group 'css) 68 | 69 | (defcustom less-css-lessc-command "lessc" 70 | "Command used to compile LESS files, should be lessc or the 71 | complete path to your lessc executable, e.g.: 72 | \"~/.gem/ruby/1.8/bin/lessc\"" 73 | :group 'less-css) 74 | 75 | (defcustom less-css-compile-at-save nil 76 | "If non-nil, the LESS buffers will be compiled to CSS after each save" 77 | :type 'boolean 78 | :group 'less-css) 79 | 80 | (defcustom less-css-lessc-options '() 81 | "Command line options for less executable. 82 | 83 | Use \"-x\" to minify output." 84 | :type '(repeat string) 85 | :group 'less-css) 86 | 87 | (defvar less-css-output-directory nil 88 | "Directory in which to save CSS, or nil to use the LESS file's directory. 89 | 90 | This path is expanded relative to the directory of the LESS file 91 | using `expand-file-name', so both relative and absolute paths 92 | will work as expected.") 93 | 94 | (make-variable-buffer-local 'less-css-output-directory) 95 | 96 | (defvar less-css-output-file-name nil 97 | "File name in which to save CSS, or nil to use .css for .less. 98 | 99 | This can be also be set to a full path, or a relative path. If 100 | the path is relative, it will be relative to the value of 101 | `less-css-output-dir', if set, or the current directory by 102 | default.") 103 | 104 | (make-variable-buffer-local 'less-css-output-file-name) 105 | 106 | (defconst less-css-default-error-regex "Syntax Error on line \\([0-9]+\\)\e\\[39m\e\\[31m in \e\\[39m\\([^ ]+\\)$") 107 | 108 | 109 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 110 | ;; Compilation to CSS 111 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 112 | 113 | (add-to-list 'compilation-error-regexp-alist-alist 114 | (list 'less-css (concat "\\(" less-css-default-error-regex "\\)") 3 2 nil nil 1)) 115 | (add-to-list 'compilation-error-regexp-alist 'less-css) 116 | 117 | 118 | (defun less-css-compile-maybe () 119 | "Runs `less-css-compile' on if `less-css-compile-at-save' is t" 120 | (if less-css-compile-at-save 121 | (less-css-compile))) 122 | 123 | (defun less-css--output-path () 124 | "Calculate the path for the compiled CSS file created by `less-css-compile'." 125 | (expand-file-name (or less-css-output-file-name 126 | (concat (file-name-nondirectory (file-name-sans-extension buffer-file-name)) ".css")) 127 | (or less-css-output-directory default-directory))) 128 | 129 | ;;;###autoload 130 | (defun less-css-compile () 131 | "Compiles the current buffer to css using `less-css-lessc-command'." 132 | (interactive) 133 | (message "Compiling less to css") 134 | (compile 135 | (mapconcat 'shell-quote-argument 136 | (append (list less-css-lessc-command) 137 | less-css-lessc-options 138 | (list buffer-file-name (less-css--output-path))) 139 | " "))) 140 | 141 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 142 | ;; Minor mode 143 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 144 | 145 | ;; TODO: '&', interpolation, escaped values (~"..."), JS eval (~`...`), custom faces 146 | (defconst less-css-font-lock-keywords 147 | '(;; Variables 148 | ("@[a-z_-][a-z-_0-9]*" . font-lock-constant-face) 149 | ;; Mixins 150 | ("\\(?:[ \t{;]\\|^\\)\\(\\.[a-z_-][a-z-_0-9]*\\)[ \t]*;" . (1 font-lock-keyword-face))) 151 | ) 152 | 153 | ;;;###autoload 154 | (define-derived-mode less-css-mode css-mode "LESS" 155 | "Major mode for editing LESS files, http://lesscss.org/ 156 | Special commands: 157 | \\{less-css-mode-map}" 158 | (font-lock-add-keywords nil less-css-font-lock-keywords) 159 | ;; cpp-style comments 160 | (modify-syntax-entry ?/ "< 124b" less-css-mode-syntax-table) 161 | (modify-syntax-entry ?\n "> b" less-css-mode-syntax-table) 162 | 163 | (add-hook 'after-save-hook 'less-css-compile-maybe nil t)) 164 | 165 | (define-key less-css-mode-map "\C-c\C-c" 'less-css-compile) 166 | 167 | ;;;###autoload 168 | (add-to-list 'auto-mode-alist '("\\.less" . less-css-mode)) 169 | 170 | 171 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 172 | ;; Wiring for `flymake-mode' 173 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 174 | 175 | ;;;###autoload 176 | (defun flymake-less-css-init () 177 | "Flymake support for LESS files" 178 | (let* ((temp-file (flymake-init-create-temp-buffer-copy 179 | 'flymake-create-temp-inplace)) 180 | (local-file (file-relative-name 181 | temp-file 182 | (file-name-directory buffer-file-name)))) 183 | (list less-css-lessc-command (append less-css-lessc-options (list local-file))))) 184 | 185 | (push '(".+\\.less$" flymake-less-css-init) flymake-allowed-file-name-masks) 186 | 187 | (push (list less-css-default-error-regex 2 1 nil 2) flymake-err-line-patterns) 188 | 189 | 190 | (provide 'less-css-mode) 191 | ;;; less-css-mode.el ends here 192 | -------------------------------------------------------------------------------- /marmalade-repo-test/packages/less-css-mode/0.6/less-css-mode-0.6.el: -------------------------------------------------------------------------------- 1 | 2 | ;;; less-css-mode.el --- Major mode for editing LESS CSS files (lesscss.org) 3 | ;; 4 | ;; Copyright 2011 Steve Purcell 5 | ;; 6 | ;; Author: Steve Purcell 7 | ;; URL: https://github.com/purcell/less-css-mode 8 | ;; Keywords: less css mode 9 | ;; Version: 0.6 10 | ;; 11 | ;; This program is free software; you can redistribute it and/or 12 | ;; modify it under the terms of the GNU General Public License as 13 | ;; published by the Free Software Foundation; either version 2 of 14 | ;; the License, or (at your option) any later version. 15 | ;; 16 | ;; This program is distributed in the hope that it will be 17 | ;; useful, but WITHOUT ANY WARRANTY; without even the implied 18 | ;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 19 | ;; PURPOSE. See the GNU General Public License for more details. 20 | ;; 21 | ;;; Commentary: 22 | ;; 23 | ;; This mode provides syntax highlighting for LESS CSS files, plus 24 | ;; optional support for `flymake-mode' and compilation of .less files 25 | ;; to .css files at the time they are saved: use 26 | ;; `less-css-compile-at-save' to enable the latter. 27 | ;; 28 | ;; Command line utility "lessc" is required if enabling flymake or 29 | ;; setting `less-css-compile-at-save' to t. To install "lessc" using 30 | ;; the Node.js package manager, run "npm install less" 31 | ;; 32 | ;; Also make sure the "lessc" executable is in emacs' PATH, example: 33 | ;; (setq exec-path (cons (expand-file-name "~/.gem/ruby/1.8/bin") exec-path)) 34 | ;; or customize `less-css-lessc-command' to point to your "lessc" executable. 35 | ;; 36 | ;; `less-css-mode' is derived from `css-mode', and indentation of 37 | ;; nested blocks may not work correctly with versions of `css-mode' 38 | ;; other than that bundled with recent Emacs. 39 | ;; 40 | ;; You can specify per-file values for `less-css-compile-at-save', 41 | ;; `less-css-output-file-name' or `less-css-output-directory' using a 42 | ;; variables header at the top of your .less file, e.g.: 43 | ;; 44 | ;; // -*- less-css-compile-at-save: t; less-css-output-directory: "../css" -*- 45 | ;; 46 | ;; If you don't need CSS output but would like to be warned of any 47 | ;; syntax errors in your .less source, enable `flymake-mode': support 48 | ;; is provided for .less files, but note that the less compiler is a 49 | ;; little slow, so there can be a delay of several seconds between 50 | ;; editing and receiving feedback on any error. 51 | ;; 52 | ;;; Credits 53 | ;; 54 | ;; The original code for this mode was, in large part, written using 55 | ;; Anton Johansson's scss-mode as a template -- thanks Anton! 56 | ;; https://github.com/antonj 57 | ;; 58 | ;;; Code: 59 | 60 | (require 'derived) 61 | (require 'compile) 62 | (require 'flymake) 63 | 64 | (defgroup less-css nil 65 | "Less-css mode" 66 | :prefix "less-css-" 67 | :group 'css) 68 | 69 | (defcustom less-css-lessc-command "lessc" 70 | "Command used to compile LESS files, should be lessc or the 71 | complete path to your lessc executable, e.g.: 72 | \"~/.gem/ruby/1.8/bin/lessc\"" 73 | :group 'less-css) 74 | 75 | (defcustom less-css-compile-at-save nil 76 | "If non-nil, the LESS buffers will be compiled to CSS after each save" 77 | :type 'boolean 78 | :group 'less-css) 79 | 80 | (defcustom less-css-lessc-options '() 81 | "Command line options for less executable. 82 | 83 | Use \"-x\" to minify output." 84 | :type '(repeat string) 85 | :group 'less-css) 86 | 87 | (defvar less-css-output-directory nil 88 | "Directory in which to save CSS, or nil to use the LESS file's directory. 89 | 90 | This path is expanded relative to the directory of the LESS file 91 | using `expand-file-name', so both relative and absolute paths 92 | will work as expected.") 93 | 94 | (make-variable-buffer-local 'less-css-output-directory) 95 | 96 | (defvar less-css-output-file-name nil 97 | "File name in which to save CSS, or nil to use .css for .less. 98 | 99 | This can be also be set to a full path, or a relative path. If 100 | the path is relative, it will be relative to the value of 101 | `less-css-output-dir', if set, or the current directory by 102 | default.") 103 | 104 | (make-variable-buffer-local 'less-css-output-file-name) 105 | 106 | (defconst less-css-default-error-regex "Syntax Error on line \\([0-9]+\\)\e\\[39m\e\\[31m in \e\\[39m\\([^ ]+\\)$") 107 | 108 | 109 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 110 | ;; Compilation to CSS 111 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 112 | 113 | (add-to-list 'compilation-error-regexp-alist-alist 114 | (list 'less-css (concat "\\(" less-css-default-error-regex "\\)") 3 2 nil nil 1)) 115 | (add-to-list 'compilation-error-regexp-alist 'less-css) 116 | 117 | 118 | (defun less-css-compile-maybe () 119 | "Runs `less-css-compile' on if `less-css-compile-at-save' is t" 120 | (if less-css-compile-at-save 121 | (less-css-compile))) 122 | 123 | (defun less-css--output-path () 124 | "Calculate the path for the compiled CSS file created by `less-css-compile'." 125 | (expand-file-name (or less-css-output-file-name 126 | (concat (file-name-nondirectory (file-name-sans-extension buffer-file-name)) ".css")) 127 | (or less-css-output-directory default-directory))) 128 | 129 | ;;;###autoload 130 | (defun less-css-compile () 131 | "Compiles the current buffer to css using `less-css-lessc-command'." 132 | (interactive) 133 | (message "Compiling less to css") 134 | (compile 135 | (mapconcat 'shell-quote-argument 136 | (append (list less-css-lessc-command) 137 | less-css-lessc-options 138 | (list buffer-file-name (less-css--output-path))) 139 | " "))) 140 | 141 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 142 | ;; Minor mode 143 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 144 | 145 | ;; TODO: interpolation ("@{val}"), escaped values (~"..."), JS eval (~`...`), custom faces 146 | (defconst less-css-font-lock-keywords 147 | '(;; Variables 148 | ("@[a-z_-][a-z-_0-9]*" . font-lock-constant-face) 149 | ("&" . font-lock-preprocessor-face) 150 | ;; Mixins 151 | ("\\(?:[ \t{;]\\|^\\)\\(\\.[a-z_-][a-z-_0-9]*\\)[ \t]*;" . (1 font-lock-keyword-face))) 152 | ) 153 | 154 | ;;;###autoload 155 | (define-derived-mode less-css-mode css-mode "LESS" 156 | "Major mode for editing LESS files, http://lesscss.org/ 157 | Special commands: 158 | \\{less-css-mode-map}" 159 | (font-lock-add-keywords nil less-css-font-lock-keywords) 160 | ;; cpp-style comments 161 | (modify-syntax-entry ?/ "< 124b" less-css-mode-syntax-table) 162 | (modify-syntax-entry ?\n "> b" less-css-mode-syntax-table) 163 | (set (make-local-variable 'comment-start) "//") 164 | (set (make-local-variable 'comment-end) "") 165 | 166 | (add-hook 'after-save-hook 'less-css-compile-maybe nil t)) 167 | 168 | (define-key less-css-mode-map "\C-c\C-c" 'less-css-compile) 169 | 170 | ;;;###autoload 171 | (add-to-list 'auto-mode-alist '("\\.less" . less-css-mode)) 172 | 173 | 174 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 175 | ;; Wiring for `flymake-mode' 176 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 177 | 178 | ;;;###autoload 179 | (defun flymake-less-css-init () 180 | "Flymake support for LESS files" 181 | (let* ((temp-file (flymake-init-create-temp-buffer-copy 182 | 'flymake-create-temp-inplace)) 183 | (local-file (file-relative-name 184 | temp-file 185 | (file-name-directory buffer-file-name)))) 186 | (list less-css-lessc-command (append less-css-lessc-options (list local-file))))) 187 | 188 | (push '(".+\\.less$" flymake-less-css-init) flymake-allowed-file-name-masks) 189 | 190 | (push (list less-css-default-error-regex 2 1 nil 2) flymake-err-line-patterns) 191 | 192 | 193 | (provide 'less-css-mode) 194 | ;;; less-css-mode.el ends here 195 | -------------------------------------------------------------------------------- /marmalade-repo-test/packages/less-css-mode/0.7/less-css-mode-0.7.el: -------------------------------------------------------------------------------- 1 | 2 | ;;; less-css-mode.el --- Major mode for editing LESS CSS files (lesscss.org) 3 | ;; 4 | ;; Copyright 2011 Steve Purcell 5 | ;; 6 | ;; Author: Steve Purcell 7 | ;; URL: https://github.com/purcell/less-css-mode 8 | ;; Keywords: less css mode 9 | ;; Version: 0.7 10 | ;; 11 | ;; This program is free software; you can redistribute it and/or 12 | ;; modify it under the terms of the GNU General Public License as 13 | ;; published by the Free Software Foundation; either version 2 of 14 | ;; the License, or (at your option) any later version. 15 | ;; 16 | ;; This program is distributed in the hope that it will be 17 | ;; useful, but WITHOUT ANY WARRANTY; without even the implied 18 | ;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 19 | ;; PURPOSE. See the GNU General Public License for more details. 20 | ;; 21 | ;;; Commentary: 22 | ;; 23 | ;; This mode provides syntax highlighting for LESS CSS files, plus 24 | ;; optional support for `flymake-mode' and compilation of .less files 25 | ;; to .css files at the time they are saved: use 26 | ;; `less-css-compile-at-save' to enable the latter. 27 | ;; 28 | ;; Command line utility "lessc" is required if enabling flymake or 29 | ;; setting `less-css-compile-at-save' to t. To install "lessc" using 30 | ;; the Node.js package manager, run "npm install less" 31 | ;; 32 | ;; Also make sure the "lessc" executable is in emacs' PATH, example: 33 | ;; (setq exec-path (cons (expand-file-name "~/.gem/ruby/1.8/bin") exec-path)) 34 | ;; or customize `less-css-lessc-command' to point to your "lessc" executable. 35 | ;; 36 | ;; `less-css-mode' is derived from `css-mode', and indentation of 37 | ;; nested blocks may not work correctly with versions of `css-mode' 38 | ;; other than that bundled with recent Emacs. 39 | ;; 40 | ;; You can specify per-file values for `less-css-compile-at-save', 41 | ;; `less-css-output-file-name' or `less-css-output-directory' using a 42 | ;; variables header at the top of your .less file, e.g.: 43 | ;; 44 | ;; // -*- less-css-compile-at-save: t; less-css-output-directory: "../css" -*- 45 | ;; 46 | ;; If you don't need CSS output but would like to be warned of any 47 | ;; syntax errors in your .less source, enable `flymake-mode': support 48 | ;; is provided for .less files, but note that the less compiler is a 49 | ;; little slow, so there can be a delay of several seconds between 50 | ;; editing and receiving feedback on any error. 51 | ;; 52 | ;;; Credits 53 | ;; 54 | ;; The original code for this mode was, in large part, written using 55 | ;; Anton Johansson's scss-mode as a template -- thanks Anton! 56 | ;; https://github.com/antonj 57 | ;; 58 | ;;; Code: 59 | 60 | (require 'derived) 61 | (require 'compile) 62 | (require 'flymake) 63 | 64 | (defgroup less-css nil 65 | "Less-css mode" 66 | :prefix "less-css-" 67 | :group 'css) 68 | 69 | (defcustom less-css-lessc-command "lessc" 70 | "Command used to compile LESS files, should be lessc or the 71 | complete path to your lessc executable, e.g.: 72 | \"~/.gem/ruby/1.8/bin/lessc\"" 73 | :group 'less-css) 74 | 75 | (defcustom less-css-compile-at-save nil 76 | "If non-nil, the LESS buffers will be compiled to CSS after each save" 77 | :type 'boolean 78 | :group 'less-css) 79 | 80 | (defcustom less-css-lessc-options '() 81 | "Command line options for less executable. 82 | 83 | Use \"-x\" to minify output." 84 | :type '(repeat string) 85 | :group 'less-css) 86 | 87 | (defvar less-css-output-directory nil 88 | "Directory in which to save CSS, or nil to use the LESS file's directory. 89 | 90 | This path is expanded relative to the directory of the LESS file 91 | using `expand-file-name', so both relative and absolute paths 92 | will work as expected.") 93 | 94 | (make-variable-buffer-local 'less-css-output-directory) 95 | 96 | (defvar less-css-output-file-name nil 97 | "File name in which to save CSS, or nil to use .css for .less. 98 | 99 | This can be also be set to a full path, or a relative path. If 100 | the path is relative, it will be relative to the value of 101 | `less-css-output-dir', if set, or the current directory by 102 | default.") 103 | 104 | (make-variable-buffer-local 'less-css-output-file-name) 105 | 106 | (defconst less-css-default-error-regex "Syntax Error on line \\([0-9]+\\)\e\\[39m\e\\[31m in \e\\[39m\\([^ ]+\\)$") 107 | 108 | 109 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 110 | ;; Compilation to CSS 111 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 112 | 113 | (add-to-list 'compilation-error-regexp-alist-alist 114 | (list 'less-css (concat "\\(" less-css-default-error-regex "\\)") 3 2 nil nil 1)) 115 | (add-to-list 'compilation-error-regexp-alist 'less-css) 116 | 117 | 118 | (defun less-css-compile-maybe () 119 | "Runs `less-css-compile' on if `less-css-compile-at-save' is t" 120 | (if less-css-compile-at-save 121 | (less-css-compile))) 122 | 123 | (defun less-css--output-path () 124 | "Calculate the path for the compiled CSS file created by `less-css-compile'." 125 | (expand-file-name (or less-css-output-file-name 126 | (concat (file-name-nondirectory (file-name-sans-extension buffer-file-name)) ".css")) 127 | (or less-css-output-directory default-directory))) 128 | 129 | ;;;###autoload 130 | (defun less-css-compile () 131 | "Compiles the current buffer to css using `less-css-lessc-command'." 132 | (interactive) 133 | (message "Compiling less to css") 134 | (compile 135 | (mapconcat 'shell-quote-argument 136 | (append (list less-css-lessc-command) 137 | less-css-lessc-options 138 | (list buffer-file-name (less-css--output-path))) 139 | " "))) 140 | 141 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 142 | ;; Minor mode 143 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 144 | 145 | ;; TODO: interpolation ("@{val}"), escaped values (~"..."), JS eval (~`...`), custom faces 146 | (defconst less-css-font-lock-keywords 147 | '(;; Variables 148 | ("@[a-z_-][a-z-_0-9]*" . font-lock-constant-face) 149 | ("&" . font-lock-preprocessor-face) 150 | ;; Mixins 151 | ("\\(?:[ \t{;]\\|^\\)\\(\\.[a-z_-][a-z-_0-9]*\\)[ \t]*;" . (1 font-lock-keyword-face))) 152 | ) 153 | 154 | (defun less-css-indent-line () 155 | "Indent current line according to LESS CSS indentation rules." 156 | (let ((css-navigation-syntax-table less-css-mode-syntax-table)) 157 | (css-indent-line))) 158 | 159 | ;;;###autoload 160 | (define-derived-mode less-css-mode css-mode "LESS" 161 | "Major mode for editing LESS files, http://lesscss.org/ 162 | Special commands: 163 | \\{less-css-mode-map}" 164 | (font-lock-add-keywords nil less-css-font-lock-keywords) 165 | ;; cpp-style comments 166 | (modify-syntax-entry ?/ "< 124b" less-css-mode-syntax-table) 167 | (modify-syntax-entry ?\n "> b" less-css-mode-syntax-table) 168 | (set (make-local-variable 'comment-start) "//") 169 | (set (make-local-variable 'comment-end) "") 170 | (set (make-local-variable 'indent-line-function) 'less-css-indent-line) 171 | 172 | (add-hook 'after-save-hook 'less-css-compile-maybe nil t)) 173 | 174 | (define-key less-css-mode-map "\C-c\C-c" 'less-css-compile) 175 | 176 | ;;;###autoload 177 | (add-to-list 'auto-mode-alist '("\\.less" . less-css-mode)) 178 | 179 | 180 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 181 | ;; Wiring for `flymake-mode' 182 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 183 | 184 | ;;;###autoload 185 | (defun flymake-less-css-init () 186 | "Flymake support for LESS files" 187 | (let* ((temp-file (flymake-init-create-temp-buffer-copy 188 | 'flymake-create-temp-inplace)) 189 | (local-file (file-relative-name 190 | temp-file 191 | (file-name-directory buffer-file-name)))) 192 | (list less-css-lessc-command (append less-css-lessc-options (list local-file))))) 193 | 194 | (push '(".+\\.less$" flymake-less-css-init) flymake-allowed-file-name-masks) 195 | 196 | (push (list less-css-default-error-regex 2 1 nil 2) flymake-err-line-patterns) 197 | 198 | 199 | (provide 'less-css-mode) 200 | ;;; less-css-mode.el ends here 201 | -------------------------------------------------------------------------------- /marmalade-repo-test/packages/less-css-mode/0.8/less-css-mode-0.8.el: -------------------------------------------------------------------------------- 1 | 2 | ;;; less-css-mode.el --- Major mode for editing LESS CSS files (lesscss.org) 3 | ;; 4 | ;; Copyright 2011 Steve Purcell 5 | ;; 6 | ;; Author: Steve Purcell 7 | ;; URL: https://github.com/purcell/less-css-mode 8 | ;; Keywords: less css mode 9 | ;; Version: 0.8 10 | ;; 11 | ;; This program is free software; you can redistribute it and/or 12 | ;; modify it under the terms of the GNU General Public License as 13 | ;; published by the Free Software Foundation; either version 2 of 14 | ;; the License, or (at your option) any later version. 15 | ;; 16 | ;; This program is distributed in the hope that it will be 17 | ;; useful, but WITHOUT ANY WARRANTY; without even the implied 18 | ;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 19 | ;; PURPOSE. See the GNU General Public License for more details. 20 | ;; 21 | ;;; Commentary: 22 | ;; 23 | ;; This mode provides syntax highlighting for LESS CSS files, plus 24 | ;; optional support for `flymake-mode' and compilation of .less files 25 | ;; to .css files at the time they are saved: use 26 | ;; `less-css-compile-at-save' to enable the latter. 27 | ;; 28 | ;; Command line utility "lessc" is required if enabling flymake or 29 | ;; setting `less-css-compile-at-save' to t. To install "lessc" using 30 | ;; the Node.js package manager, run "npm install less" 31 | ;; 32 | ;; Also make sure the "lessc" executable is in emacs' PATH, example: 33 | ;; (setq exec-path (cons (expand-file-name "~/.gem/ruby/1.8/bin") exec-path)) 34 | ;; or customize `less-css-lessc-command' to point to your "lessc" executable. 35 | ;; 36 | ;; `less-css-mode' is derived from `css-mode', and indentation of 37 | ;; nested blocks may not work correctly with versions of `css-mode' 38 | ;; other than that bundled with recent Emacs. 39 | ;; 40 | ;; You can specify per-file values for `less-css-compile-at-save', 41 | ;; `less-css-output-file-name' or `less-css-output-directory' using a 42 | ;; variables header at the top of your .less file, e.g.: 43 | ;; 44 | ;; // -*- less-css-compile-at-save: t; less-css-output-directory: "../css" -*- 45 | ;; 46 | ;; If you don't need CSS output but would like to be warned of any 47 | ;; syntax errors in your .less source, enable `flymake-mode': support 48 | ;; is provided for .less files, but note that the less compiler is a 49 | ;; little slow, so there can be a delay of several seconds between 50 | ;; editing and receiving feedback on any error. 51 | ;; 52 | ;;; Credits 53 | ;; 54 | ;; The original code for this mode was, in large part, written using 55 | ;; Anton Johansson's scss-mode as a template -- thanks Anton! 56 | ;; https://github.com/antonj 57 | ;; 58 | ;;; Code: 59 | 60 | (require 'derived) 61 | (require 'compile) 62 | (require 'flymake) 63 | 64 | (defgroup less-css nil 65 | "Less-css mode" 66 | :prefix "less-css-" 67 | :group 'css) 68 | 69 | (defcustom less-css-lessc-command "lessc" 70 | "Command used to compile LESS files, should be lessc or the 71 | complete path to your lessc executable, e.g.: 72 | \"~/.gem/ruby/1.8/bin/lessc\"" 73 | :group 'less-css) 74 | 75 | (defcustom less-css-compile-at-save nil 76 | "If non-nil, the LESS buffers will be compiled to CSS after each save" 77 | :type 'boolean 78 | :group 'less-css) 79 | 80 | (defcustom less-css-lessc-options '() 81 | "Command line options for less executable. 82 | 83 | Use \"-x\" to minify output." 84 | :type '(repeat string) 85 | :group 'less-css) 86 | 87 | (defvar less-css-output-directory nil 88 | "Directory in which to save CSS, or nil to use the LESS file's directory. 89 | 90 | This path is expanded relative to the directory of the LESS file 91 | using `expand-file-name', so both relative and absolute paths 92 | will work as expected.") 93 | 94 | (make-variable-buffer-local 'less-css-output-directory) 95 | 96 | (defvar less-css-output-file-name nil 97 | "File name in which to save CSS, or nil to use .css for .less. 98 | 99 | This can be also be set to a full path, or a relative path. If 100 | the path is relative, it will be relative to the value of 101 | `less-css-output-dir', if set, or the current directory by 102 | default.") 103 | 104 | (make-variable-buffer-local 'less-css-output-file-name) 105 | 106 | (defconst less-css-default-error-regex "Syntax Error on line \\([0-9]+\\)\e\\[39m\e\\[31m in \e\\[39m\\([^ \r\n\t\e]+\\)") 107 | 108 | 109 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 110 | ;; Compilation to CSS 111 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 112 | 113 | (add-to-list 'compilation-error-regexp-alist-alist 114 | (list 'less-css (concat "\\(" less-css-default-error-regex "\\)") 3 2 nil nil 1)) 115 | (add-to-list 'compilation-error-regexp-alist 'less-css) 116 | 117 | 118 | (defun less-css-compile-maybe () 119 | "Runs `less-css-compile' on if `less-css-compile-at-save' is t" 120 | (if less-css-compile-at-save 121 | (less-css-compile))) 122 | 123 | (defun less-css--output-path () 124 | "Calculate the path for the compiled CSS file created by `less-css-compile'." 125 | (expand-file-name (or less-css-output-file-name 126 | (concat (file-name-nondirectory (file-name-sans-extension buffer-file-name)) ".css")) 127 | (or less-css-output-directory default-directory))) 128 | 129 | ;;;###autoload 130 | (defun less-css-compile () 131 | "Compiles the current buffer to css using `less-css-lessc-command'." 132 | (interactive) 133 | (message "Compiling less to css") 134 | (compile 135 | (mapconcat 'identity 136 | (append (list (shell-quote-argument less-css-lessc-command)) 137 | less-css-lessc-options 138 | (list (shell-quote-argument buffer-file-name) 139 | ">" 140 | (shell-quote-argument (less-css--output-path)))) 141 | " "))) 142 | 143 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 144 | ;; Minor mode 145 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 146 | 147 | ;; TODO: interpolation ("@{val}"), escaped values (~"..."), JS eval (~`...`), custom faces 148 | (defconst less-css-font-lock-keywords 149 | '(;; Variables 150 | ("@[a-z_-][a-z-_0-9]*" . font-lock-constant-face) 151 | ("&" . font-lock-preprocessor-face) 152 | ;; Mixins 153 | ("\\(?:[ \t{;]\\|^\\)\\(\\.[a-z_-][a-z-_0-9]*\\)[ \t]*;" . (1 font-lock-keyword-face))) 154 | ) 155 | 156 | (defun less-css-indent-line () 157 | "Indent current line according to LESS CSS indentation rules." 158 | (let ((css-navigation-syntax-table less-css-mode-syntax-table)) 159 | (css-indent-line))) 160 | 161 | ;;;###autoload 162 | (define-derived-mode less-css-mode css-mode "LESS" 163 | "Major mode for editing LESS files, http://lesscss.org/ 164 | Special commands: 165 | \\{less-css-mode-map}" 166 | (font-lock-add-keywords nil less-css-font-lock-keywords) 167 | ;; cpp-style comments 168 | (modify-syntax-entry ?/ "< 124b" less-css-mode-syntax-table) 169 | (modify-syntax-entry ?\n "> b" less-css-mode-syntax-table) 170 | (set (make-local-variable 'comment-start) "//") 171 | (set (make-local-variable 'comment-end) "") 172 | (set (make-local-variable 'indent-line-function) 'less-css-indent-line) 173 | 174 | (add-hook 'after-save-hook 'less-css-compile-maybe nil t)) 175 | 176 | (define-key less-css-mode-map "\C-c\C-c" 'less-css-compile) 177 | 178 | ;;;###autoload 179 | (add-to-list 'auto-mode-alist '("\\.less" . less-css-mode)) 180 | 181 | 182 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 183 | ;; Wiring for `flymake-mode' 184 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 185 | 186 | ;;;###autoload 187 | (defun flymake-less-css-init () 188 | "Flymake support for LESS files" 189 | (let* ((temp-file (flymake-init-create-temp-buffer-copy 190 | 'flymake-create-temp-inplace)) 191 | (local-file (file-relative-name 192 | temp-file 193 | (file-name-directory buffer-file-name)))) 194 | (list less-css-lessc-command (append less-css-lessc-options (list local-file))))) 195 | 196 | (push '(".+\\.less$" flymake-less-css-init) flymake-allowed-file-name-masks) 197 | 198 | (push (list less-css-default-error-regex 2 1 nil 2) flymake-err-line-patterns) 199 | 200 | 201 | (provide 'less-css-mode) 202 | ;;; less-css-mode.el ends here 203 | -------------------------------------------------------------------------------- /marmalade-repo-test/packages/less-css-mode/0.9/less-css-mode-0.9.el: -------------------------------------------------------------------------------- 1 | 2 | ;;; less-css-mode.el --- Major mode for editing LESS CSS files (lesscss.org) 3 | ;; 4 | ;; Copyright 2011 Steve Purcell 5 | ;; 6 | ;; Author: Steve Purcell 7 | ;; URL: https://github.com/purcell/less-css-mode 8 | ;; Keywords: less css mode 9 | ;; Version: 0.9 10 | ;; 11 | ;; This program is free software; you can redistribute it and/or 12 | ;; modify it under the terms of the GNU General Public License as 13 | ;; published by the Free Software Foundation; either version 2 of 14 | ;; the License, or (at your option) any later version. 15 | ;; 16 | ;; This program is distributed in the hope that it will be 17 | ;; useful, but WITHOUT ANY WARRANTY; without even the implied 18 | ;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 19 | ;; PURPOSE. See the GNU General Public License for more details. 20 | ;; 21 | ;;; Commentary: 22 | ;; 23 | ;; This mode provides syntax highlighting for LESS CSS files, plus 24 | ;; optional support for `flymake-mode' and compilation of .less files 25 | ;; to .css files at the time they are saved: use 26 | ;; `less-css-compile-at-save' to enable the latter. 27 | ;; 28 | ;; Command line utility "lessc" is required if enabling flymake or 29 | ;; setting `less-css-compile-at-save' to t. To install "lessc" using 30 | ;; the Node.js package manager, run "npm install less" 31 | ;; 32 | ;; Also make sure the "lessc" executable is in emacs' PATH, example: 33 | ;; (setq exec-path (cons (expand-file-name "~/.gem/ruby/1.8/bin") exec-path)) 34 | ;; or customize `less-css-lessc-command' to point to your "lessc" executable. 35 | ;; 36 | ;; `less-css-mode' is derived from `css-mode', and indentation of 37 | ;; nested blocks may not work correctly with versions of `css-mode' 38 | ;; other than that bundled with recent Emacs. 39 | ;; 40 | ;; You can specify per-file values for `less-css-compile-at-save', 41 | ;; `less-css-output-file-name' or `less-css-output-directory' using a 42 | ;; variables header at the top of your .less file, e.g.: 43 | ;; 44 | ;; // -*- less-css-compile-at-save: t; less-css-output-directory: "../css" -*- 45 | ;; 46 | ;; If you don't need CSS output but would like to be warned of any 47 | ;; syntax errors in your .less source, enable `flymake-mode': support 48 | ;; is provided for .less files, but note that the less compiler is a 49 | ;; little slow, so there can be a delay of several seconds between 50 | ;; editing and receiving feedback on any error. 51 | ;; 52 | ;;; Credits 53 | ;; 54 | ;; The original code for this mode was, in large part, written using 55 | ;; Anton Johansson's scss-mode as a template -- thanks Anton! 56 | ;; https://github.com/antonj 57 | ;; 58 | ;;; Code: 59 | 60 | (require 'derived) 61 | (require 'compile) 62 | (require 'flymake) 63 | 64 | (defgroup less-css nil 65 | "Less-css mode" 66 | :prefix "less-css-" 67 | :group 'css) 68 | 69 | (defcustom less-css-lessc-command "lessc" 70 | "Command used to compile LESS files, should be lessc or the 71 | complete path to your lessc executable, e.g.: 72 | \"~/.gem/ruby/1.8/bin/lessc\"" 73 | :group 'less-css) 74 | 75 | (defcustom less-css-compile-at-save nil 76 | "If non-nil, the LESS buffers will be compiled to CSS after each save" 77 | :type 'boolean 78 | :group 'less-css) 79 | 80 | (defcustom less-css-lessc-options '() 81 | "Command line options for less executable. 82 | 83 | Use \"-x\" to minify output." 84 | :type '(repeat string) 85 | :group 'less-css) 86 | 87 | (defvar less-css-output-directory nil 88 | "Directory in which to save CSS, or nil to use the LESS file's directory. 89 | 90 | This path is expanded relative to the directory of the LESS file 91 | using `expand-file-name', so both relative and absolute paths 92 | will work as expected.") 93 | 94 | (make-variable-buffer-local 'less-css-output-directory) 95 | 96 | (defvar less-css-output-file-name nil 97 | "File name in which to save CSS, or nil to use .css for .less. 98 | 99 | This can be also be set to a full path, or a relative path. If 100 | the path is relative, it will be relative to the value of 101 | `less-css-output-dir', if set, or the current directory by 102 | default.") 103 | 104 | (make-variable-buffer-local 'less-css-output-file-name) 105 | 106 | (defconst less-css-default-error-regex "Syntax Error on line \\([0-9]+\\)\e\\[39m\e\\[31m in \e\\[39m\\([^ \r\n\t\e]+\\)") 107 | 108 | 109 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 110 | ;; Compilation to CSS 111 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 112 | 113 | (add-to-list 'compilation-error-regexp-alist-alist 114 | (list 'less-css (concat "\\(" less-css-default-error-regex "\\)") 3 2 nil nil 1)) 115 | (add-to-list 'compilation-error-regexp-alist 'less-css) 116 | 117 | 118 | (defun less-css-compile-maybe () 119 | "Runs `less-css-compile' on if `less-css-compile-at-save' is t" 120 | (if less-css-compile-at-save 121 | (less-css-compile))) 122 | 123 | (defun less-css--output-path () 124 | "Calculate the path for the compiled CSS file created by `less-css-compile'." 125 | (expand-file-name (or less-css-output-file-name 126 | (concat (file-name-nondirectory (file-name-sans-extension buffer-file-name)) ".css")) 127 | (or less-css-output-directory default-directory))) 128 | 129 | ;;;###autoload 130 | (defun less-css-compile () 131 | "Compiles the current buffer to css using `less-css-lessc-command'." 132 | (interactive) 133 | (message "Compiling less to css") 134 | (compile 135 | (mapconcat 'identity 136 | (append (list (shell-quote-argument less-css-lessc-command)) 137 | less-css-lessc-options 138 | (list (shell-quote-argument buffer-file-name) 139 | ">" 140 | (shell-quote-argument (less-css--output-path)))) 141 | " "))) 142 | 143 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 144 | ;; Minor mode 145 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 146 | 147 | ;; TODO: interpolation ("@{val}"), escaped values (~"..."), JS eval (~`...`), custom faces 148 | (defconst less-css-font-lock-keywords 149 | '(;; Variables 150 | ("@[a-z_-][a-z-_0-9]*" . font-lock-constant-face) 151 | ("&" . font-lock-preprocessor-face) 152 | ;; Mixins 153 | ("\\(?:[ \t{;]\\|^\\)\\(\\.[a-z_-][a-z-_0-9]*\\)[ \t]*;" . (1 font-lock-keyword-face))) 154 | ) 155 | 156 | (defun less-css-indent-line () 157 | "Indent current line according to LESS CSS indentation rules." 158 | (let ((css-navigation-syntax-table less-css-mode-syntax-table)) 159 | (css-indent-line))) 160 | 161 | ;;;###autoload 162 | (define-derived-mode less-css-mode css-mode "LESS" 163 | "Major mode for editing LESS files, http://lesscss.org/ 164 | Special commands: 165 | \\{less-css-mode-map}" 166 | (font-lock-add-keywords nil less-css-font-lock-keywords) 167 | ;; cpp-style comments 168 | (modify-syntax-entry ?/ ". 124b" less-css-mode-syntax-table) 169 | (modify-syntax-entry ?\n "> b" less-css-mode-syntax-table) 170 | ;; Special chars that sometimes come at the beginning of words. 171 | (modify-syntax-entry ?. "'" less-css-mode-syntax-table) 172 | 173 | (set (make-local-variable 'comment-start) "//") 174 | (set (make-local-variable 'comment-end) "") 175 | (set (make-local-variable 'indent-line-function) 'less-css-indent-line) 176 | 177 | (add-hook 'after-save-hook 'less-css-compile-maybe nil t)) 178 | 179 | (define-key less-css-mode-map "\C-c\C-c" 'less-css-compile) 180 | 181 | ;;;###autoload 182 | (add-to-list 'auto-mode-alist '("\\.less" . less-css-mode)) 183 | 184 | 185 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 186 | ;; Wiring for `flymake-mode' 187 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 188 | 189 | ;;;###autoload 190 | (defun flymake-less-css-init () 191 | "Flymake support for LESS files" 192 | (let* ((temp-file (flymake-init-create-temp-buffer-copy 193 | 'flymake-create-temp-inplace)) 194 | (local-file (file-relative-name 195 | temp-file 196 | (file-name-directory buffer-file-name)))) 197 | (list less-css-lessc-command (append less-css-lessc-options (list local-file))))) 198 | 199 | (push '(".+\\.less$" flymake-less-css-init) flymake-allowed-file-name-masks) 200 | 201 | (push (list less-css-default-error-regex 2 1 nil 2) flymake-err-line-patterns) 202 | 203 | 204 | (provide 'less-css-mode) 205 | ;;; less-css-mode.el ends here 206 | -------------------------------------------------------------------------------- /marmalade-repo-test/packages/less-css-mode/0.10/less-css-mode-0.10.el: -------------------------------------------------------------------------------- 1 | 2 | ;;; less-css-mode.el --- Major mode for editing LESS CSS files (lesscss.org) 3 | ;; 4 | ;; Copyright 2011 Steve Purcell 5 | ;; 6 | ;; Author: Steve Purcell 7 | ;; URL: https://github.com/purcell/less-css-mode 8 | ;; Keywords: less css mode 9 | ;; Version: 0.10 10 | ;; 11 | ;; This program is free software; you can redistribute it and/or 12 | ;; modify it under the terms of the GNU General Public License as 13 | ;; published by the Free Software Foundation; either version 2 of 14 | ;; the License, or (at your option) any later version. 15 | ;; 16 | ;; This program is distributed in the hope that it will be 17 | ;; useful, but WITHOUT ANY WARRANTY; without even the implied 18 | ;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 19 | ;; PURPOSE. See the GNU General Public License for more details. 20 | ;; 21 | ;;; Commentary: 22 | ;; 23 | ;; This mode provides syntax highlighting for LESS CSS files, plus 24 | ;; optional support for `flymake-mode' and compilation of .less files 25 | ;; to .css files at the time they are saved: use 26 | ;; `less-css-compile-at-save' to enable the latter. 27 | ;; 28 | ;; Command line utility "lessc" is required if enabling flymake or 29 | ;; setting `less-css-compile-at-save' to t. To install "lessc" using 30 | ;; the Node.js package manager, run "npm install less" 31 | ;; 32 | ;; Also make sure the "lessc" executable is in emacs' PATH, example: 33 | ;; (setq exec-path (cons (expand-file-name "~/.gem/ruby/1.8/bin") exec-path)) 34 | ;; or customize `less-css-lessc-command' to point to your "lessc" executable. 35 | ;; 36 | ;; `less-css-mode' is derived from `css-mode', and indentation of 37 | ;; nested blocks may not work correctly with versions of `css-mode' 38 | ;; other than that bundled with recent Emacs. 39 | ;; 40 | ;; You can specify per-file values for `less-css-compile-at-save', 41 | ;; `less-css-output-file-name' or `less-css-output-directory' using a 42 | ;; variables header at the top of your .less file, e.g.: 43 | ;; 44 | ;; // -*- less-css-compile-at-save: t; less-css-output-directory: "../css" -*- 45 | ;; 46 | ;; If you don't need CSS output but would like to be warned of any 47 | ;; syntax errors in your .less source, enable `flymake-mode': support 48 | ;; is provided for .less files, but note that the less compiler is a 49 | ;; little slow, so there can be a delay of several seconds between 50 | ;; editing and receiving feedback on any error. 51 | ;; 52 | ;;; Credits 53 | ;; 54 | ;; The original code for this mode was, in large part, written using 55 | ;; Anton Johansson's scss-mode as a template -- thanks Anton! 56 | ;; https://github.com/antonj 57 | ;; 58 | ;;; Code: 59 | 60 | (require 'derived) 61 | (require 'compile) 62 | (require 'flymake) 63 | 64 | (defgroup less-css nil 65 | "Less-css mode" 66 | :prefix "less-css-" 67 | :group 'css) 68 | 69 | (defcustom less-css-lessc-command "lessc" 70 | "Command used to compile LESS files, should be lessc or the 71 | complete path to your lessc executable, e.g.: 72 | \"~/.gem/ruby/1.8/bin/lessc\"" 73 | :group 'less-css) 74 | 75 | (defcustom less-css-compile-at-save nil 76 | "If non-nil, the LESS buffers will be compiled to CSS after each save" 77 | :type 'boolean 78 | :group 'less-css) 79 | 80 | (defcustom less-css-lessc-options '() 81 | "Command line options for less executable. 82 | 83 | Use \"-x\" to minify output." 84 | :type '(repeat string) 85 | :group 'less-css) 86 | 87 | (defvar less-css-output-directory nil 88 | "Directory in which to save CSS, or nil to use the LESS file's directory. 89 | 90 | This path is expanded relative to the directory of the LESS file 91 | using `expand-file-name', so both relative and absolute paths 92 | will work as expected.") 93 | 94 | (make-variable-buffer-local 'less-css-output-directory) 95 | 96 | (defvar less-css-output-file-name nil 97 | "File name in which to save CSS, or nil to use .css for .less. 98 | 99 | This can be also be set to a full path, or a relative path. If 100 | the path is relative, it will be relative to the value of 101 | `less-css-output-dir', if set, or the current directory by 102 | default.") 103 | 104 | (make-variable-buffer-local 'less-css-output-file-name) 105 | 106 | (defconst less-css-default-error-regex "Syntax Error on line \\([0-9]+\\)\e\\[39m\e\\[31m in \e\\[39m\\([^ \r\n\t\e]+\\)") 107 | 108 | 109 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 110 | ;; Compilation to CSS 111 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 112 | 113 | (add-to-list 'compilation-error-regexp-alist-alist 114 | (list 'less-css (concat "\\(" less-css-default-error-regex "\\)") 3 2 nil nil 1)) 115 | (add-to-list 'compilation-error-regexp-alist 'less-css) 116 | 117 | 118 | (defun less-css-compile-maybe () 119 | "Runs `less-css-compile' on if `less-css-compile-at-save' is t" 120 | (if less-css-compile-at-save 121 | (less-css-compile))) 122 | 123 | (defun less-css--output-path () 124 | "Calculate the path for the compiled CSS file created by `less-css-compile'." 125 | (expand-file-name (or less-css-output-file-name 126 | (concat (file-name-nondirectory (file-name-sans-extension buffer-file-name)) ".css")) 127 | (or less-css-output-directory default-directory))) 128 | 129 | ;;;###autoload 130 | (defun less-css-compile () 131 | "Compiles the current buffer to css using `less-css-lessc-command'." 132 | (interactive) 133 | (message "Compiling less to css") 134 | (compile 135 | (mapconcat 'identity 136 | (append (list (shell-quote-argument less-css-lessc-command)) 137 | less-css-lessc-options 138 | (list (shell-quote-argument buffer-file-name) 139 | ">" 140 | (shell-quote-argument (less-css--output-path)))) 141 | " "))) 142 | 143 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 144 | ;; Minor mode 145 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 146 | 147 | ;; TODO: interpolation ("@{val}"), escaped values (~"..."), JS eval (~`...`), custom faces 148 | (defconst less-css-font-lock-keywords 149 | '(;; Variables 150 | ("@[a-z_-][a-z-_0-9]*" . font-lock-constant-face) 151 | ("&" . font-lock-preprocessor-face) 152 | ;; Mixins 153 | ("\\(?:[ \t{;]\\|^\\)\\(\\.[a-z_-][a-z-_0-9]*\\)[ \t]*;" . (1 font-lock-keyword-face))) 154 | ) 155 | 156 | (defun less-css-indent-line () 157 | "Indent current line according to LESS CSS indentation rules." 158 | (let ((css-navigation-syntax-table less-css-mode-syntax-table)) 159 | (css-indent-line))) 160 | 161 | ;;;###autoload 162 | (define-derived-mode less-css-mode css-mode "LESS" 163 | "Major mode for editing LESS files, http://lesscss.org/ 164 | Special commands: 165 | \\{less-css-mode-map}" 166 | (font-lock-add-keywords nil less-css-font-lock-keywords) 167 | ;; cpp-style comments 168 | (modify-syntax-entry ?/ ". 124b" less-css-mode-syntax-table) 169 | (modify-syntax-entry ?* ". 23" less-css-mode-syntax-table) 170 | (modify-syntax-entry ?\n "> b" less-css-mode-syntax-table) 171 | ;; Special chars that sometimes come at the beginning of words. 172 | (modify-syntax-entry ?. "'" less-css-mode-syntax-table) 173 | 174 | (set (make-local-variable 'comment-start) "//") 175 | (set (make-local-variable 'comment-end) "") 176 | (set (make-local-variable 'indent-line-function) 'less-css-indent-line) 177 | 178 | (add-hook 'after-save-hook 'less-css-compile-maybe nil t)) 179 | 180 | (define-key less-css-mode-map "\C-c\C-c" 'less-css-compile) 181 | 182 | ;;;###autoload 183 | (add-to-list 'auto-mode-alist '("\\.less" . less-css-mode)) 184 | 185 | 186 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 187 | ;; Wiring for `flymake-mode' 188 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 189 | 190 | ;;;###autoload 191 | (defun flymake-less-css-init () 192 | "Flymake support for LESS files" 193 | (let* ((temp-file (flymake-init-create-temp-buffer-copy 194 | 'flymake-create-temp-inplace)) 195 | (local-file (file-relative-name 196 | temp-file 197 | (file-name-directory buffer-file-name)))) 198 | (list less-css-lessc-command (append less-css-lessc-options (list local-file))))) 199 | 200 | (push '(".+\\.less$" flymake-less-css-init) flymake-allowed-file-name-masks) 201 | 202 | (push (list less-css-default-error-regex 2 1 nil 2) flymake-err-line-patterns) 203 | 204 | 205 | (provide 'less-css-mode) 206 | ;;; less-css-mode.el ends here 207 | -------------------------------------------------------------------------------- /marmalade-repo-test/packages/elixir-mix/0.0.2/elixir-mix-0.0.2.el: -------------------------------------------------------------------------------- 1 | ;;; elixir-mix.el --- Emacs integration for Elixir's elixir-mix 2 | ;; 3 | ;; Filename: elixir-mix.el 4 | ;; Description: Integration of Elixir's building and deployment tool: mix into Emacs. 5 | ;; Author: Samuel Tonini 6 | ;; Maintainer: Samuel Tonini 7 | ;; Created: So Jun 9 10:01:02 2013 (+0200) 8 | ;; Version: 0.0.2 9 | ;; URL: http://github.com/tonini/elixir-mix.el 10 | ;; Keywords: elixir, mix, elixir-mix 11 | 12 | ;; This program is free software; you can redistribute it and/or 13 | ;; modify it under the terms of the GNU General Public License as 14 | ;; published by the Free Software Foundation; either version 3, or 15 | ;; (at your option) any later version. 16 | ;; 17 | ;; This program is distributed in the hope that it will be useful, 18 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | ;; General Public License for more details. 21 | ;; 22 | ;; You should have received a copy of the GNU General Public License 23 | ;; along with this program; see the file COPYING. If not, write to 24 | ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth 25 | ;; Floor, Boston, MA 02110-1301, USA. 26 | 27 | ;;; Commentary: 28 | ;; 29 | ;; Basic steps to setup: 30 | ;; 31 | ;; (add-to-list 'load-path "~/path/to/elixir-mix.el/") 32 | ;; (require 'elixir-mix) 33 | ;; (global-elixir-mix-mode) 34 | ;; 35 | ;; Interesting variables are: 36 | ;; 37 | ;; `elixir-mix-command` 38 | ;; 39 | ;; Path to the executable command 40 | ;; 41 | ;; 42 | ;; `elixir-mix-buffer-name` 43 | ;; 44 | ;; Name for the buffer used for mix shell output. 45 | ;; 46 | ;; Major commands are: 47 | ;; 48 | ;; M-x elixir-mix-new 49 | ;; 50 | ;; Create a new Elixir application. 51 | ;; 52 | ;; M-x elixir-mix-test 53 | ;; 54 | ;; Run the whole Elixir application test suite. 55 | ;; 56 | ;; M-x elixir-mix-test-this-buffer 57 | ;; 58 | ;; Run the current buffer through command. 59 | ;; 60 | ;; M-x elixir-mix-compile 61 | ;; 62 | ;; Compile the whole Elixir application. 63 | ;; 64 | ;; M-x elixir-mix-run 65 | ;; 66 | ;; Runs the given expression in the Elixir application context. 67 | ;; 68 | ;; M-x elixir-mix-deps-with-prompt 69 | ;; 70 | ;; Prompt for mix deps commands. 71 | ;; 72 | ;; M-x elixir-mix-local-with-prompt 73 | ;; 74 | ;; Prompt for mix local commands. 75 | ;; 76 | ;; M-x elixir-mix-deps-install 77 | ;; 78 | ;; Prompt for mix local.install or . 79 | ;; 80 | ;; M-x elixir-mix-deps-install-with-path 81 | ;; 82 | ;; Runs deps.install and prompt for a as argument. 83 | ;; 84 | ;; M-x elixir-mix-deps-install-with-url 85 | ;; 86 | ;; Runs deps.install and prompt for a as argument. 87 | ;; 88 | ;; M-x elixir-mix-help 89 | ;; 90 | ;; Show help output for a specific mix command. 91 | ;; 92 | ;; M-x elixir-mix-execute 93 | ;; 94 | ;; Run any command in the context of the application, 95 | ;; except `help` and `new`. 96 | ;; Just run any command as you like, including arguments 97 | ;; for the specific command. (example: test --quick) 98 | ;; 99 | 100 | ;;; Code: 101 | 102 | (defcustom elixir-mix-command "mix" 103 | "The shell command for mix" 104 | :type 'string 105 | :group 'elixir-mix) 106 | 107 | (defvar elixir-mix-buffer-name "*MIX*" 108 | "Name of the mix output buffer.") 109 | 110 | (defvar elixir-mix--elixir-project-root-indicators 111 | '("mix.exs" "mix.lock" ".git") 112 | "List of files and directories which indicate a elixir project root.") 113 | 114 | (defvar elixir-mix--deps-commands 115 | '("deps" "deps.clean" "deps.compile" "deps.get" "deps.unlock" "deps.unlock") 116 | "List of all deps.* available commands.") 117 | 118 | (defvar elixir-mix--local-commands 119 | '("local" "local.install" "local.rebar" "local.uninstall") 120 | "List of all local.* available commands.") 121 | 122 | (defvar elixir-mix--local-install-option-types 123 | '("path" "url") 124 | "List of local.install option types.") 125 | 126 | (defun elixir-mix--elixir-project-root-directory-p (a-directory) 127 | "Returns t if a-directory is the elixir project root" 128 | (equal a-directory (file-name-directory (directory-file-name a-directory)))) 129 | 130 | (defun elixir-mix--elixir-project-root (&optional directory) 131 | "Finds the root directory of the project by walking the 132 | directory tree until it finds a elixir project root indicator." 133 | (let* ((directory (file-name-as-directory (or directory (expand-file-name default-directory)))) 134 | (present-files (directory-files directory))) 135 | (cond ((elixir-mix--elixir-project-root-directory-p directory) nil) 136 | ((> (length (intersection present-files elixir-mix--elixir-project-root-indicators :test 'string=)) 0) directory) 137 | (t (elixir-mix--elixir-project-root (file-name-directory (directory-file-name directory))))))) 138 | 139 | (defun elixir-mix--get-buffer (name) 140 | "Get and kills a buffer if exists and returns a new one." 141 | (let ((buffer (get-buffer name))) 142 | (when buffer (kill-buffer buffer)) 143 | (generate-new-buffer name))) 144 | 145 | (defun elixir-mix--buffer-setup (buffer) 146 | "Setup the mix buffer before display." 147 | (display-buffer buffer) 148 | (with-current-buffer buffer 149 | (setq buffer-read-only nil) 150 | (local-set-key "q" 'quit-window))) 151 | 152 | (defun elixir-mix--run-command-async (command) 153 | (let ((buffer (elixir-mix--get-buffer elixir-mix-buffer-name))) 154 | (async-shell-command (format "%s %s" elixir-mix-command command) buffer) 155 | (elixir-mix--buffer-setup buffer))) 156 | 157 | (defun elixir-mix--completing-read (prompt command-list) 158 | (completing-read prompt command-list nil t nil nil (car command-list))) 159 | 160 | (defun elixir-mix-new (name) 161 | "Create a new elixir project with mix." 162 | (interactive "Gmix new: ") 163 | (elixir-mix--run-command-async (format "new %s" name))) 164 | 165 | (defun elixir-mix-test () 166 | "Run the whole elixir test suite." 167 | (interactive) 168 | (elixir-mix-execute "test")) 169 | 170 | (defun elixir-mix-test-this-buffer () 171 | "Run the current buffer through mix test." 172 | (interactive) 173 | (elixir-mix-execute (format "test %s" buffer-file-name))) 174 | 175 | (defun elixir-mix-compile () 176 | "Compile the whole elixir project." 177 | (interactive) 178 | (elixir-mix-execute "compile")) 179 | 180 | (defun elixir-mix-run (code) 181 | "Runs the given expression in the elixir application context." 182 | (interactive "Mmix run: ") 183 | (elixir-mix-execute (format "run '%s'" code))) 184 | 185 | (defun elixir-mix-deps-with-prompt (command) 186 | "Prompt for mix deps commands." 187 | (interactive 188 | (list (elixir-mix--completing-read "mix deps: " elixir-mix--deps-commands))) 189 | (elixir-mix-execute command)) 190 | 191 | (defun elixir-mix-local-with-prompt (command) 192 | "Prompt for mix local commands." 193 | (interactive 194 | (list (elixir-mix--completing-read "mix local: " elixir-mix--local-commands))) 195 | (if (string= command "local.install") 196 | (call-interactively 'elixir-mix-deps-install) 197 | (elixir-mix-execute command))) 198 | 199 | (defun elixir-mix-deps-install (path-or-url) 200 | "Prompt for mix local.install or ." 201 | (interactive 202 | (list (completing-read "mix local.install FORMAT: " 203 | elixir-mix--local-install-option-types 204 | nil t nil nil (car elixir-mix--local-install-option-types)))) 205 | (if (string= path-or-url (car elixir-mix--local-install-option-types)) 206 | (call-interactively 'elixir-mix-deps-install-with-path) 207 | (call-interactively 'elixir-mix-deps-install-with-url))) 208 | 209 | (defun elixir-mix-deps-install-with-path (path) 210 | "Runs deps.install and prompt for a as argument." 211 | (interactive "fmix local.install PATH: ") 212 | (elixir-mix-execute (format "local.install %s" path))) 213 | 214 | (defun elixir-mix-deps-install-with-url (url) 215 | "Runs deps.install and prompt for a as argument." 216 | (interactive "Mmix local.install URL: ") 217 | (elixir-mix-execute (format "local.install %s" url))) 218 | 219 | (defun elixir-mix-help (command) 220 | "Show help output for a specific mix command." 221 | (interactive "Mmix help: ") 222 | (elixir-mix--run-command-async (format "help %s" command))) 223 | 224 | (defun elixir-mix-execute (command) 225 | "Run a mix command." 226 | (interactive "Mmix: ") 227 | (cond ((string= command "") (error "There is no such command.")) 228 | ((string-match "^new" command) 229 | (error "Please use the `elixir-mix-new (name)` function to create a new elixir project.")) 230 | ((string-match "^help" command) 231 | (error "Please use the `elixir-mix-help (command)` function to get a mix command specific help."))) 232 | (let ((project-root (elixir-mix--elixir-project-root))) 233 | (when (not project-root) (error "Couldn't find any elixir project root.")) 234 | (setq default-directory (elixir-mix--elixir-project-root)) 235 | (elixir-mix--run-command-async command))) 236 | 237 | ;;;###autoload 238 | (define-minor-mode global-elixir-mix-mode 239 | "Toggle global-elixir-mix-mode to use elixir's mix build tool within emacs." 240 | :global t) 241 | 242 | (provide 'elixir-mix) 243 | 244 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 245 | ;;; elixir-mix.el ends here 246 | --------------------------------------------------------------------------------