unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Coding conventions for `defface`
@ 2017-04-01 19:15 Tianxiang Xiong
  2017-04-03  7:55 ` Elias Mårtenson
  0 siblings, 1 reply; 4+ messages in thread
From: Tianxiang Xiong @ 2017-04-01 19:15 UTC (permalink / raw)
  To: Emacs developers


[-- Attachment #1.1: Type: text/plain, Size: 612 bytes --]

Many faces in Emacs Lisp end in `-face`, even though the Emacs Lisp manual
section on `defface` says that they shouldn't:
https://www.gnu.org/software/emacs/manual/html_node/elisp/Defining-Faces.html

One problem is that this convention is not mentioned in the Emacs Lisp
Coding Conventions section of the manual:
https://www.gnu.org/software/emacs/manual/html_node/elisp/Coding-Conventions.html#FOOT21

This can create confusion:
https://github.com/clojure-emacs/cider/pull/1966#issue-216440476

I've added an item to the Coding Conventions section of the Emacs Lisp
manual about naming faces.

Enclosed: patch

[-- Attachment #1.2: Type: text/html, Size: 1015 bytes --]

[-- Attachment #2: v1-0001-Add-item-to-Coding-Conventions-on-face-names.patch --]
[-- Type: text/x-patch, Size: 906 bytes --]

From ae7c1cd5fe571587d52b489615fe9f26a117fb7e Mon Sep 17 00:00:00 2001
From: Tianxiang Xiong <tianxiang.xiong@gmail.com>
Date: Sat, 1 Apr 2017 11:58:58 -0700
Subject: [PATCH v1] Add item to Coding Conventions on face names

---
 doc/lispref/tips.texi | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/doc/lispref/tips.texi b/doc/lispref/tips.texi
index 4e2a0fa..311369f 100644
--- a/doc/lispref/tips.texi
+++ b/doc/lispref/tips.texi
@@ -163,6 +163,11 @@ to store a list of functions (i.e., the variable is a hook), please
 follow the naming conventions for hooks.  @xref{Hooks}.
 
 @item
+@cindex face name
+Face names should not end in @samp{-face} (that would be
+redundant).  @xref{Defining Faces}
+
+@item
 @cindex unloading packages, preparing for
 If loading the file adds functions to hooks, define a function
 @code{@var{feature}-unload-function}, where @var{feature} is the name
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: Coding conventions for `defface`
  2017-04-01 19:15 Coding conventions for `defface` Tianxiang Xiong
@ 2017-04-03  7:55 ` Elias Mårtenson
  2017-04-03  7:58   ` Tianxiang Xiong
  0 siblings, 1 reply; 4+ messages in thread
From: Elias Mårtenson @ 2017-04-03  7:55 UTC (permalink / raw)
  To: Tianxiang Xiong; +Cc: Emacs developers

[-- Attachment #1: Type: text/plain, Size: 607 bytes --]

On 2 April 2017 at 03:15, Tianxiang Xiong <tianxiang.xiong@gmail.com> wrote:

> Many faces in Emacs Lisp end in `-face`, even though the Emacs Lisp manual
> section on `defface` says that they shouldn't: https://www.gnu.
> org/software/emacs/manual/html_node/elisp/Defining-Faces.html
>
> One problem is that this convention is not mentioned in the Emacs Lisp
> Coding Conventions section of the manual: https://www.gnu.org/
> software/emacs/manual/html_node/elisp/Coding-Conventions.html#FOOT21
>

Perhaps ‘defface’ itself could warn if it's being called with a name that
ends with -face?

[-- Attachment #2: Type: text/html, Size: 1208 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Coding conventions for `defface`
  2017-04-03  7:55 ` Elias Mårtenson
@ 2017-04-03  7:58   ` Tianxiang Xiong
  2017-04-03  9:15     ` Elias Mårtenson
  0 siblings, 1 reply; 4+ messages in thread
From: Tianxiang Xiong @ 2017-04-03  7:58 UTC (permalink / raw)
  To: Elias Mårtenson; +Cc: Emacs developers

[-- Attachment #1: Type: text/plain, Size: 799 bytes --]

Not sure it's worth taking a convention that far.

Do we warn when naming hook vars, etc.?

On Apr 3, 2017 12:55 AM, "Elias Mårtenson" <lokedhs@gmail.com> wrote:

> On 2 April 2017 at 03:15, Tianxiang Xiong <tianxiang.xiong@gmail.com>
> wrote:
>
>> Many faces in Emacs Lisp end in `-face`, even though the Emacs Lisp
>> manual section on `defface` says that they shouldn't: https://www.gnu.org
>> /software/emacs/manual/html_node/elisp/Defining-Faces.html
>>
>> One problem is that this convention is not mentioned in the Emacs Lisp
>> Coding Conventions section of the manual: https://www.gnu.org/so
>> ftware/emacs/manual/html_node/elisp/Coding-Conventions.html#FOOT21
>>
>
> Perhaps ‘defface’ itself could warn if it's being called with a name that
> ends with -face?
>

[-- Attachment #2: Type: text/html, Size: 1698 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Coding conventions for `defface`
  2017-04-03  7:58   ` Tianxiang Xiong
@ 2017-04-03  9:15     ` Elias Mårtenson
  0 siblings, 0 replies; 4+ messages in thread
From: Elias Mårtenson @ 2017-04-03  9:15 UTC (permalink / raw)
  To: Tianxiang Xiong; +Cc: Emacs developers

[-- Attachment #1: Type: text/plain, Size: 275 bytes --]

On 3 April 2017 at 15:58, Tianxiang Xiong <tianxiang.xiong@gmail.com> wrote:

> Not sure it's worth taking a convention that far.
>
> Do we warn when naming hook vars, etc.?
>

No, but on the other hand there is no ‘define-hook’ function to put such
warning on.

[-- Attachment #2: Type: text/html, Size: 652 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-04-03  9:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-01 19:15 Coding conventions for `defface` Tianxiang Xiong
2017-04-03  7:55 ` Elias Mårtenson
2017-04-03  7:58   ` Tianxiang Xiong
2017-04-03  9:15     ` Elias Mårtenson

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).