[elpa] master ad82b99 3/3: Merge commit 'ea3958f45cb468be0f11e95c24d09e10a389fee0'
branch: master commit ad82b992bbbd8ae5eb4c4352939704929f56cdc8 Merge: be54382 ea3958f Author: Artur Malabarba Commit: Artur Malabarba Merge commit 'ea3958f45cb468be0f11e95c24d09e10a389fee0' --- packages/nameless/README.org |8 packages/nameless/nameless.el |4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/nameless/README.org b/packages/nameless/README.org index 75f8835..367ffed 100644 --- a/packages/nameless/README.org +++ b/packages/nameless/README.org @@ -22,13 +22,13 @@ You can configure a string to use instead of ~:~ by setting the You can even just hide the prefix completely by setting this variable to an empty string. -While the mode is active, the C-c C-- key inserts the +While the mode is active, the =C-c C--= key inserts the package namespace if appropriate. * Configuration ** Quickly typing the namespace -~nameless-mode~ binds the C-c C-- key to +~nameless-mode~ binds the =C-c C--= key to ~nameless-insert-name~, which immediately inserts the current name for you, or even expands aliases to the names they point to. @@ -39,7 +39,7 @@ fl C-c C-- → font-lock- #+END_SRC There’s also a command called ~nameless-insert-name-or-self-insert~. -You can bind this to the _ key and make it even faster to +You can bind this to the =_= key and make it even faster to insert the name. ** Configuring the namespace name Nameless guesses the package name with the ~lm-get-package-name~ @@ -75,7 +75,7 @@ as a file-local variable. ;; nameless-aliases: (("c" . "cider")) ;; End: #+END_SRC -/Note that there’s no ~quote~ before ~((c~!/\\ +Note that there’s no ~quote~ before ~((c~!\\ You can also configure it for a whole project, by setting it as a dir-local variable. ** Indentation and paragraph filling diff --git a/packages/nameless/nameless.el b/packages/nameless/nameless.el index a0d5177..f7b47ef 100644 --- a/packages/nameless/nameless.el +++ b/packages/nameless/nameless.el @@ -4,7 +4,7 @@ ;; Author: Artur Malabarba ;; Keywords: convenience, lisp -;; Version: 0.4 +;; Version: 0.4.1 ;; Package-Requires: ((emacs "24.4")) ;; This program is free software; you can redistribute it and/or modify @@ -227,7 +227,7 @@ Return S." (ignore-errors (string-match "\\.el\\'" (lm-get-package-name (progn (unless nameless-current-name - (setq nameless-current-name (replace-regexp-in-string "\\.[^.]*\\'" "" (lm-get-package-name + (setq nameless-current-name (replace-regexp-in-string "\\(-mode\\)?\\.[^.]*\\'" "" (lm-get-package-name (add-function :filter-return (local 'filter-buffer-substring-function) #'nameless--filter-string) (apply #'nameless--add-keywords
[elpa] master ea3958f 2/3: Improve name discovery
branch: master commit ea3958f45cb468be0f11e95c24d09e10a389fee0 Author: Artur Malabarba Commit: Artur Malabarba Improve name discovery --- nameless.el |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nameless.el b/nameless.el index a0d5177..f7b47ef 100644 --- a/nameless.el +++ b/nameless.el @@ -4,7 +4,7 @@ ;; Author: Artur Malabarba ;; Keywords: convenience, lisp -;; Version: 0.4 +;; Version: 0.4.1 ;; Package-Requires: ((emacs "24.4")) ;; This program is free software; you can redistribute it and/or modify @@ -227,7 +227,7 @@ Return S." (ignore-errors (string-match "\\.el\\'" (lm-get-package-name (progn (unless nameless-current-name - (setq nameless-current-name (replace-regexp-in-string "\\.[^.]*\\'" "" (lm-get-package-name + (setq nameless-current-name (replace-regexp-in-string "\\(-mode\\)?\\.[^.]*\\'" "" (lm-get-package-name (add-function :filter-return (local 'filter-buffer-substring-function) #'nameless--filter-string) (apply #'nameless--add-keywords
[elpa] master updated (be54382 -> ad82b99)
malabarba pushed a change to branch master. from be54382 Merge ack master from github.com:leoliu/ack-el new 5d6d41f Fix readme new ea3958f Improve name discovery new ad82b99 Merge commit 'ea3958f45cb468be0f11e95c24d09e10a389fee0' Summary of changes: packages/nameless/README.org |8 packages/nameless/nameless.el |4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-)
[elpa] master 5d6d41f 1/3: Fix readme
branch: master commit 5d6d41fca6ebe90af1e9a5cca7e0eca246e784dd Author: Artur Malabarba Commit: Artur Malabarba Fix readme --- README.org |8 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.org b/README.org index 75f8835..367ffed 100644 --- a/README.org +++ b/README.org @@ -22,13 +22,13 @@ You can configure a string to use instead of ~:~ by setting the You can even just hide the prefix completely by setting this variable to an empty string. -While the mode is active, the C-c C-- key inserts the +While the mode is active, the =C-c C--= key inserts the package namespace if appropriate. * Configuration ** Quickly typing the namespace -~nameless-mode~ binds the C-c C-- key to +~nameless-mode~ binds the =C-c C--= key to ~nameless-insert-name~, which immediately inserts the current name for you, or even expands aliases to the names they point to. @@ -39,7 +39,7 @@ fl C-c C-- → font-lock- #+END_SRC There’s also a command called ~nameless-insert-name-or-self-insert~. -You can bind this to the _ key and make it even faster to +You can bind this to the =_= key and make it even faster to insert the name. ** Configuring the namespace name Nameless guesses the package name with the ~lm-get-package-name~ @@ -75,7 +75,7 @@ as a file-local variable. ;; nameless-aliases: (("c" . "cider")) ;; End: #+END_SRC -/Note that there’s no ~quote~ before ~((c~!/\\ +Note that there’s no ~quote~ before ~((c~!\\ You can also configure it for a whole project, by setting it as a dir-local variable. ** Indentation and paragraph filling
[elpa] master 4ce354f 5/7: Doc
branch: master commit 4ce354fab53c787ac39d8064801d2a7ffa8d964c Author: Artur Malabarba Commit: Artur Malabarba Doc --- nameless.el |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/nameless.el b/nameless.el index 29b7548..bdaefe8 100644 --- a/nameless.el +++ b/nameless.el @@ -147,9 +147,10 @@ displayed as `::internal-impl', instead of `:-internal-impl'." (nameless--ensure)) (defun nameless--add-keywords (&rest r) - "Add font-lock keywords displaying REGEXP as DISPLAY. + "Add font-lock keywords displaying ALIAS as DISPLAY. +ALIAS may be nil, in which case it refers to `nameless-current-name'. -\(fn (regexp . display) [(regexp . display) ...])" +\(fn (alias . display) [(alias . display) ...])" (setq-local font-lock-extra-managed-props `(composition display ,@font-lock-extra-managed-props)) (let ((kws (mapcar (lambda (x) `(,(nameless--name-regexp (cdr x)) 1 (nameless--compose-as ,(car x r)))
[elpa] master 11dbed7 7/7: Merge commit '29bfd8704b99f0b8600ea2bdc1f467df04c9e8bc'
branch: master commit 11dbed76e7c17ee9a919da0cf4301c20d942df3c Merge: ad82b99 29bfd87 Author: Artur Malabarba Commit: Artur Malabarba Merge commit '29bfd8704b99f0b8600ea2bdc1f467df04c9e8bc' --- packages/nameless/README.org | 11 + packages/nameless/nameless.el | 50 +++- 2 files changed, 45 insertions(+), 16 deletions(-) diff --git a/packages/nameless/README.org b/packages/nameless/README.org index 367ffed..49ea800 100644 --- a/packages/nameless/README.org +++ b/packages/nameless/README.org @@ -78,6 +78,17 @@ as a file-local variable. Note that there’s no ~quote~ before ~((c~!\\ You can also configure it for a whole project, by setting it as a dir-local variable. +** Private symbols + +Private symbols in elisp are written with an extra dash after the +prefix (e.g., ~foobar--indent-impl~). With Nameless, these are usually +displayed as ~:-indent-impl~, but you can also make them be displayed +as ~::indent-impl~ by setting + +#+BEGIN_SRC emacs-lisp +(setq nameless-private-prefix t) +#+END_SRC + ** Indentation and paragraph filling Hiding parts of symbols could affect the way Emacs indents your code and fills your paragraphs. Nameless lets you decide whether you want diff --git a/packages/nameless/nameless.el b/packages/nameless/nameless.el index f7b47ef..e79b01e 100644 --- a/packages/nameless/nameless.el +++ b/packages/nameless/nameless.el @@ -4,7 +4,7 @@ ;; Author: Artur Malabarba ;; Keywords: convenience, lisp -;; Version: 0.4.1 +;; Version: 0.5 ;; Package-Requires: ((emacs "24.4")) ;; This program is free software; you can redistribute it and/or modify @@ -98,6 +98,12 @@ for it to take effect." (const :tag "Don't affect indentation" nil) (const :tag "Only outside strings" 'outside-strings))) +(defcustom nameless-private-prefix nil + "If non-nil, private symbols are displayed with a double prefix. +For instance, the function `foobar--internal-impl' will be +displayed as `::internal-impl', instead of `:-internal-impl'." + :type 'boolean) + ;;; Font-locking (defun nameless--make-composition (s) @@ -116,9 +122,16 @@ for it to take effect." (not (nth 3 (syntax-ppss))) (dis (concat display nameless-prefix))) (when compose -(compose-region (match-beginning 1) -(match-end 1) -(nameless--make-composition dis))) +(if (and nameless-private-prefix + (equal "-" (substring (match-string 0) -1))) +(progn + (setq dis (concat dis nameless-prefix)) + (compose-region (match-beginning 0) + (match-end 0) + (nameless--make-composition dis))) + (compose-region (match-beginning 1) + (match-end 1) + (nameless--make-composition dis `(face nameless-face ,@(unless compose (list 'display dis)) (defvar-local nameless--font-lock-keywords nil) @@ -134,9 +147,10 @@ for it to take effect." (nameless--ensure)) (defun nameless--add-keywords (&rest r) - "Add font-lock keywords displaying REGEXP as DISPLAY. + "Add font-lock keywords displaying ALIAS as DISPLAY. +ALIAS may be nil, in which case it refers to `nameless-current-name'. -\(fn (regexp . display) [(regexp . display) ...])" +\(fn (alias . display) [(alias . display) ...])" (setq-local font-lock-extra-managed-props `(composition display ,@font-lock-extra-managed-props)) (let ((kws (mapcar (lambda (x) `(,(nameless--name-regexp (cdr x)) 1 (nameless--compose-as ,(car x r))) @@ -149,15 +163,16 @@ for it to take effect." (defvar-local nameless-current-name nil) (put 'nameless-current-name 'safe-local-variable #'stringp) -(defun nameless--in-arglist-p () - "Is point inside an arglist?" +(defun nameless--in-arglist-p (l) + "Is point L inside an arglist?" (save-excursion +(goto-char l) (ignore-errors (backward-up-list) (or (progn (forward-sexp -1) (looking-at-p "[a-z-]lambda\\_>")) (progn (forward-sexp -1) - (looking-at-p "\\(cl-\\)?def\\(un\\|macro\\|inline\\)\\*?\\_>")) + (looking-at-p "\\(cl-\\)?def")) (defun nameless-insert-name (&optional noerror) "Insert `nameless-current-name' or the alias at point. @@ -196,13 +211,16 @@ configured, or if `nameless-current-name' is nil." (defun nameless-insert-name-or-self-insert (&optional self-insert) "Insert the name of current package, with a hyphen." (interactive "P") - (if (or self-insert - (not nameless-current-name) - (eq (char-before) ?\\) - (nameless--in-arglist-p)) - (call-interactively #'self-insert-command) -(or (nameless-insert-name 'noerror) -(call-interactively #'self-insert-command + (let ((l (point))) +(call-interact
[elpa] master updated (ad82b99 -> 11dbed7)
malabarba pushed a change to branch master. from ad82b99 Merge commit 'ea3958f45cb468be0f11e95c24d09e10a389fee0' new eba0fdd [Fix #2] Add option to display internal symbols with the prefix new 663f78a [Fix #8] Add undo-boundaries before inserting the prefix new b9fd4d7 Fix typo that completely broke everything new 121a841 Fix private prefixes with the `display' method new 4ce354f Doc new 29bfd87 Version bump new 11dbed7 Merge commit '29bfd8704b99f0b8600ea2bdc1f467df04c9e8bc' Summary of changes: packages/nameless/README.org | 11 + packages/nameless/nameless.el | 50 +++- 2 files changed, 45 insertions(+), 16 deletions(-)
[elpa] master b9fd4d7 3/7: Fix typo that completely broke everything
branch: master commit b9fd4d7c9cd33ace72d14505eca2b661a534e5ad Author: Artur Malabarba Commit: Artur Malabarba Fix typo that completely broke everything --- nameless.el |6 +- 1 files changed, 1 insertions(+), 5 deletions(-) diff --git a/nameless.el b/nameless.el index f7ae637..b390cdc 100644 --- a/nameless.el +++ b/nameless.el @@ -223,11 +223,7 @@ configured, or if `nameless-current-name' is nil." (defun nameless--name-regexp (name) "Return a regexp of the current name." - (concat "\\_<@?\\(_" (regexp-quote name) "-\\)\\(\\s_\\|\\sw\\)")) - -(defun nameless--private-name-regexp (name) - "Return a regexp of the current private name." - (concat "\\_<@?\\(" (regexp-quote name) "--\\)\\(\\s_\\|\\sw\\)")) + (concat "\\_<@?\\(" (regexp-quote name) "-\\)\\(\\s_\\|\\sw\\)")) (defun nameless--filter-string (s) "Remove from string S any disply or composition properties.
[elpa] master 29bfd87 6/7: Version bump
branch: master commit 29bfd8704b99f0b8600ea2bdc1f467df04c9e8bc Author: Artur Malabarba Commit: Artur Malabarba Version bump --- nameless.el |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/nameless.el b/nameless.el index bdaefe8..e79b01e 100644 --- a/nameless.el +++ b/nameless.el @@ -4,7 +4,7 @@ ;; Author: Artur Malabarba ;; Keywords: convenience, lisp -;; Version: 0.4.1 +;; Version: 0.5 ;; Package-Requires: ((emacs "24.4")) ;; This program is free software; you can redistribute it and/or modify
[elpa] master 121a841 4/7: Fix private prefixes with the `display' method
branch: master commit 121a841cd412e752cee9f458a25d29974d8fe989 Author: Artur Malabarba Commit: Artur Malabarba Fix private prefixes with the `display' method --- nameless.el |8 +--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/nameless.el b/nameless.el index b390cdc..29b7548 100644 --- a/nameless.el +++ b/nameless.el @@ -124,9 +124,11 @@ displayed as `::internal-impl', instead of `:-internal-impl'." (when compose (if (and nameless-private-prefix (equal "-" (substring (match-string 0) -1))) -(compose-region (match-beginning 0) -(match-end 0) -(nameless--make-composition (concat dis nameless-prefix))) +(progn + (setq dis (concat dis nameless-prefix)) + (compose-region (match-beginning 0) + (match-end 0) + (nameless--make-composition dis))) (compose-region (match-beginning 1) (match-end 1) (nameless--make-composition dis
[elpa] master 663f78a 2/7: [Fix #8] Add undo-boundaries before inserting the prefix
branch: master commit 663f78a78e3c41c2ee1dc1e9d2744c11d5c948e6 Author: Artur Malabarba Commit: Artur Malabarba [Fix #8] Add undo-boundaries before inserting the prefix --- nameless.el | 26 +++--- 1 files changed, 15 insertions(+), 11 deletions(-) diff --git a/nameless.el b/nameless.el index 3d7f7b9..f7ae637 100644 --- a/nameless.el +++ b/nameless.el @@ -160,15 +160,16 @@ displayed as `::internal-impl', instead of `:-internal-impl'." (defvar-local nameless-current-name nil) (put 'nameless-current-name 'safe-local-variable #'stringp) -(defun nameless--in-arglist-p () - "Is point inside an arglist?" +(defun nameless--in-arglist-p (l) + "Is point L inside an arglist?" (save-excursion +(goto-char l) (ignore-errors (backward-up-list) (or (progn (forward-sexp -1) (looking-at-p "[a-z-]lambda\\_>")) (progn (forward-sexp -1) - (looking-at-p "\\(cl-\\)?def\\(un\\|macro\\|inline\\)\\*?\\_>")) + (looking-at-p "\\(cl-\\)?def")) (defun nameless-insert-name (&optional noerror) "Insert `nameless-current-name' or the alias at point. @@ -207,19 +208,22 @@ configured, or if `nameless-current-name' is nil." (defun nameless-insert-name-or-self-insert (&optional self-insert) "Insert the name of current package, with a hyphen." (interactive "P") - (if (or self-insert - (not nameless-current-name) - (eq (char-before) ?\\) - (nameless--in-arglist-p)) - (call-interactively #'self-insert-command) -(or (nameless-insert-name 'noerror) -(call-interactively #'self-insert-command + (let ((l (point))) +(call-interactively #'self-insert-command) +(unless (or self-insert +(not nameless-current-name) +(eq (char-before l) ?\\) +(nameless--in-arglist-p l)) + (undo-boundary) + (delete-region l (point)) + (unless (nameless-insert-name 'noerror) +(call-interactively #'self-insert-command) (put 'nameless-insert-name-or-self-insert 'delete-selection t) (defun nameless--name-regexp (name) "Return a regexp of the current name." - (concat "\\_<@?\\(" (regexp-quote name) "-\\)\\(\\s_\\|\\sw\\)")) + (concat "\\_<@?\\(_" (regexp-quote name) "-\\)\\(\\s_\\|\\sw\\)")) (defun nameless--private-name-regexp (name) "Return a regexp of the current private name."
[elpa] master eba0fdd 1/7: [Fix #2] Add option to display internal symbols with the prefix
branch: master commit eba0fdd7e63844ff18c1eba760eab1b1376e27db Author: Artur Malabarba Commit: Artur Malabarba [Fix #2] Add option to display internal symbols with the prefix --- README.org | 11 +++ nameless.el | 21 ++--- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/README.org b/README.org index 367ffed..49ea800 100644 --- a/README.org +++ b/README.org @@ -78,6 +78,17 @@ as a file-local variable. Note that there’s no ~quote~ before ~((c~!\\ You can also configure it for a whole project, by setting it as a dir-local variable. +** Private symbols + +Private symbols in elisp are written with an extra dash after the +prefix (e.g., ~foobar--indent-impl~). With Nameless, these are usually +displayed as ~:-indent-impl~, but you can also make them be displayed +as ~::indent-impl~ by setting + +#+BEGIN_SRC emacs-lisp +(setq nameless-private-prefix t) +#+END_SRC + ** Indentation and paragraph filling Hiding parts of symbols could affect the way Emacs indents your code and fills your paragraphs. Nameless lets you decide whether you want diff --git a/nameless.el b/nameless.el index f7b47ef..3d7f7b9 100644 --- a/nameless.el +++ b/nameless.el @@ -98,6 +98,12 @@ for it to take effect." (const :tag "Don't affect indentation" nil) (const :tag "Only outside strings" 'outside-strings))) +(defcustom nameless-private-prefix nil + "If non-nil, private symbols are displayed with a double prefix. +For instance, the function `foobar--internal-impl' will be +displayed as `::internal-impl', instead of `:-internal-impl'." + :type 'boolean) + ;;; Font-locking (defun nameless--make-composition (s) @@ -116,9 +122,14 @@ for it to take effect." (not (nth 3 (syntax-ppss))) (dis (concat display nameless-prefix))) (when compose -(compose-region (match-beginning 1) -(match-end 1) -(nameless--make-composition dis))) +(if (and nameless-private-prefix + (equal "-" (substring (match-string 0) -1))) +(compose-region (match-beginning 0) +(match-end 0) +(nameless--make-composition (concat dis nameless-prefix))) + (compose-region (match-beginning 1) + (match-end 1) + (nameless--make-composition dis `(face nameless-face ,@(unless compose (list 'display dis)) (defvar-local nameless--font-lock-keywords nil) @@ -210,6 +221,10 @@ configured, or if `nameless-current-name' is nil." "Return a regexp of the current name." (concat "\\_<@?\\(" (regexp-quote name) "-\\)\\(\\s_\\|\\sw\\)")) +(defun nameless--private-name-regexp (name) + "Return a regexp of the current private name." + (concat "\\_<@?\\(" (regexp-quote name) "--\\)\\(\\s_\\|\\sw\\)")) + (defun nameless--filter-string (s) "Remove from string S any disply or composition properties. Return S."