about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2017-08-20T04·16-0700
committerMatthew Bauer <mjbauer95@gmail.com>2017-08-20T04·16-0700
commit2c75945de58defcfae23cb30a9003695fbcd2f3d (patch)
treeb1b23c11bd9dcb6f6ea8db4acc4c33da677f134a
parent898a3f729cb33d2ec5bf28db76c5a21b0e51e13f (diff)
Remove nix-mode.el from Nix.
This removes the file nix-mode.el from Nix. The file is now available within the
repository https://github.com/NixOS/nix-mode.

Fixes #662
Fixes #1040
Fixes #1054
Fixes #1055
Closes #1119
Fixes #1419

NOTE: all of the above should be fixed within NixOS/nix-mode. If one of those
hasn’t please reopen within NixOS/nix-mode and not within NixOS/nix.
-rw-r--r--Makefile1
-rw-r--r--doc/manual/release-notes/rl-1.12.xml6
-rw-r--r--misc/emacs/README10
-rw-r--r--misc/emacs/local.mk1
-rw-r--r--misc/emacs/nix-mode.el177
-rw-r--r--nix.spec.in39
-rw-r--r--release.nix2
7 files changed, 7 insertions, 229 deletions
diff --git a/Makefile b/Makefile
index 40ac4e72dbc3..5d8e990cc5c0 100644
--- a/Makefile
+++ b/Makefile
@@ -23,7 +23,6 @@ makefiles = \
   misc/systemd/local.mk \
   misc/launchd/local.mk \
   misc/upstart/local.mk \
-  misc/emacs/local.mk \
   doc/manual/local.mk \
   tests/local.mk
 
diff --git a/doc/manual/release-notes/rl-1.12.xml b/doc/manual/release-notes/rl-1.12.xml
index 551139f3a66e..d9bdd9eddd44 100644
--- a/doc/manual/release-notes/rl-1.12.xml
+++ b/doc/manual/release-notes/rl-1.12.xml
@@ -387,6 +387,12 @@ configureFlags = "--prefix=${placeholder "out"} --includedir=${placeholder "dev"
     (b8867a0239b1930a16f9ef3f7f3e864b01416dff))</para>
   </listitem>
 
+  <listitem>
+    <para><filename>nix-mode.el</filename> has been removed from Nix. It is now a separate repository
+    in <uri>https://github.com/NixOS/nix-mode</uri> and can be installed through the MELPA
+    package repository.</para>
+  </listitem>
+
 </itemizedlist>
 
 <para>This release has contributions from TBD.</para>
