aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2019-02-02 13:23:04 -0800
committerPaul Eggert2019-02-02 13:25:00 -0800
commit713eece307bf48717b868f21789eed8160ada5ba (patch)
tree49b9e2a730618ba3222cfec67d6c9bc530858b0f
parent42c8399059bb311c8cfaf9428f0a29032d71011d (diff)
downloademacs-713eece307bf48717b868f21789eed8160ada5ba.tar.gz
emacs-713eece307bf48717b868f21789eed8160ada5ba.zip
Support (locale-info 'paper) on GNU platforms
* configure.ac (HAVE_LANGINFO__NL_PAPER_WIDTH): New macro. * src/fns.c (Flocale_info) [HAVE_LANGINFO__NL_PAPER_WIDTH]: Get paper width and height from locale.
-rw-r--r--configure.ac26
-rw-r--r--etc/NEWS3
-rw-r--r--lisp/international/mule-cmds.el1
-rw-r--r--src/fns.c23
4 files changed, 33 insertions, 20 deletions
diff --git a/configure.ac b/configure.ac
index 0259c822585..58579008f3a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4492,15 +4492,27 @@ fi
4492AC_SUBST(XGSELOBJ) 4492AC_SUBST(XGSELOBJ)
4493 4493
4494dnl Adapted from Haible's version. 4494dnl Adapted from Haible's version.
4495AC_CACHE_CHECK([for nl_langinfo and CODESET], emacs_cv_langinfo_codeset, 4495AC_CACHE_CHECK([for nl_langinfo and CODESET], [emacs_cv_langinfo_codeset],
4496 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]], 4496 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]],
4497 [[char* cs = nl_langinfo(CODESET);]])], 4497 [[char *cs = nl_langinfo(CODESET);]])],
4498 emacs_cv_langinfo_codeset=yes, 4498 [emacs_cv_langinfo_codeset=yes],
4499 emacs_cv_langinfo_codeset=no) 4499 [emacs_cv_langinfo_codeset=no])
4500 ]) 4500 ])
4501if test $emacs_cv_langinfo_codeset = yes; then 4501if test "$emacs_cv_langinfo_codeset" = yes; then
4502 AC_DEFINE(HAVE_LANGINFO_CODESET, 1, 4502 AC_DEFINE([HAVE_LANGINFO_CODESET], 1,
4503 [Define if you have <langinfo.h> and nl_langinfo(CODESET).]) 4503 [Define if you have <langinfo.h> and nl_langinfo (CODESET).])
4504
4505 AC_CACHE_CHECK([for nl_langinfo and _NL_PAPER_WIDTH],
4506 [emacs_cv_langinfo__nl_paper_width],
4507 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]],
4508 [[char *cs = nl_langinfo (_NL_PAPER_WIDTH);]])],
4509 [emacs_cv_langinfo__nl_paper_width=yes],
4510 [emacs_cv_langinfo__nl_paper_width=no])
4511 ])
4512 if test "$emacs_cv_langinfo__nl_paper_width" = yes; then
4513 AC_DEFINE([HAVE_LANGINFO__NL_PAPER_WIDTH], 1,
4514 [Define if you have <langinfo.h> and nl_langinfo (_NL_PAPER_WIDTH).])
4515 fi
4504fi 4516fi
4505 4517
4506AC_TYPE_MBSTATE_T 4518AC_TYPE_MBSTATE_T
diff --git a/etc/NEWS b/etc/NEWS
index 2bbc38769ea..cac379fe7eb 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1527,6 +1527,9 @@ systems, the XRender extension to X11 is required for this to be
1527available; the configure script will test for it and, if found, enable 1527available; the configure script will test for it and, if found, enable
1528scaling.) 1528scaling.)
1529 1529
1530+++
1531** (locale-info 'paper) now returns the paper size on GNUish hosts.
1532
1530The new function 'image-scaling-p' can be used to test whether any 1533The new function 'image-scaling-p' can be used to test whether any
1531given frame supports resizing. 1534given frame supports resizing.
1532 1535
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el
index f91b3ea6ce6..fdcd6060357 100644
--- a/lisp/international/mule-cmds.el
+++ b/lisp/international/mule-cmds.el
@@ -2727,7 +2727,6 @@ See also `locale-charset-language-names', `locale-language-names',
2727 (let ((paper (locale-info 'paper)) 2727 (let ((paper (locale-info 'paper))
2728 locale) 2728 locale)
2729 (if paper 2729 (if paper
2730 ;; This will always be null at the time of writing.
2731 (cond 2730 (cond
2732 ((equal paper '(216 279)) 2731 ((equal paper '(216 279))
2733 (setq ps-paper-type 'letter)) 2732 (setq ps-paper-type 'letter))
diff --git a/src/fns.c b/src/fns.c
index 345211418cb..a7279b13552 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -3118,8 +3118,8 @@ The data read from the system are decoded using `locale-coding-system'. */)
3118 str = nl_langinfo (CODESET); 3118 str = nl_langinfo (CODESET);
3119 return build_string (str); 3119 return build_string (str);
3120 } 3120 }
3121#ifdef DAY_1 3121# ifdef DAY_1
3122 else if (EQ (item, Qdays)) /* e.g. for calendar-day-name-array */ 3122 if (EQ (item, Qdays)) /* E.g., for calendar-day-name-array. */
3123 { 3123 {
3124 Lisp_Object v = make_nil_vector (7); 3124 Lisp_Object v = make_nil_vector (7);
3125 const int days[7] = {DAY_1, DAY_2, DAY_3, DAY_4, DAY_5, DAY_6, DAY_7}; 3125 const int days[7] = {DAY_1, DAY_2, DAY_3, DAY_4, DAY_5, DAY_6, DAY_7};
@@ -3136,9 +3136,9 @@ The data read from the system are decoded using `locale-coding-system'. */)
3136 } 3136 }
3137 return v; 3137 return v;
3138 } 3138 }
3139#endif /* DAY_1 */ 3139# endif
3140#ifdef MON_1 3140# ifdef MON_1
3141 else if (EQ (item, Qmonths)) /* e.g. for calendar-month-name-array */ 3141 if (EQ (item, Qmonths)) /* E.g., for calendar-month-name-array. */
3142 { 3142 {
3143 Lisp_Object v = make_nil_vector (12); 3143 Lisp_Object v = make_nil_vector (12);
3144 const int months[12] = {MON_1, MON_2, MON_3, MON_4, MON_5, MON_6, MON_7, 3144 const int months[12] = {MON_1, MON_2, MON_3, MON_4, MON_5, MON_6, MON_7,
@@ -3153,13 +3153,12 @@ The data read from the system are decoded using `locale-coding-system'. */)
3153 } 3153 }
3154 return v; 3154 return v;
3155 } 3155 }
3156#endif /* MON_1 */ 3156# endif
3157/* LC_PAPER stuff isn't defined as accessible in glibc as of 2.3.1, 3157# ifdef HAVE_LANGINFO__NL_PAPER_WIDTH
3158 but is in the locale files. This could be used by ps-print. */ 3158 if (EQ (item, Qpaper))
3159#ifdef PAPER_WIDTH 3159 return list2i ((intptr_t) nl_langinfo (_NL_PAPER_WIDTH),
3160 else if (EQ (item, Qpaper)) 3160 (intptr_t) nl_langinfo (_NL_PAPER_HEIGHT));
3161 return list2i (nl_langinfo (PAPER_WIDTH), nl_langinfo (PAPER_HEIGHT)); 3161# endif
3162#endif /* PAPER_WIDTH */
3163#endif /* HAVE_LANGINFO_CODESET*/ 3162#endif /* HAVE_LANGINFO_CODESET*/
3164 return Qnil; 3163 return Qnil;
3165} 3164}