diff --git a/misc/emacs/README b/misc/emacs/README
deleted file mode 100644
index 8c87f67d5718..000000000000
--- a/misc/emacs/README
+++ /dev/null
@@ -1,10 +0,0 @@
-The Nix Emacs mode supports syntax highlighting, somewhat sensible
-indenting, and refilling of comments.
-
-To enable Nix mode in Emacs, add something like this to your ~/.emacs
-file:
-
-  (load "/nix/share/emacs/site-lisp/nix-mode.el")
-
-This automatically causes Nix mode to be activated for all files with
-extension `.nix'.
diff --git a/misc/emacs/local.mk b/misc/emacs/local.mk
deleted file mode 100644
index 8e06b881bcdf..000000000000
--- a/misc/emacs/local.mk
+++ /dev/null
@@ -1 +0,0 @@
-$(eval $(call install-data-in,$(d)/nix-mode.el,$(datadir)/emacs/site-lisp))
diff --git a/misc/emacs/nix-mode.el b/misc/emacs/nix-mode.el
deleted file mode 100644
index e129e9efe1d4..000000000000
--- a/misc/emacs/nix-mode.el
+++ /dev/null
@@ -1,177 +0,0 @@
-;;; nix-mode.el --- Major mode for editing Nix expressions
-
-;; Author: Eelco Dolstra
-;; URL: https://github.com/NixOS/nix/tree/master/misc/emacs
-;; Version: 1.0
-
-;;; Commentary:
-
-;;; Code:
-
-(defun nix-syntax-match-antiquote (limit)
-  (let ((pos (next-single-char-property-change (point) 'nix-syntax-antiquote
-                                               nil limit)))
-    (when (and pos (> pos (point)))
-      (goto-char pos)
-      (let ((char (char-after pos)))
-        (pcase char
-          (`?$
-           (forward-char 2))
-          (`?}
-           (forward-char 1)))
-        (set-match-data (list pos (point)))
-        t))))
-
-(defconst nix-font-lock-keywords
-  '("\\_<if\\_>" "\\_<then\\_>" "\\_<else\\_>" "\\_<assert\\_>" "\\_<with\\_>"
-    "\\_<let\\_>" "\\_<in\\_>" "\\_<rec\\_>" "\\_<inherit\\_>" "\\_<or\\_>"
-    ("\\_<true\\_>" . font-lock-builtin-face)
-    ("\\_<false\\_>" . font-lock-builtin-face)
-    ("\\_<null\\_>" . font-lock-builtin-face)
-    ("\\_<import\\_>" . font-lock-builtin-face)
-    ("\\_<derivation\\_>" . font-lock-builtin-face)
-    ("\\_<baseNameOf\\_>" . font-lock-builtin-face)
-    ("\\_<toString\\_>" . font-lock-builtin-face)
-    ("\\_<isNull\\_>" . font-lock-builtin-face)
-    ("[a-zA-Z][a-zA-Z0-9\\+-\\.]*:[a-zA-Z0-9%/\\?:@&=\\+\\$,_\\.!~\\*'-]+"
-     . font-lock-constant-face)
-    ("\\<\\([a-zA-Z_][a-zA-Z0-9_'\-\.]*\\)[ \t]*="
-     (1 font-lock-variable-name-face nil nil))
-    ("<[a-zA-Z0-9._\\+-]+\\(/[a-zA-Z0-9._\\+-]+\\)*>"
-     . font-lock-constant-face)
-    ("[a-zA-Z0-9._\\+-]*\\(/[a-zA-Z0-9._\\+-]+\\)+"
-     . font-lock-constant-face)
-    (nix-syntax-match-antiquote 0 font-lock-preprocessor-face t))
-  "Font lock keywords for nix.")
-
-(defvar nix-mode-syntax-table
-  (let ((table (make-syntax-table)))
-    (modify-syntax-entry ?/ ". 14" table)
-    (modify-syntax-entry ?* ". 23" table)
-    (modify-syntax-entry ?# "< b" table)
-    (modify-syntax-entry ?\n "> b" table)
-    table)
-  "Syntax table for Nix mode.")
-
-(defun nix-syntax-propertize-escaped-antiquote ()
-  "Set syntax properies for escaped antiquote marks."
-  nil)
-
-(defun nix-syntax-propertize-multiline-string ()
-  "Set syntax properies for multiline string delimiters."
-  (let* ((start (match-beginning 0))
-         (end (match-end 0))
-         (context (save-excursion (save-match-data (syntax-ppss start))))
-         (string-type (nth 3 context)))
-    (pcase string-type
-      (`t
-       ;; inside a multiline string
-       ;; ending multi-line string delimiter
-       (put-text-property (1- end) end
-                          'syntax-table (string-to-syntax "|")))
-      (`nil
-       ;; beginning multi-line string delimiter
-       (put-text-property start (1+ start)
-                          'syntax-table (string-to-syntax "|"))))))
-
-(defun nix-syntax-propertize-antiquote ()
-  "Set syntax properties for antiquote marks."
-  (let* ((start (match-beginning 0)))
-    (put-text-property start (1+ start)
-                       'syntax-table (string-to-syntax "|"))
-    (put-text-property start (+ start 2)
-                       'nix-syntax-antiquote t)))
-
-(defun nix-syntax-propertize-close-brace ()
-  "Set syntax properties for close braces.
-If a close brace `}' ends an antiquote, the next character begins a string."
-  (let* ((start (match-beginning 0))
-         (end (match-end 0))
-         (context (save-excursion (save-match-data (syntax-ppss start))))
-         (open (nth 1 context)))
-    (when open ;; a corresponding open-brace was found
-      (let* ((antiquote (get-text-property open 'nix-syntax-antiquote)))
-        (when antiquote
-          (put-text-property (+ start 1) (+ start 2)
-                             'syntax-table (string-to-syntax "|"))
-          (put-text-property start (1+ start)
-                             'nix-syntax-antiquote t))))))
-
-(defun nix-syntax-propertize (start end)
-  "Special syntax properties for Nix."
-  ;; search for multi-line string delimiters
-  (goto-char start)
-  (remove-text-properties start end '(syntax-table nil nix-syntax-antiquote nil))
-  (funcall
-   (syntax-propertize-rules
-    ("''\\${"
-     (0 (ignore (nix-syntax-propertize-escaped-antiquote))))
-    ("''"
-     (0 (ignore (nix-syntax-propertize-multiline-string))))
-    ("\\${"
-     (0 (ignore (nix-syntax-propertize-antiquote))))
-    ("}"
-     (0 (ignore (nix-syntax-propertize-close-brace)))))
-   start end))
-
-(defun nix-indent-line ()
-  "Indent current line in a Nix expression."
-  (interactive)
-  (indent-relative-maybe))
-
-
-;;;###autoload
-(define-derived-mode nix-mode prog-mode "Nix"
-  "Major mode for editing Nix expressions.
-
-The following commands may be useful:
-
-  '\\[newline-and-indent]'
-    Insert a newline and move the cursor to align with the previous
-    non-empty line.
-
-  '\\[fill-paragraph]'
-    Refill a paragraph so that all lines are at most `fill-column'
-    lines long.  This should do the right thing for comments beginning
-    with `#'.  However, this command doesn't work properly yet if the
-    comment is adjacent to code (i.e., no intervening empty lines).
-    In that case, select the text to be refilled and use
-    `\\[fill-region]' instead.
-
-The hook `nix-mode-hook' is run when Nix mode is started.
-
-\\{nix-mode-map}
-"
-  (set-syntax-table nix-mode-syntax-table)
-
-  ;; Font lock support.
-  (setq-local font-lock-defaults '(nix-font-lock-keywords nil nil nil nil))
-
-  ;; Special syntax properties for Nix
-  (setq-local syntax-propertize-function 'nix-syntax-propertize)
-
-  ;; Look at text properties when parsing
-  (setq-local parse-sexp-lookup-properties t)
-
-  ;; Automatic indentation [C-j].
-  (set (make-local-variable 'indent-line-function) 'nix-indent-line)
-
-  ;; Indenting of comments.
-  (set (make-local-variable 'comment-start) "# ")
-  (set (make-local-variable 'comment-end) "")
-  (set (make-local-variable 'comment-start-skip) "\\(^\\|\\s-\\);?#+ *")
-
-  ;; Filling of comments.
-  (set (make-local-variable 'adaptive-fill-mode) t)
-  (set (make-local-variable 'paragraph-start) "[ \t]*\\(#+[ \t]*\\)?$")
-  (set (make-local-variable 'paragraph-separate) paragraph-start))
-
-
-;;;###autoload
-(progn
-  (add-to-list 'auto-mode-alist '("\\.nix\\'" . nix-mode))
-  (add-to-list 'auto-mode-alist '("\\.nix.in\\'" . nix-mode)))
-
-(provide 'nix-mode)
-
-;;; nix-mode.el ends here
diff --git a/nix.spec.in b/nix.spec.in
index 88f0d04d3901..241e28f3678b 100644
--- a/nix.spec.in
+++ b/nix.spec.in
@@ -60,33 +60,6 @@ Requires:       %{name} = %{version}-%{release}
 %description   doc
 The %{name}-doc package contains documentation files for %{name}.
 
-
-%package -n emacs-%{name}
-Summary:        Nix mode for Emacs
-%if 0%{?rhel} && 0%{?rhel} < 7
-Group:          Applications/Editors
-%endif
-BuildArch:      noarch
-BuildRequires:  emacs
-Requires:       emacs(bin) >= %{_emacs_version}
-
-%description -n emacs-%{name}
-This package provides a major mode for editing Nix expressions.
-
-%package -n emacs-%{name}-el
-Summary:        Elisp source files for emacs-%{name}
-%if 0%{?rhel} && 0%{?rhel} < 7
-Group:          Applications/Editors
-%endif
-BuildArch:      noarch
-Requires:       emacs-%{name} = %{version}-%{release}
-
-%description -n emacs-%{name}-el
-This package contains the elisp source file for the Nix major mode for
-GNU Emacs. You do not need to install this package to run Nix. Install
-the emacs-%{name} package to edit Nix expressions with GNU Emacs.
-
-
 %prep
 %setup -q
 
@@ -100,7 +73,6 @@ extraFlags=
            --docdir=%{_defaultdocdir}/%{name}-doc-%{version} \
            $extraFlags
 make -j$NIX_BUILD_CORES -l$NIX_BUILD_CORES
-%{_emacs_bytecompile} misc/emacs/nix-mode.el
 
 
 %install
@@ -126,9 +98,6 @@ done
 # (until this is fixed in the relevant Makefile)
 chmod -x $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/nix.sh
 
-# Copy the byte-compiled mode file by hand
-cp -p misc/emacs/nix-mode.elc $RPM_BUILD_ROOT%{_emacs_sitelispdir}/
-
 # we ship this file in the base package
 rm -f $RPM_BUILD_ROOT%{_defaultdocdir}/%{name}-doc-%{version}/README
 
@@ -166,7 +135,6 @@ systemctl start  nix-daemon.socket
 %{_prefix}/lib/systemd/system/nix-daemon.socket
 %{_prefix}/lib/systemd/system/nix-daemon.service
 %endif
-%{_datadir}/emacs/site-lisp/nix-mode.el
 %{_datadir}/nix
 %{_mandir}/man1/*.1*
 %{_mandir}/man5/*.5*
@@ -181,10 +149,3 @@ systemctl start  nix-daemon.socket
 %files doc
 %docdir %{_defaultdocdir}/%{name}-doc-%{version}
 %{_defaultdocdir}/%{name}-doc-%{version}
-
-%files -n emacs-%{name}
-%{_emacs_sitelispdir}/*.elc
-#{_emacs_sitestartdir}/*.el
-
-%files -n emacs-%{name}-el
-%{_emacs_sitelispdir}/*.el
diff --git a/release.nix b/release.nix
index 796591cc1671..834269ff7dc2 100644
--- a/release.nix
+++ b/release.nix
@@ -310,7 +310,7 @@ let
       src = jobs.tarball;
       diskImage = (diskImageFun vmTools.diskImageFuns)
         { extraPackages =
-            [ "sqlite" "sqlite-devel" "bzip2-devel" "emacs" "libcurl-devel" "openssl-devel" "xz-devel" "libseccomp-devel" ]
+            [ "sqlite" "sqlite-devel" "bzip2-devel" "libcurl-devel" "openssl-devel" "xz-devel" "libseccomp-devel" ]
             ++ extraPackages; };
       memSize = 1024;
       meta.schedulingPriority = 50;